RS485 on 52259 MQX 3.8

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

RS485 on 52259 MQX 3.8

775 Views
Toe
Contributor IV

So I was trying to get a 485 implementation working properly in mqx.  I have an enable pin that needs to be turned off after I am done sending a message.  I realized that this was being turned off before all of the data had been sent.

 

I'm using the interrupt version of the serial driver in MQX and I am calling fflush after writing to the device with the assumption that it would return when all the data had been sent.

 

I noticed that there is a command that is available in the Kinetis parts that for some reason is left out of the coldfire parts:

IO_IOCTL_SERIAL_WAIT_FOR_TC

 

The rs485.c example tries to use it and throws an error and the comment says "use newer MQX version".  Funny...

 

So I added the code in serl_pol_mcf52xx.c in the function _mcf52xx_uart_serial_polled_ioctl and wanted to post it here if it might help someone else.  It probably should be added to the MQX codebase.


case IO_IOCTL_SERIAL_WAIT_FOR_TC:    while(!(uart_ptr->READ.USR & MCF52XX_UART_USR_TXEMP)) ;    break;

 

Now if I call that before disabling my enable pin I don't miss any data on my line.

0 Kudos
1 Reply

378 Views
DavidS
NXP Employee
NXP Employee

Hi Toe,

Sorry for your troubles but good work to resolve and much thanks for sharing.

I will pass this information on to our FSL MQX Development team.

Best Regards,

David