Author Topic: Problems with data transmission over the serial port  (Read 1224 times)

0 Members and 1 Guest are viewing this topic.

Offline RemarkTopic starter

  • Contributor
  • Posts: 31
  • Country: lt
Problems with data transmission over the serial port
« on: February 10, 2022, 02:03:08 pm »
Hello!

I have several devices connected to the RS485 USB (CH340) converter https://static1.gleanntronics.ie/eng_il_RS485-CH340-USB-Converter-Modbus-Profibus-PLC-Arduino-71.jpg the devices are connected on a garland basis from one to another.

These devices should send a response to the master at a unique time interval to avoid data collisions. My master 'device' is python application running PySerial. When for example 1 digit is sent from master to slaves, they should respond back with their ID addresses. But the problem is, that I get only last device on the line response (with longest delay) and I don't get answers from all the other devices. If I disconnect that one device with longest response time, then responds other with the longest interval and so on...

Maybe there are those who know what this could be too problematic? Is it possible for the master to receive a response from slaves after sending a request, for example:  b '\ x1 \ x2 \ x3 ...' ?
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 9779
  • Country: fi
Re: Problems with data transmission over the serial port
« Reply #1 on: February 10, 2022, 04:16:16 pm »
There is this ongoing another thread about "intermittent problems". Yours is not intermittent, but the same applies:

You need to add visibility to the system and investigate systematically.

Some slaves do not respond. Possible causes:
* They do respond, but master does not hear them
* They actually do not respond

Let's assume the latter... Why don't they respond?
* They don't see the poll command
* They do see it, but fail to reply correctly

You see where this is leading? You need to know what part of your code is running. Simplest way: make the thing switch an IO pin to a different state when it receives the command. Look at the pin with an oscilloscope. You can also use UART printing, or a debugger, adding a breakpoint. Many different ways, but the troubleshooting strategy is important.
 
The following users thanked this post: Remark

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
Re: Problems with data transmission over the serial port
« Reply #2 on: February 16, 2022, 07:17:19 pm »
My RS-485 (Modbus, actually) slave cards have two LEDs. One for any activity, one for personally selected.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf