cancel
Showing results for 
Search instead for 
Did you mean: 

Connecting UART2 to RS485 (Delivery Enable problem)

avnera
Associate II
Posted on January 21, 2009 at 03:50

Connecting UART2 to RS485 (Delivery Enable problem)

2 REPLIES 2
avnera
Associate II
Posted on May 17, 2011 at 09:57

Hi,

I'm having problems controlling the delivery-enable output while using UART2 with RS485 (working with FreeRTOS)

since the RS485 is half duplex, i have to control the DE status. when i finish transmitting i turn back the DE to allow reception.

i have to check when the bytes are actually TXed before i reset the output.

i tried using the following code to check when the FIFO is not busy, this busy-waiting is causing problems with the FreeRTOS

portENTER_CRITICAL();

{

while (UART2->FR&0x0008);

}

portEXIT_CRITICAL();

i also tried:

while (UART_GetFlagStatus(UART2, UART_FLAG_Busy)==RESET);

UART_ClearFlag(UART2);

and even tried using xSemaphoreHandle in the UART2_IRQHandler upon any TXed byte but that did not work.

any ideas?

Thanks in advanced.

Avner.

avnera
Associate II
Posted on May 17, 2011 at 09:57

i'm in the process of implementing the loop-back method mentioned by paul smitton and verified by Mark.

one important issue about this - you must disable the FIFO otherwise you will get the ''incoming'' bytes in delay.

any comments?