RS485 half duplex K64

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

RS485 half duplex K64

跳至解决方案
1,340 次查看
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 项奖励
回复
1 解答
1,161 次查看
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 项奖励
回复
2 回复数
1,162 次查看
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 项奖励
回复
1,161 次查看
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 项奖励
回复