RS485 half duplex K64

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

RS485 half duplex K64

Jump to solution
689 Views
roymessinger
Contributor V

I'm using a transciever to receive/transmit the data and I've set the RTS registers of the chip correctly. 

I'm getting a strange phenomenon in which the data from the tx buffer seems to get back to the rx buffer, even though I'm waiting for the last transmission:

void send_message_in_uart(unsigned char *query, unsigned char string_length)
{
while ((kUART_TxDataRegEmptyFlag & UART_GetStatusFlags(UART_CH_ACTIVE)))
       UART_WriteBlocking(UART_CH_ACTIVE, query, string_length);

while (!(UART1->S1 & UART_S1_TC_MASK))
    __asm("NOP");
}

I'm getting an endless loops of transmission, which endlessly toggles the RTS line. I think it is because the data from the tx goes back to the rx. In the FRDM board I did not have such behaviour (but I think I've used a transciever which is not half duplex, and definately did not have RTS flow). It could be the data is passed tx->rx on the transciever side, even though the transmission has ended on the CPU side...

I've tried inserting the second 'while' to the first one, but didn't help.

Any ideas?

Roy

0 Kudos
1 Solution
510 Views
mjbcswitzerland
Specialist V

Roy

Why does your circuit have R182 not places and keeps the RX enabled with R188. Like this you are receiving what you send but if you swap the resistors around the transceiver will operate as a typical simplex circuit which may already solve your problems.

Regards

Mark

View solution in original post

0 Kudos
2 Replies
511 Views
mjbcswitzerland
Specialist V

Roy

Why does your circuit have R182 not places and keeps the RX enabled with R188. Like this you are receiving what you send but if you swap the resistors around the transceiver will operate as a typical simplex circuit which may already solve your problems.

Regards

Mark

0 Kudos
510 Views
roymessinger
Contributor V

Indeed, Mark. You were right. Once I swapped the resistors (in a typical rs485 half duplex comm.) it all went fine and all is working.

Thank you very much.

0 Kudos