Hello, I'm having problems trying to make the MODBUS RTU Client code work on my board.
I'm devoloping with nrf Connect SDK v2.1.0, using Visual Studio Code.
The board uses an nRF52832 microcontroller, it also has an SN65HVD72DRBR IC(which is like a max3485 module, with different footprint) for RS-485 communication. And I have connected on the other side a TUF-2000 flow meter.
The conection to the RS-485 IC is the following:
PO_02 -> D
PO_03 -> R
PO_04 -> DE
PO_06 -> RE
I have these definitions in the .dts file:
These definitions in the .overlay file:
I added the "label = "zephyr_modbus_serial"", in order for the firmware to compile this part:
This is the prj.conf part of the modbus_serial:
In the RTU Client example there is no initialization of the uart, nor the uart pins, this is very confusing to me. Seems to me that there is some kind of magic in the "@Arduino_serial" in the overlay file.
I tried adding the "@Arduino_serial" in my overlay or dts files but the firmware does not compile at all, so I kept using "@uart0" as my previous firmware used to work and added the modbus_serial to it.
So, what is the situation now? The firmware compiles, the funtions are called, everything happens except that there is no data coming off the RS-485 module.
Here is the code that uses this modbus client:
The logged data in the Ozone Debugger shows rx_timeout:
I hooked up B, A, DE and RE lines with a logic analizer, this is observed on the moment th function init_modbus_client() is called:
After this moment, there is no change in any of the lines (B, A, RE and DE).
I am very confused as to why there is nothing happening in any of the RS-485 lines. Maybe there is something not intialized correctly, or not initialized at all. I searched through the forum and the internet for answers, they got me this far...
Before all of these, I was using uart_tx function and handling the DE and RE pins separetly, which worked but was very flawed. So I started to look into modbus_serial implemtentation but haven't yet make it work.
If anyone has any inside on this problem I will appreciate it very much.