Is it possible to configure the UART on the TM4C123GH6PM controller to trigger interrupts whenever the transmit buffer is empty/ready to send? I need this for the Free MODBUS application.
Many thanks,
Ksawery
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Is it possible to configure the UART on the TM4C123GH6PM controller to trigger interrupts whenever the transmit buffer is empty/ready to send? I need this for the Free MODBUS application.
Many thanks,
Ksawery
Hi,
You can disable the UART FIFO to accomplish what you want by calling UARTFIFODisable(). Please give a try.
Hi,
Thanks for your reply. I tried using UARTFIFODisable(), however the UART transmit ISR does not trigger by itself when it is already empty - only when a character is transmitted and it becomes empty again.
In the FreeMODBUS application, they periodically enable and disable the UART transmit interrupts, and expect the interrupts to trigger continuously when the transmit buffer is empty - until the interrupts are disabled again.
Regards,
Ksawery
Hi Ksawery,
You will need to create a dummy write that kicks start the operation before the ISR can be generated.
That's what I assumed, but I would want to avoid sending the dummy data over the serial line. Is there a way to do an initial write, without actually sending the data?
Once you perform the write, the transmission will start on the bus. Perhaps let's not call it a "dummy" write but rather a real write. In you main() you kick off the first "real" write that will start the transmission and generate the interrupt. The subsequent writes you can perform in the ISR if you want.
That's my problem though. The UART interrupts are enabled somewhere in the FreeMODBUS application code, when the application is ready to start transmitting data. Then the actual transmission is initiated from the UART ISR, when it is triggered due to an empty transmit buffer - so the transmission is never initiated in the FreeMODBUS application layer. Since the library gets a little complicated, i'm hesitant to modify it in any way.
My current solution is to set a flag when the application layer wants to start transmitting. If the flag is set, I continuously poll the UART using the UARTBusy() function to check if the transmit buffer is free. I then call the relevant application code from the main loop instead of the ISR. So I guess this might be one way around the problem, but I'm not yet sure how it might affect the application itself - I still need to test the implementation with a Windows-side MODBUS Master.
Regards,
Ksawery
ok, I think your workaround should work. The bottom line is that an interrupt is not generated until there is a write to the transmitter.