Can't run the Arduino example

I tried to use Arduino to control the ODrive by following the example in github, but failed. Apart from the connections, do I need to perform other settings for ODrive?

What do you exactly mean ? What has failed?

not really. Make sure you used the same baudrate (defaults to 115200) + check you got the connection right. I personally start with reading firmware version to check everything’s fine

String ODriveArduino::getBoardInfo(){
    serial_ << "i\n";
	String res = readString() + ", " + readString() + ", " + readString() + "\n";
	return res;

I use a modified version of the official odrive arduino lib on an arduino mega

Dear alexisdal,

I use arduino mega too. I use Serial1 for the communication between Odrive and mega, and use Serial0 for the communication between mega and the PC. In terms of connections, GPIO1 of Odrive is connected to rx1 of mega and GPIO2 of Odrive is connected to tx1 of mega. By the way, I also connected the GND of mega to the GND of Odrive. Regarding the programming, I follow the official library. The only difference is that I didn’t use softserial but directly use Serial1 of mega. However, the motor didn’t move.

Yes we’re having exactly the same setup

Do you even get a firmware version ?

If yes, then the communication works => then you should try to follow the getting started guide to get more comfortable with commands using odrivetool / USB / PC. Then try to repeat the same commands on your arduino code

If no, then it’s an arduino <-> odrive communication issue. What do you see maybe with an oscilloscope ? Nothing at all?

In my experience, getting motors to move as you want them to with odrive is frustrating.

Good luck

Dear alexisdal,

I’ve solved the problem. It’s about the setting of the working mode of the GPIOs. Thanks.