Hi,
maybe someone can help me see, what I am doing wrong or where I am missing something.
I want to do a UART communication based on interrupts. I have verified that the communication line to the pc is establishe by manually sending Bytes from the MCU to the PC via the function UARTCharPut and that worked so far.
Now I want to receive a Byte from the PC and handle it in the Interrupt. I'm doing this via a simple terminal program. I also can see the char in the UART_DR Buffer with no errors displayed in the same register. I did this while letting the debugger run and had a breakpoint in the RXTX_Interrupt Handler. The problem is: This interrupt did not fire.
(The UART_IM_RXIM was set in the UART_IM Register with no other Interrupts masked). The condensed code of my example is posted below. A few lines are redundand and it will be cleaned up after I get the UART Interrupt working. The UART0_RXTXHandler is registered in the startup_ccs. I am using CCS 5.2, lm4f232 on the eval board.
void main (void)
{
SysCtlClockSet(
SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ
| SYSCTL_OSC_MAIN);
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
GPIOPinConfigure(GPIO_PA0_U0RX);
GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0); // Enable port PA0 for UART0 U0RX
GPIOPinConfigure(GPIO_PA1_U0TX);
GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_1); // Enable port PA1 for UART0 U0TX
const uint16_t u_def_Baud = 9600; //Select BBaud Rate here
UARTDisable(UART0_BASE); //disable for configuration
UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), u_def_Baud,
(UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE));
UARTFlowControlSet(UART0_BASE, UART_FLOWCONTROL_NONE);
UARTFIFODisable(UART0_BASE);
UARTIntClear(UART0_BASE, UART_INT_RX);
UARTIntClear(UART0_BASE, UART_INT_TX);
IntEnable(UART_INT_RX);
IntEnable(UART_INT_TX);
IntMasterEnable(); //enable Interrupts
UART0_TX_Start();
UARTCharPut(UART0_BASE, 0x4a);
while (UARTBusy(UART0_BASE));
UART0_RX_Start();
while(1);
}
void UART0_RX_Start(void)
{
UARTDisable(UART0_BASE);
UARTIntClear(UART0_BASE, UART_INT_TX);
UARTIntDisable(UART0_BASE, UART_INT_TX);
UARTIntEnable(UART0_BASE, UART_INT_RX);
UARTEnable(UART0_BASE);
}
void UART0_TX_Start(void)
{
UARTDisable(UART0_BASE);
UARTIntClear(UART0_BASE, UART_INT_RX);
UARTIntDisable(UART0_BASE, UART_INT_RX);
UARTIntEnable(UART0_BASE, UART_INT_TX);
UARTEnable(UART0_BASE);
}
void UART0_RXTXHandler(void)
{
uint8_t ub_RXReady = 0;
uint8_t ub_TXReady = 0;
ub_RXReady = UARTCharsAvail(UART0_BASE);
ub_TXReady = UARTBusy(UART0_BASE);
UARTIntClear(UART0_BASE, UART_INT_RX);
UARTIntClear(UART0_BASE, UART_INT_TX);
if (ub_RXReady == TRUE) //We have received something
{
USART_RX_Telegramm_Standard();
}
else if (ub_TXReady == TRUE) //Transmit Buffer is empty.
{
USART_TX_Telegramm_Standard();
}
else //keins von beiden??
{
}
}
* added the line for FIFO Disabling, but still no change