Skip to main content
Vmere.1
Associate III
August 22, 2022
Solved

I have two devices. Need to setup UART communication?

  • August 22, 2022
  • 2 replies
  • 1386 views

I have two STM32 devices and both are identical, send and receive messages in frame formats. They both have UART, DMA, NVIC etc.

And I need a good strategy to setup a lossless communication between them. There is too much information online, but very little about which is good method. Also this project is configured with RTOS.

What I found online:

--> Interrupts is bad strategy.

--> DMA is the good one, DMA with circular buffer is also a good one.

--> byte format is not reliable, so use frame type.(identifier, address, data, crc)

can someone help me here? I'm actually overwhelmed by these concepts.

This topic has been closed for replies.
Best answer by Tesla DeLorean

Honestly seem to be over thinking ​this. A simple interrupt method should work to prove the method. Then implement DMA TX, if that improves efficiency.

D​oes the packet form provide for synchronization or integrity checking?

H​ave you reviewed protocols like SLIP and XMODEM? Or say packet methods used by sensors or GNSS receivers.

2 replies

Javier1
Principal
August 22, 2022

There is no info because your question is still too vage, you still need to make some arquitecture design decisions.

Some examples:

  • Which two devices specifically?
  • How far are they?
  • How fast does the communication need to be?(bytes per second)
  • What latency are you able to tolerate?(miliseconds? miroseconds?)
  • How realiable does this communication need to be?
  • How much RAM/Flash cold you spare for this?
  • How many tasks are you running, is your RTOS already pretty busy?
  • Do you want to integrate this protocol with an already existing tools/devices echosystem? (for example MAVLINK)
  • How experienced is the developer, how much time do you have?
hit me up in https://www.linkedin.com/in/javiermuñoz/
Vmere.1
Vmere.1Author
Associate III
August 22, 2022
  • Which two devices specifically?
    • STM32L431CC
  • How far are they?
    • less than 3cm.
  • How fast does the communication need to be?(bytes per second)
    • 9600bps
  • What latency are you able to tolerate?(miliseconds? miroseconds?)
    • microseconds
  • How realiable does this communication need to be?
    • Highly reliable. There shouldn't be any loss. (they communicate information, in 14 byte telegrams - send and receive)
  • How much RAM/Flash cold you spare for this?
    • I have 1MB of RAM, so quite a lot, but no specific number
  • How many tasks are you running, is your RTOS already pretty busy?
    • Two tasks are running. This communication task should be third one, and no its not busy.
  • Do you want to integrate this protocol with an already existing tools/devices echosystem? (for example MAVLINK)
    • Nope.
  • How experienced is the developer, how much time do you have?
    • I have 2 years, but I have 2 month of time. Can be extended upon asking.

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
August 23, 2022

Honestly seem to be over thinking ​this. A simple interrupt method should work to prove the method. Then implement DMA TX, if that improves efficiency.

D​oes the packet form provide for synchronization or integrity checking?

H​ave you reviewed protocols like SLIP and XMODEM? Or say packet methods used by sensors or GNSS receivers.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Vmere.1
Vmere.1Author
Associate III
August 23, 2022

True, but this implementation will be used for many things. I want to have some references where I can properly implement this module.

I don't know SLIP but I looked at XMODEM.