Modbus master comunication via UART0

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Modbus master comunication via UART0

1,522 Views
ioniriondo
Contributor I

Hi,

I'm traying to comunicate via modubs protocol. I've done the protocol to comunicate the slave with the PC using the UART4, and it works fine. But now, i have to comunicate a master module with a slave using the UART0.

The comunication works fine when using the UART4 port, but when changing to the UART0 port, it doesn't comunicate. Is there something different that I must do when using the UART0 instead of the UART4?

I now that the UART0 uses the core clock and the UART4 the bus clock, but in this case, both have the same frecuence.

Labels (1)
0 Kudos
10 Replies

924 Views
danielchai
Senior Contributor I

Hi lon,

Did you implement modbus yourself or you port from some place?

Because now I am trying to implement Modbus on my customed board, but I don't know if I need to implement it myself or there is some existing stack for it.

Thanks.

-Daniel

0 Kudos

924 Views
ioniriondo
Contributor I

hi Daniel,

I implemented myself with code used in my work. I don't know if there is existing code to implement, sorry.

0 Kudos

924 Views
vallinaths
Contributor II

hi Lon.

 

  can you please let me know whether modbus works smoothely on K60 tower board .also please can you share us the modbus source code so we can also try it on the tower board /

regards

vallinath

0 Kudos

924 Views
LuisCasado
NXP Employee
NXP Employee

Hi Ion,

What kind of error do you have with UART0? I suggest you to review the PIN MUX configuration on the UART0 compared to the working UART4, the PORT configuration is needed even if the PIN is configured as UART (pull, strength, etc..)  To know what is the processor would also help.


Best Regards,

Luis

0 Kudos

924 Views
ioniriondo
Contributor I

Hi Luis,

I don't have any error with the UART0. The situation is this. I have one module (slave) an the PC works in master mode. in this case, I use the one port configured with UART4.

Now, i want to do the inverse, i want the module be the master, and the PC the slave. To work with this I use the modbus poll aplication.

In the module, i have 2 ports. The first that i use with UART4 to comunicate in slave mode, and the second with UART0 to comunicate in master mode. When trying to comunicate in this way, i mean, in master mode, i can comunicate to the PC via the UART4 port, but when switching to the UART0 port, It doesn't comunicate with the PC.

I have the same configuration for both UART4 and UART0, and the code to comunicate in master mode is ok because i proved that i can comunicate via the UART4 port to the PC. The thing is to do this with the UART0 port, and here is the question. Is something different with the UART0 that i have to consider when programming it??

0 Kudos

924 Views
LuisCasado
NXP Employee
NXP Employee

Hi,

What is the processor?

For example, for K60, UART's are not exactly the same:

 

1. Standard features of all UARTs:

• RS-485 support

• Hardware flow control (RTS/CTS)

• 9-bit UART to support address mark with parity

• MSB/LSB configuration on data

2. UART0 and UART1 are clocked from the core clock, the remaining UARTs are

clocked on the bus clock. The maximum baud rate is 1/16 of related source clock

frequency.

3. IrDA is available on all UARTs

4. UART0 contains the standard features plus ISO7816

5. AMR support on all UARTs. The pin control and interrupts (PORT) module supports

open-drain for all I/O.

6. UART0 contains 8-entry transmit and 8-entry receive FIFOs

7. All other UARTs contain a 1-entry transmit and receive FIFOs

Do you seen data output from UART0 with scope?

Regards,

Luis

0 Kudos

924 Views
ioniriondo
Contributor I

The processor is K60.

I know the main difference is the clock, but in my case, both work at 50Mhz, so this configuration is the same.

I've seen the data output with a scope and is the same in both ports differentiating that in the first, the data gous through the Rx pin and in the second thorught the Tx pin.

0 Kudos

924 Views
LuisCasado
NXP Employee
NXP Employee

Ion,

I don't understand what you mean with the ports pins. Data is output through the RX pin? What is the first and what the second?

Can you elaborate more? difficult to help you with the information you provide.

Luis

0 Kudos

924 Views
ioniriondo
Contributor I

Luis, do yo speak spanish?

0 Kudos

924 Views
LuisCasado
NXP Employee
NXP Employee

Hi Ion,

Yes, I do. But we have to use english here and everybody can understand and contribute. You can contact to your local distributor FAE to get local support.

Best Regards,

Luis

0 Kudos