got this code for USART based on interrupts and it works fine except for sending very long strings, those get cut at some point
How cut? Do you receive wrong data or is nothing send at all after some time? Can you give more information? Did you try to use the interrupt that is triggered when the buffer is empty again? My approach when using UART is to enable the interrupts only for the time you are doing a transmission. and after sending the last byte, you can disable the interrupts again. Also, if your application tries to start a new transmission and sees that the interrupt is enabled it can wait until it is disabled again before starting the transmission. There are many ways to implement UART communication.
Обсуждают сегодня