ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Serial Receives Unintended Data "0xFD"- Hardware Interface

asked 2019-09-18 06:55:09 -0500

Dragonslayer gravatar image

updated 2019-09-18 07:13:01 -0500

Setup:

  • usb to rs485 half duplex transceiver/adapter.
  • Microcontroller through rs485 transceiver.
  • linux 18.04
  • libserial (from source)
  • Ros Melodic

When receiving Data on the PC end, I get lots of 0xFD. Only very seldom do I get to read just the message, which is correct and not corrupted itself, but most times lead on by many 0xFDs. I sent commands to the mc to be answered. The timing is not yet fully worked out, might this characters be a linux intern "nothing received" or "message sent" feedback that Iam not aware of? Does anybody have a clue what does 0xFD Data mean, and why it ends up in the serial input buffer? Is it a kind of controlcharacter? Even if the microcontroller is switched of the Read function receives this bytes/characters. They vary in number though. Something wrong with the Termios? Iam using libserial build from source. Any help would be appreciated.

edit retag flag offensive close merge delete

Comments

This SO post seems similar.

gvdhoorn gravatar image gvdhoorn  ( 2019-09-18 07:17:18 -0500 )edit

Thanks gvdhoorn, but Iam receiving the correct messages just additional 0xfd´s. To force it to work I can do a .ReadByte loop until I find the message ID(begin) and siff through the "garbage" but thats not a nice solution. Something like that is very likely to come back and bite me I think :)

Dragonslayer gravatar image Dragonslayer  ( 2019-09-18 07:34:31 -0500 )edit

Serial connections are a really "low" (or close-to-the-metal) type of transport. Anything fishy with the electro-mechanical interfaces, baud-rates or communication parameters will often immediately show up in data you read from the port.

Have you made sure all of that is OK? Do other libraries / ways of reading from/writing to the port work correctly? Is the problem only with libserial (is it actually wiki/serial)?

If other libraries/tools also cannot use your RS485 port successfully, then that would be something to fix first.

gvdhoorn gravatar image gvdhoorn  ( 2019-09-18 07:39:26 -0500 )edit

Thanks again. No Iam using link text this library. Thanks for the advise. I can use the serial port sucessfully, besides the additional "garbage data". And it doesnt intermingle with the data packages, so I think it all does what it should just that it does something Iam not aware of as well. But what, is the question?

Dragonslayer gravatar image Dragonslayer  ( 2019-09-18 07:51:18 -0500 )edit

Then this does not appear to be a ROS question, but a more general "why am I seeing this behaviour from my RS485 port in combination with this library?". With more than 45000 questions here on ROS Answers, we must stay on-topic as much as possible.

I would recommend you post this question on a forum more appropriate for this type of topic.

if you do post somewhere else, it'd be appreciated if you could comment here with a link to your new post, so we can keep things connected.

gvdhoorn gravatar image gvdhoorn  ( 2019-09-18 08:00:07 -0500 )edit

OK, I thought I start here because to me it seems to be not really a bug or failure (unknown data has structure and consistancy), but more of a settings issue. Which likely could have been encountered or be known by others doing serial HW interfacing for ROS. Is your linked serial library somehow specialy for ROS?

Dragonslayer gravatar image Dragonslayer  ( 2019-09-18 08:14:37 -0500 )edit

Is your linked serial library somehow specialy for ROS?

No, but it is a ROS package. If the problem was with that specifically, that would make the question somewhat on-topic.

gvdhoorn gravatar image gvdhoorn  ( 2019-09-18 08:17:43 -0500 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2019-09-18 13:04:50 -0500

Dragonslayer gravatar image

updated 2019-09-18 13:09:04 -0500

gvdhoorn gravatar image

Embarrassing, but it was the baudrate, at least in parts. Still get this data with nothing attached to the usb/rs485 transceiver, but when everything is online, it works. Just one more case of using quality components with serious documentation would have saved a lot of annoyance. 1Mbaud did the trick, 2Mbaud was to much for the wit-motion.com "quality" product, with love from china. Extra bought the most expensive one, what a waste.

edit flag offensive delete link more

Comments

Good to hear you figured it out.

Still get this data with nothing attached to the usb/rs485 transceiver

that could be a configuration issue: RS485 can be configured to mirror all bytes written to the read buffers.

gvdhoorn gravatar image gvdhoorn  ( 2019-09-18 13:08:47 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2019-09-18 06:55:09 -0500

Seen: 429 times

Last updated: Sep 18 '19