This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

LIN bus - disable Rx while Tx'ing/Tx high while Rx'ing

I am working on a LIN slave.

I have working code on an Atmel 2560, just porting it to the NRF52 now. The complication I am foreseeing is that on the Atmel part I could disable Rx and Tx at will. It seem on the NRF that I have to disable the whole UART and then maybe drop the Rx or Tx pin from the configuration.

LIN bus requires to hold the Tx bus high while receiving. When transmitting, the Rx is seeing what is Tx'd - so I shut off Rx when I transmit.

Any help/thoughts?

Thanks! Tom

Parents
  • I have 95% completed the LIN slave. The master would be very similar except that instead of responding, it would have a list of messages to send periodically and a timeout timer.

    Here's essentially what I did: Timer - single bit time of LIN GPIOTE - for pin change UART - didn't use DMA - but I did use the FIFO functions (bug in the TX function BTW).

    Set the GPIOTE to send out high on TX all the time and look for a pin change on RX. When the pin changes, start the timer and keep the RX IRQ going. If the timer counts 10-12 bits before the pin change IRQ, then there is the header. Disable GPIOTE and timer Enable UART - TX seems to stay at state level. Read the bytes required. Turn off UART RX IRQ - ignoring RX'd bytes that I send (could be left on to be sure no other slave is talking) Send out TX data - wait for IRQ for completion (that's where the bug was). When TX complete - re-enable the GPIOTE again like at the start. Fully disable UART - only way to clear the FIFO's.

    Works well - fully IRQ driven

  • Tom,

    Thanks for the info on your implementation. I need to do exactly the same thing (LIN slave on nRF52). Do you have code that you can share, even if only part of it? I  would greatly appreciate it as it would save me a lot of time repeating exactly the same thing you did.

    Thanks,
    Chris

Reply Children
No Data
Related