Simple Serial Issue

General discussion of using Roboclaw motor controllers
Post Reply
steveski
Posts: 22
Joined: Wed Jan 06, 2016 2:09 pm
Simple Serial Issue

Post by steveski »

I am trying to use a terminal program to test serial strings to the Roboclaw so that I can develop some Visual Basic.Net code later. I had no luck with the packet serial, so thought I would try the simple standard serial. I am able to move motor 1 in one direction by sending the number 1 and the other direction by sending a 64. 0 and 127 stops motor 1. I can't seem to get motor 2 to move. When I send 128 or 192 or 255 nothing happens. I have also tried -1 and -127 to no avail. I can move motor 2 with the Ion software thru USB. Any ideas?
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Simple Serial Issue

Post by Basicmicro Support »

1. You will need to use a special terminal program to test packet serial manually. First because the packet must use binary bytes(not characters) and second because the packet will be rejected if it takes longer than 10ms to receive each individual byte

2. What terminal prorgam are you using. Like packet serial, simple serial requires the data be binary values, (eg 64, not "64").
steveski
Posts: 22
Joined: Wed Jan 06, 2016 2:09 pm
Re: Simple Serial Issue

Post by steveski »

I am using Realterm which does allow sending numbers instead of ASCII characters. In simple serial does the 10ms apply because it is only one byte? Let me know if there is a terminal program that you guys use and have better luck with.
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Simple Serial Issue

Post by Basicmicro Support »

Correct. Simple Serial does not have a timeout since it is just single bytes. Also simple serial has no error correction becasue it is a single byte so we definitely recommend packet serial.

Real Term does work. If you send packet serial bytes and you have the latest firmware you need to calculate the CRC16 checksum which is non-trivial. Otherwise the write commands(eg commands that move the motors ect) will be ignroed. Commands that send data back(eg to read the version for instance) send the CRC16 back with it but you can ignore those 2 bytes when testing with RealTerm.

In RealTerm are you typing the value in using decimal or hexidecimal notation?
steveski
Posts: 22
Joined: Wed Jan 06, 2016 2:09 pm
Re: Simple Serial Issue

Post by steveski »

I have tried both hex and decimal, but can only get motor 1 to move. I am using the simple serial now just to test and make sure I can talk to it and then I was going to try to move up to the packet serial. I don't believe the simple serial requires the checksum. Is that correct? Can you give me a screen shot of a number you would send to make motor 2 move and the location in Realterm? It seems so simple, but it just isn't working.
steveski
Posts: 22
Joined: Wed Jan 06, 2016 2:09 pm
Re: Simple Serial Issue

Post by steveski »

Also, my firmware is 4.1.16
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Simple Serial Issue

Post by Basicmicro Support »

Yes, Simple serial does not require a checksum. It is a single byte. No error correction and no checksum.

I recommend you confirm the second motor works from IonMotion(or use RC or Analog control mode) to check if there is some other problem with the motor channel/wiring.

Im not sure how RealTerm would interpret signed values so I think you should stick with unsigned numebrs. Eg 0 to 255 or 00 to FF(I dont think RealTerm works with 0x##s, and Im pretty sure you have to tell it if the values will be hex or decimal). Roboclaw will read the 0x80 to 0xFF values as signed numbers(eg twos complement format, -128 to -1). Note that 64 stops motor 1, 192 stops motor 2. 0 stops both motors. All other values should cause motor movement unless some thing is wired wrong, a motor setting is incorrect or the controller is damaged. Damage would usually be detected and cause an error to blink on the LEDs. Incorrect motor settings would be things like setting the max current to a very low value.
steveski
Posts: 22
Joined: Wed Jan 06, 2016 2:09 pm
Re: Simple Serial Issue

Post by steveski »

I just figured out my problem. I was trying to go straight from my PC COM port to the Roboclaw. I put a MAX232 board in between and now everything is working great. Thanks for your suggestions.
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Simple Serial Issue

Post by Basicmicro Support »

Ah. That would do it. Glad we have protection on those pins. :)

Post Reply