Other Parts Discussed in Thread: TIDA-00851,
hello
I am coding firmware using the TIDA-00851 board.
I am contacting you because I have a problem with UART communication.
The version of CCS is 12.1.0.00007.
And the TIDA-00851 board and XDS200 are connected and used.
Data is transmitted normally via Tx.
I am trying to receive data through Rx interrupt, but it does not enter the interrupt function.
Here is the code I wrote:
void main(void)
{
M0_ConfigClock(CLK_4MHZ);
Interrupt_Reset_Init();
DAC_Reset_Init();
/* UART uses the SPI interface MOSI and MIS0 pins */
/* Configure 19200 baud rate, 8Data bits, None Parity,1 stop bit */
Uart_Init(0x00, 12);
DAC_Config(DAC_ENABLE, DAC_RATIOMETRIC_MODE_DISABLE, B_4_20MA_EN | DACCAP_EN);
AMUX_CONFIG(TSEM_N | TEST_MUX_P_EN | TEST_MUX_T_EN | TEST_MUX_DAC_EN);
DAC_REG0 = 0x2300;
while(1)
{
ResponseUART();
DAC_REG0 = 0x2300;
put_s("TxTest\r\n");
delay(1000000);
}
}
void put_c(char ch)
{
while(!(UART_LINE_STATUS & TX_COMPLETE)); // Wait till TX Buffer is empty
UART_TX_BUF = ch;
}
void put_s(char *str)
{
while (*str != '\0')
{
put_c(*str++);
}
}
void Uart_Init(unsigned char uconfigValue, unsigned char baudValue)
{
/* UART uses the SPI interface MOSI and MIS0 pins */
UART_PIN_MUX_SELECT();
/* data bits, parity and stop bit configuration */
UART_CONFIG = uconfigValue;
/*
* Baud rate formula -> Baud Rate Divider = ((1/(4*Baud Rate))*1000000))-1
*/
BAUD_RATE = baudValue;
UART_RX_INT_ENABLE();
UART_ENABLE();
}
void Interrupt_Reset_Init(void)
{
ADC_PCHANNEL_DISABLE();
ADC_TCHANNEL_DISABLE();
NVIC_UNPEND0 = 0xFFFFFFFF;
NVIC_PRI0 = 0x80400000;
NVIC_PRI1 = 0xC0C0C0C0;
//NVIC_ENABLE0 = 0x02;
NVIC_ENABLE0 = 0xFFFFFFFF;
}
interrupt void UART_Handler(void)
{
Temp_RX_Data = (UART_RX_BUF & 0xFF);
if((Uart_LP >= (UARTBUF_SIZE-1)) && (Uart_CP != 0))
{
Uart_LP = 0;
Wrap_Flag = 1;
UartRX[UARTBUF_SIZE-1] = toupper(Temp_RX_Data);
}
else if((Uart_LP >= (UARTBUF_SIZE-1)) && (Uart_CP == 0))
{
Uart_LP = UARTBUF_SIZE-1;
UartRX[Uart_LP] = toupper(Temp_RX_Data);
}
else if((Uart_LP + 1) == Uart_CP)
{
Uart_LP = Uart_LP;
UartRX[Uart_LP] = toupper(Temp_RX_Data);
}
else
{
UartRX[Uart_LP++] = toupper(Temp_RX_Data);
}
}
Temp_RX_Data = (UART_RX_BUF & 0xFF); inside interrupt void UART_Handler(void) function; Even if you set a breakpoint in this section, the function will not be entered.
When measured with a scope, data is being transmitted normally from the PGA900 through the Tx pin, and is also being received normally from the PC's serial software.
When the "A\r" command is sent from the serial software, it should be received normally by the PGA900 board and entered as an interrupt, but it does not enter.
Instead, it enters the static void IntDefaultHandler(void) function in the PGA900_startup_ccs.c file and cannot exit the infinite loop.
Please check if there is any code that needs to be modified.