Greetings--- I have experienced this problem before. It is likely an issue with the physical interface, not software. Basically the issue is that the receiver is still receiving when the line goes to an idle undefined state, and receives "garbage" data. Search for RS 485 failsafe bias for more background. You will need some kind of biasing resistor to pull the line(s) up to a true idle state.
On Monday, December 12, 2016 at 11:15:17 PM UTC-5, 張皓傑 wrote: > > Hi all > > I'm useing debian 7.11(kernel 3.8) version image. > I'm trying to use rs485 cape on BBB or BBG. Below are the cape I use. > 485 CAN CAPE > http://www.waveshare.com/wiki/RS485_CAN_CAPE > 485 CLICK BOARD > http://www.mikroe.com/click/rs485-3.3v/ > > As I know these boards don't have capability to auto handle read/write > mode switching. > I try to use linux rs485 mode to auto handle switching problem. > The attached file is my sample code. > > My problem is if I read data after writing, the receiving data will add a > redundant data(0x00) at the beginning of the buffer. > Below is the result. > This is modbus command, that due to the redundant data, the modbus command > will be failed. > So I use raw command to get data. > > send: 01 04 00 00 00 01 31 CA > receive: 00 01 04 02 01 3E 39 70 > > send: 01 04 00 01 00 01 60 0A > receive: 00 01 04 02 00 E2 39 79 > > send: 02 04 00 00 00 01 31 F9 > receive: 00 02 04 02 00 BA 7C 83 > > send: 02 04 00 01 00 01 60 39 > receive: 00 02 04 02 00 FA 7D 73 > > send: 03 04 00 00 00 01 30 28 > receive: 00 03 04 02 03 11 00 0C > > send: 03 04 00 01 00 01 61 E8 > receive: 00 03 04 02 00 DE 40 A8 > > This redundant data is not read data from modbus device. I use another > rs485 cable to monitor the data will not have this redundant data. > Like this: > send: 01 04 00 00 00 01 31 CA > receive: 01 04 02 01 3E 39 70 > > If I only use receive mode, there will not be any redundant data in the > buffer. > > As I tried, kernel 4.4 cannot work 485 system call. > > I'm not familiar in kernel, does anyone could give me some advice? > > Many thanks, > Harvey > -- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups "BeagleBoard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/f2e6b25a-1f23-42db-a3dc-4b71d963a280%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
