Page 1 of 3

Serial Communications problem using Linux Kernel 4.10 and 4.12

Posted: Tue Aug 08, 2017 2:31 pm
by robg
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.

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

Posted: Wed Aug 09, 2017 9:36 am
by Basicmicro Support
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.

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

Posted: Wed Aug 09, 2017 1:20 pm
by robg
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.

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

Posted: Wed Aug 09, 2017 2:32 pm
by robg
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.

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

Posted: Thu Aug 10, 2017 9:29 am
by Basicmicro Support
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.

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

Posted: Thu Aug 17, 2017 5:37 am
by gdoisy
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

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

Posted: Tue Aug 22, 2017 9:00 am
by gdoisy
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 ?

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

Posted: Tue Aug 22, 2017 10:04 am
by Basicmicro Support
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.

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

Posted: Thu Aug 24, 2017 4:29 am
by gdoisy
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.

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

Posted: Wed Aug 30, 2017 12:41 am
by gdoisy
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.