[SOLVED] Packet Serial Issues with Arduino
Posted: Mon Oct 26, 2015 12:07 pm
Hi,
I am attempting to control a Roboclaw 2x60 using the packet serial mode, but encountering some problems. I have verified that the hardware works and is up to date by using the Windows Ionmotion software to update the firmware (on Friday 10/23) and successfully instruct the Roboclaw to drive a motor. However, I am experiencing difficulty getting proper communication established with an Arduino UNO R3. I downloaded the Arduino library and examples the week of 10/12 sometime, so they should be the up to date as well. I am able to get partial function using the simple serial mode example as follows: Roboclaw is set to Mode 6, Option 4; Arduino pin 10 is wired to S2, pin 11 is wired to S1, and Arduino ground is wired to the pin above the '-' label on the Roboclaw's IO block. This results in Motor B being driven bidirectionally as per the code in the example, but not Motor A. I have also attempted to use the packet serial read version example without success. I used the same wiring setup, but with the Roboclaw set to Mode 7, Option 4. Nothing was returned to the Arduino serial monitor (set to the proper baud of 57600), so I added an 'else' case to the code as follows:
This resulted in a partially garbled response being printed to the serial monitor, where the first several characters were not in the standard character set and were displayed as '?' boxes. The number of garbled characters remained consistent through each iteration of the loop() function. I tried substituting in Arduino's Serial library, with similar results. I also created a new sketch with only BMSerial at the same baud rate as the example and no Roboclaw calls, and was able to read the messages printed to serial just fine.
Is this code verified to work with an Arduino UNO R3? Or maybe I've made an obvious mistake that someone else here can catch? I'm not really sure how to troubleshoot this further, so any suggestions are welcome!
Thanks for your help!
Ross
I am attempting to control a Roboclaw 2x60 using the packet serial mode, but encountering some problems. I have verified that the hardware works and is up to date by using the Windows Ionmotion software to update the firmware (on Friday 10/23) and successfully instruct the Roboclaw to drive a motor. However, I am experiencing difficulty getting proper communication established with an Arduino UNO R3. I downloaded the Arduino library and examples the week of 10/12 sometime, so they should be the up to date as well. I am able to get partial function using the simple serial mode example as follows: Roboclaw is set to Mode 6, Option 4; Arduino pin 10 is wired to S2, pin 11 is wired to S1, and Arduino ground is wired to the pin above the '-' label on the Roboclaw's IO block. This results in Motor B being driven bidirectionally as per the code in the example, but not Motor A. I have also attempted to use the packet serial read version example without success. I used the same wiring setup, but with the Roboclaw set to Mode 7, Option 4. Nothing was returned to the Arduino serial monitor (set to the proper baud of 57600), so I added an 'else' case to the code as follows:
Code: Select all
if(rc.ReadVersion(address,version)){
terminalSerial.println(version);
} else {
terminalSerial.println("No response from roboclaw");
}
Is this code verified to work with an Arduino UNO R3? Or maybe I've made an obvious mistake that someone else here can catch? I'm not really sure how to troubleshoot this further, so any suggestions are welcome!
Thanks for your help!
Ross