Open GoogleCodeExporter opened 8 years ago
In order for the Illegal data address to be set by the slave the starting
address must be equal or larger than the holding register array size. You have
a constant of 40 which means the slave will occupy 40 unsigned int registers.
From your code snippet it seems you are requesting 27 registers starting from
address 0. This is normal and should work perfectly (as you mentioned). The
arduino core keeps changing, they have changed the hardwareSerial core library
ring buffer size from 128 bytes to 64 bytes which means you can only request 29
unsigned int registers, but you are requesting only 27 which is ok. I can only
see that the Illegal data address error code is generated because of a buffer
overrun and/or garbled data in the frame buffer array. As mentioned the
starting address has to be equal or larger for the error code 2 to be set. This
means the third and/or fourth byte of the frame contains erroneous data bigger
or equal to 40.
Just to verify:
Does your slave go offline permanently?
What is the retry value of your master?
How does your RS485 driver circuit look like? Pull ups, pull downs, Rx tied
high.
Send me your slave example sketch..
Original comment by bester.j...@gmail.com
on 8 Jan 2014 at 7:30
The request is 27 in HEX which then corresponds to 39 DEC think could be the
problem now if the buffersize is 64 corresponding to 29 unsigned int.
I use Arduino IDE 1.0.5 is confident that the buffersize is 64? Can I verify
this ?
Answering questions:
1 Yes the slave go off permanently until I perform a soft reset. Answers always
<01> <83> ...
2 The return value is always <01> <83>
3 I have the pull ups and pull dows rx is pulled up
Original comment by max.bene...@gmail.com
on 8 Jan 2014 at 8:52
There will definitely be a buffer overrun in the HardwareSerial core library.
They changed the core lib in version 1.05. This is easy to change by altering
the define constant 64 to "SERIAL_BUFFER_SIZE 128" on line 59 in the
HardwareSerial.cpp file. Located at C:\Documents and Settings\USER\My
Documents\arduino-1.0.5\hardware\arduino\cores\arduino\HardwareSerial.cpp
Original comment by bester.j...@gmail.com
on 10 Jan 2014 at 7:49
Ok Thanks.
Original comment by max.bene...@gmail.com
on 10 Jan 2014 at 10:47
Original issue reported on code.google.com by
max.bene...@gmail.com
on 26 Dec 2013 at 11:05