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.
it doesn't receive the wrong data, it just stops sending a big portion of it. I tried to use the UDRE interrupt as you suggested, but it made me wait too much time for transmission as it only triggers once when I send a long string from a terminal. That's why I switched to TX interrupt. About enabling and disabling interrupts, I'm trying to make a UART that doesn't stop sending or receiving, so I have put flags for the main loop to do the processing elsewhere. Those flags coordinate the interrupts so that TX always comes after RX. I think the data that isn't sent has trouble getting into the linked list of one of the buffers before it has to be sent, so the missing portion is freed before reaching TX... that shouldn't happen because the data is passed from RX buffer to TX buffer and THEN the RX buffer is freed and the TX interrupt triggers.
Обсуждают сегодня