Serial Communications problem using Linux Kernel 4.10 and 4.12

General discussion of using Roboclaw motor controllers
robg
Posts: 8
Joined: Mon Aug 07, 2017 11:48 pm

Serial Communications problem using Linux Kernel 4.10 and 4.12

Post by robg » Tue Aug 08, 2017 2:31 pm

Hi,

Communciating with a Roboclaw via a serial TTL connection on a Raspberry PI using packet serial on default address.
Robolcaw has firmware version 4.1.23 and communicating usign Python.
Using the example roboclaw_readversion.py, loose communications after a few cycles of the app.
Seems random, always responds on the first request. Once failed comms the only solution is to stop the code and rerun.
Have tried different baud rates and timeout setting.
Double checked my grounds are all common, cabling between the raspberry and roboclaw are less than 10cm in length. So stumped as to why I loose communications after a few commands.

Any assistance appreciated.

Rob.
Attachments
Capture.PNG
Capture.PNG (26.14 KiB) Viewed 5471 times

User avatar
Basicmicro Support
Posts: 1279
Joined: Thu Feb 26, 2015 9:45 pm

Re: Losing communication with Roboclaw,TTL serial and Raspberry PI

Post by Basicmicro Support » Wed Aug 09, 2017 9:36 am

As a test, close the comport and reopen if you get the error and see if that recovers it.

When did you download the python library from our website? If you didnt get it from our site or it was several months since you downloaded it grab a new copy.

Are you running a Raspbian or something else? Do you have any other programs running when you are testing? What version of the Pi are you using.

Please send a picture of your setup. Maybe we will see something you missed.

robg
Posts: 8
Joined: Mon Aug 07, 2017 11:48 pm

Re: Losing communication with Roboclaw,TTL serial and Raspberry PI

Post by robg » Wed Aug 09, 2017 1:20 pm

Hi,

Greatly appreciated the reply.
Downloaded from Pololu...
Running Jessie Lite, RP3.

Whilst I was updating Jessie, I thought had the problem licked.
It was working perfectly, in fact I took out all delays and was reporting back continuous with sub second responses.
After the updated had completed it then wen't back to failing, so yes suspecting it's a timing issue of some sort.

Couldn't find a method to close the com port.
So created my own in roboclaw.py as follows:

def Close(self):
self._port.flushInput()
self._port.close()

Within the app tried to:
rc.Open()
read function
rc. Close()
Still same issue.

But will download the latest roboclaw software...hope it's that simple!


As a last resort, was about to also reload a fresh downloaded copy of Jessie Lite and see what happens.

Rob.

robg
Posts: 8
Joined: Mon Aug 07, 2017 11:48 pm

Re: Losing communication with Roboclaw,TTL serial and Raspberry PI

Post by robg » Wed Aug 09, 2017 2:32 pm

Managed to resolve, and don't know why. So I'm posting this if others come across the same issue.

But what I did do was:

1. Clean install of Jessie lite
2. Install pyserial
3. installed python roboclaw software (version I had was the latest)
4. modified the config.txt and enable_uart=1 (possibly double the next line does this anyway)
5. sudo raspi-config and disabled serial console and enabled the serial port
6. modified the the sample app to point to: use ttyS0, 38400 (was already using this when I had problems)


Guess they day just started bad yesterday when it took me 20 minutes to find my keys and we ran out of sugar at work. Should have gone home then.

I'll start reloading some tools and see how it goes, if I find anything will post.

Rob.
Attachments
Capture.PNG
Capture.PNG (144.67 KiB) Viewed 5466 times

User avatar
Basicmicro Support
Posts: 1279
Joined: Thu Feb 26, 2015 9:45 pm

Re: Losing communication with Roboclaw,TTL serial and Raspberry PI

Post by Basicmicro Support » Thu Aug 10, 2017 9:29 am

Ya. I hate fixes like that. You know they will come back and bite you at some point. Keep us informed if it starts having a problem again.

gdoisy
Posts: 33
Joined: Tue Oct 18, 2016 7:53 am

Re: Losing communication with Roboclaw,TTL serial and Raspberry PI

Post by gdoisy » Thu Aug 17, 2017 5:37 am

Hello,
Having a similar problem with my custom ROS driver which uses the python driver.
I traced back the issue to the update of the linux kernel. Same computer, ubuntu 16.04. With kernel 4.8 it works perfectly, with kernel 4.10, the communication stops after few seconds. Connected directly to the USB port of the roboclaw.
I am reporting here as it may be linked to the issue of Rob.
I don't have time to investigate more, I will stay on kernel 4.8 for now (easy to revert with grub customizer), but will happily follow the thread.
Guillaume

gdoisy
Posts: 33
Joined: Tue Oct 18, 2016 7:53 am

Re: Losing communication with Roboclaw,TTL serial and Raspberry PI

Post by gdoisy » Tue Aug 22, 2017 9:00 am

Turn out that it is going to be an issue for us not to be able to use linux kernel 4.10. Should I open a separate thread ?

User avatar
Basicmicro Support
Posts: 1279
Joined: Thu Feb 26, 2015 9:45 pm

Re: Losing communication with Roboclaw,TTL serial and Raspberry PI

Post by Basicmicro Support » Tue Aug 22, 2017 10:04 am

The problem only happens in 4.10 so you may need to be digging in Linux kernal forums to see if there is a bugreport that would explain the problem.

Assuming you cant find anything like that you will need to debug the problem. Modify the ROS python code to determine where it is dying. The ROS system should also be able to give you more information(status of the process etc).

Unfortunately we arent going to be able to setup a Linux 4.10 system anytime soon. Our backlog is around 6 months at this point for extended projects like that.

gdoisy
Posts: 33
Joined: Tue Oct 18, 2016 7:53 am

Re: Losing communication with Roboclaw,TTL serial and Raspberry PI

Post by gdoisy » Thu Aug 24, 2017 4:29 am

Okay,
I will report my findings here when I will have time to debug.
For now I can just tell you that the node is not crashing, the cummunication just stops.

gdoisy
Posts: 33
Joined: Tue Oct 18, 2016 7:53 am

Re: Losing communication with Roboclaw,TTL serial and Raspberry PI

Post by gdoisy » Wed Aug 30, 2017 12:41 am

FYI, in order to check if it was ROS dependent, I dowloaded the last python library available on your website and tried:

Code: Select all

python roboclaw_read.py 
With kernel 4.8, no problem, with kernel 4.10 and 4.12, it stops after a few cycles.

Post Reply