µTasker Forum > MODBUS

Modbus RTU on TWR-K20D72M

(1/4) > >>

Hi Mark,
somewhere on nxp.com you wrote, that the uTasker MODBUS module runs together with the NXP tower board TWR-K20D72M. This makes me hope, that you´ve already tried it with this hardware. It´s also supported in the code. How do you connect this board to RS485. I can´t get any connection to the board using TWR-SER or TWR-IND-IO serial modules. Maybe the reason for this could be, that the only UART with flow control between the boards is UART1 and this one is also used by the onboard OSBDM debugging circuit on the main board. Have you ever tried this combination with Modbus RTU?
If yes, maybe you can help me with my setup?!
Best regards Felix


I have used Modbus on many parts and as long as you set up the correct UART (and possible its mux pins) there will be no problems with this HW configuration.

Make sure you select the appropriate UART channel with
#define MODBUS_UART_0    1
(would put the first Modbus serial connection on UART 1 in this example)

Don't use Modbus RTU over OpenSDA connections since they don't work, if I remember correctly - use a "real" UART/RS232/RS485 connection.

For RS485 check that the RTS signal is correctly connected if semi-duplex, otherwise RS485/RS232 has not operational difference.

When tower boards are connected there is often an automatic switch-over of the UART path between the OpenSDA and the SER board - check the circuit diagram for details.

I would also first put the debug interface onto the UART that you want to use so that you can easily verify that it is 'physically' working. Solve any potential HW settings to get it operating and then switch to Modbus instead, which will probably then also function.



Hey Mark,

Thank you for the fast response.
I can measure a valid RTU signal and RX is forwarded to the µC. But there is no reply on TX. If I put the DEMO UART on UART1 I can see messages on TX, so my hardware setup should be okay.
The Modbus channel is also selected as you mentioned and I don´t connect OpenSDA.
Is there any other software module which could block transmitting on UART1?

Thanks for your help and regards


The first thing that I would do is run the project in the simulator, set a break point in the UART interrupt routine and inject a signal (eg. by using the UARTs menu). If the break point is hit you have the UART configured - then step the code to see that it calls the RTU HW timer, after which it will also hits its interrupt after the input frame has been received.

Once you are sure that this is correct (SW setup is as expected) repeat on the HW - any differences should pin point what is going wrong.
Also don't forget that the MODBUS slave will have an address so will only answer on the correct address. Check which address is being used if the UART is operating but the not returning a response.



Hi Mark,

thanks for your reply.
I´m pretty sure now, that it´s a software problem because I can run a self build application that is sending RS485 signals on the same hardware. The slave adress should also not be the reason because I use a master application on my PC which scans the hole adress range.
What I actually want to do is very easy: A single Modbus slave on UART1. 
I'm trying to get your initial example project to work as described in the Modbus user´s guide without any success.
The tranceiver (via UART1) on my TWR-IND-IO board gives some messages to the controller (RX) and there´s some toggling on RTS pin (200ms) but no response on TX.
What else should I take into account? Could some other code in the background affect the UART1 transmission or something like that? Do you maybe have example code for a similar configuration?
Hope you can give me a clue once again ;-)

Regards Felix


[0] Message Index

[#] Next page

Go to full version