I’ve been reviewing and I see that the ModbusSerialMaster.device.lib.nut: 2.0.0 libraries are designed for the impAccelerator ™ Fieldbus Gateway (imp005) which uses hardware.uart2 for communication. where the C7 & B18 pin are for Tx & Rx. and the L pin for nRE
I am trying to develop this communication but with an impExplorer ™ Developer Kit (imp001) + TTL / Rs485 module. in this imp001 the Tx & Rx are in other pins so I have doubts about how to configure them (hardware.uart2) to use the library.
I’m using this test code to try to read a modbus slave with the imp explorer kit
Hi again, so there are two problems here, first one is why hardware.uart2 does not give you error, as imp001 does not have uart2 (then you might confuse with uart2 on imp005 you have used before). Then second one is need correct wiring for the available uart you can use from imp Explorer kit. I suggest to use uart57:
The only problem with this is that the explorer kit, with its limited I/O, doesn’t have a single UART available on external pins.
The two uncommitted pins (on the grove analog/digital headers) are pin2 and pin5; pin7 is an input to the RGB LED. This is still usable, but the LED may go crazy
You really need to pick this off before it gets to the 5v buffer though (U6). Getting at it on the SD socekt pins may be the easiest option… or just use an April breakout board where all pins are available.
If the slave goes off and the imp device continues on, it sends me the log “Error 80” of timeout. After a lapse of time, when the slave is switched on, the correct reading of modbus registers continues in the log.
if the imp device shuts down, and the slave continues to turn on, after a lapse of time, when the imp device is turned on it connects and only gets “Error 80”
As this requires the slave to be reset, I would suspect that during the imp power cycle, maybe there’s a bus condition which is upsetting the slave.
This would be easy to spot with a scope or logic analyzer - do you have anything like that?
Aside from that, one suggestion would be to ensure that the TX enable pin (pin2 in this case) has a pull up/down to hold it in the inactive state when the imp is in reset.