Hello,
I have a C6748 LCDK board and I'm using a modified uartEcho program from C6748_StarterWare_1_20_03_03.
When the board starts up, it's programmed to send out a "hello world\n\r" on UART2. At first, I would pause the program, reset the CPU, and then run again, and I would get another "hello world".
I set up a timer (~1 second) to reset the "length" variable and re-enable the UART_TX interrupt. The program will start, and send out one hello world, and one or two garbled messages, then it stops. The timer is still running.
To add to the weirdness, I pause the debugger to check the UART registers, and my TX buffer is empty, the THR is free, there are no errors, and the TX_EMPTY interrupt is enabled, but I'm not generating a UART interrupt.
At this point, I reset the CPU, reload the program and the UART is completely silent. No amount of reloading the program or resetting the CPU will get the UART interrupt to work again. The thing that works is to disconnect the debugger, cycle the power on the board, and reconnect.
Any suggestions?
//// UART ISR TX segment.
void UARTIsr(void)
{
static unsigned int count = 0;
unsigned char rxData = 0;
unsigned int int_id = 0;
/* This determines the cause of UART2 interrupt.*/
int_id = UARTIntStatus(SOC_UART_2_REGS);
// Clear UART2 system interrupt in DSPINTC
IntEventClear(SYS_INT_UART2_INT);
/* Checked if the cause is transmitter empty condition.*/
if(UART_INTID_TX_EMPTY == int_id)
{
if(0 < length)
{
/* Write a byte into the THR if THR is free. */
UARTCharPutNonBlocking(SOC_UART_2_REGS, txArray[count]);
length--;
count++;
}
if(0 == length)
{
/* Disable the Transmitter interrupt in UART.*/
UARTIntDisable(SOC_UART_2_REGS, UART_INT_TX_EMPTY);
}
}
///re-enabling the UART interrupts
if(TMR2flag) //timer interupt flag
{
TMR2flag = 0;
ToggleLED7();
length = sizeof(txArray);
UARTIntEnable(SOC_UART_2_REGS, UART_INT_TX_EMPTY);
}