UART Transmit/Receive implementation for unidirectional driver

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

UART Transmit/Receive implementation for unidirectional driver

484 Views
rudycoppens
Contributor III

Hi all,

I am trying to make a RS485 connection with the use of a LTC2862A I use the "MKE14F512VLH16" The communication is working manually by setting one transceiver to transmit and the other to receive. It goes wrong when I try to switch from Receive to Transmit mode and back. The timing is never right and there comes no communication back on the bus. Here is an example code for, or has anyone an idea how to implement this. Now I implemented, set the slave device always to receive except when transmitting and the master the other way around. See the attached picture of the code. 

pastedImage_1.png

Labels (1)
1 Reply

323 Views
mjbcswitzerland
Specialist V

Hi Rudy

If you are switching the direction from transmitter to receiver you need to wait for the present transmission to terminate before doing so - to do this the TC flag (transmit complete) or its interrupt can be used.

See also chapter 11 of http://www.utasker.com/docs/MODBUS/uTasker_MODBUS.PDF for some details of how RS485 can be controlled without a direction signal.

Regards

Mark

Kinetis: http://www.utasker.com/kinetis.html
Kinetis KE:
- http://www.utasker.com/kinetis/FRDM-KE02Z.html
- http://www.utasker.com/kinetis/FRDM-KE02Z40M.html
- http://www.utasker.com/kinetis/FRDM-KE04Z.html
- http://www.utasker.com/kinetis/FRDM-KE06Z.html
- http://www.utasker.com/kinetis/FRDM-KE15Z.html
HW Timers: http://www.utasker.com/docs/uTasker/uTaskerHWTimers.PDF

Free Open Source solution: https://github.com/uTasker/uTasker-Kinetis
Working project in 15 minutes video: https://youtu.be/K8ScSgpgQ6M

For better, faster, cheaper product developments consider the uTasker developer's version, professional Kinetis support, one-on-one training and complete fast-track project solutions to set you apart from the herd : http://www.utasker.com/support.html