UART for RS485 :: RTS timing

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

UART for RS485 :: RTS timing

2,064 次查看
clenz
Contributor I

Hey everybody

On a K20 Chip (MK20DN512VMD10) with MQX 4.1.

I am trying to run a UART with a RS485 transmitterdevice which I am controlling with the RTS (request to send).

My Problem now is that, as soon as I use higher baudrates (i.e. more than 9600) on the UART the timing of the RTS seems to be messed up (see image) or the

UART itself has interruptions while sending bytes.

default.png

The RTS goes down between some bytes which, in my case, deasserts the RTS and disables the transmission of the attached transmitter.

I don't think that this is actually wrong from the view of the RTS but either my RS485 Adapter or the Serial Console interprets the transmission interruption as a Stop.

So the question would be: How can i get my UART to run with high baudrates so that it doesn't have those interruptions in the transmission?

This never seemed to be a problem with the normal serial driver.

I am using the polled serial driver which i am opening/configuring accordingly:

#define BSP_DEFAULT_IO_OPEN_MODE              (void *) ( IO_SERIAL_XON_XOFF | IO_SERIAL_TRANSLATION  | IO_SERIAL_HW_485_FLOW_CONTROL /*| IO_SERIAL_ECHO*/) 

cheers

Chris

Btw. I found - and correct me if I am wrong - that one cannot use the IO_SERIAL_ECHO for RS485 with half-duplex use, since the driver (serl_pol.c) is implemented to echo each character

on the serial line and therefore deasserts the RTS and data loss occures if more than one byte should be received.

0 项奖励
回复
2 回复数

1,170 次查看
soledad
NXP Employee
NXP Employee

Hello Christian,

Could you please try using the example code located at the path: C:\Freescale\Freescale_MQX_4_1\mqx\examples\rs485  ??

The rs485 example demonstrates how to transmit and receive data through rs485 data’s channel. The baudrate for this example is 115200.

I hope this helps,


Have a great day,
Sol

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复

1,170 次查看
clenz
Contributor I

Hi sol

Thanks for the input.

The RS485 example was my base to start. So the only difference to what I do is, that i am not writing things with the write(.) function

but I am using the printf function.

This should be a proper use from my understanding?

Anyway, I tried to run the example and compare results and the problem seems to have vanished.

I then tried it with my project and I found out that i have a TimerInterrupt enabled in my bsp(with Processor Expert) on a 1ms

basis.

As soon as I am running my own methods in the connected TimerInterrupt event, the UART interruptions

occur again.

So at that point I am not sure why this is happening

Thanks for your time

cheers

0 项奖励
回复