1
\$\begingroup\$

I am trying to use UART3 of STM32F103K8 to rx data in interrupt mode and tx in DMA mode. Reception works well, but transmission has a bug: first portion of data is transmitted just fine and ISR is called. After that, huart.gState == HAL_UART_STATE_READY is never achieved and any subsequent transmission fails.

So, the questions are:

  1. Is it OK to use interrupt mode rx and DMA mode tx for single UART? Are there any examples?
  2. Given that all DMA channels have same preemption priority and are used havily and simultaniously, can it potentially result in data loss, IRQ conflicts or have other negative consequenses?
\$\endgroup\$
2
  • \$\begingroup\$ yes, i just think of tx nd x as independent to be honest but I do not use HAL. I roll my own. I do not trust HAL because you never really know what it is doing \$\endgroup\$
    – DKNguyen
    Commented Nov 26, 2019 at 14:23
  • \$\begingroup\$ Thanks. Yes, HAL is buggy and has a big overhead, but the project is based on that library. Still trying to figure out the cause, UART1 in same project has almost identical code but uses DMA for both rx and tx. \$\endgroup\$ Commented Nov 26, 2019 at 14:31

1 Answer 1

1
\$\begingroup\$

Finally, the project was refactored to use STM LL Drivers, and with this approach, allowing to receive variable-length packets with DMA, the problem was solved. Real cause of the problem is still unknown, most likely its a bug in the project code or possible in STM HAL library.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.