AnsweredAssumed Answered

RS 485 bus - 4 wires

Question asked by Ion Popescu on Mar 29, 2011
Latest reply on Mar 29, 2011 by RICK BOURGEOIS



I am trying to implement a 4 wires RS 485 bus using MCF52259 and MQX. Theoretically, I have the RxEnable and TxEnable lines to GPIO ports and Tx - Rx data to uart2 port.

So, by default RxEnable and TxEnable are  0 which means Rx mode available. And when I want to transmit I must set the RxEnable to 1 and TxEnable to 1.

The problem is that I cannot manage to enable the TxEnable only when data is transmitted on Tx. Take a look on the attached file.I am not sure how to do it, using interrupts or time delays

Also, I copy paste part of my code, maybe someone has an idea :




[....]while(fstatus(uart0_ptr)) // read from uart0 - terminal window  {     read(uart0_ptr, (char_ptr)req + nBytes,1);     SetEnable(); // set TxEnable and RxEnable               write(uart2_ptr,(char_ptr)req + nBytes,1);              nBytes++;                        }     nBytes =0;           _time_delay(100);         ResetEnable(); // reset TxEnable , Rx Enable     [....]      


Thank you