cancel
Showing results for 
Search instead for 
Did you mean: 

UART driver using interrupt

fss
Associate II
Posted on November 16, 2004 at 03:40

UART driver using interrupt

3 REPLIES 3
fss
Associate II
Posted on November 15, 2004 at 06:24

I am having problems writing an interrupt based UART driver for the ST71X.

With only RxBufFullIE interrupt enabld, receptions is fine, but all bytes transmitted are echo'ed back to the receive buffer even if the loop-back flag is not set.

When I enable TxEmptyIE. TxEmpty interrupts are geneated all the time.

If anybody have some suggestions or example code it will be much appreciated.

marcus23
Associate II
Posted on November 15, 2004 at 09:12

hey mrdata,

i had a similiar problem. try to configure the ports of the UART as followed:

#define UART0_RX_Pin 0x100

#define UART0_TX_Pin 0x200

GPIO_Config(GPIO0, UART0_TX_Pin , GPIO_AF_PP);

GPIO_Config(GPIO0, UART0_RX_Pin ,GPIO_IN_TRI_CMOS);

These settings are for UART0 as you see, just change it for the UART you are using. Important here is the ''GPIO_IN_TRI_CMOS'' !!!

That the TxEmpty interrupt is generated all the time is normal. If the TxBuffer register is empty, the interrupt won´t be reset. So you have to clear the TxEmpty interrupt enable bit until you have something to send again. I´m also working on an interrupt driven UART-driver. Without FIFOs everything is fine, but with FIFOs enabled it doesn´t seem to work as I would like it to do at the moment 😉

fss
Associate II
Posted on November 16, 2004 at 03:40

Thank you mweigelt.

Changing the I/O port configuration did the trick to get the receive routine working and thank you for the tip about TxEmpty.