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.

PGA900: PGA900 Uart Rx Interrupt Entry Impossibility

Part Number: PGA900
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.

  • Hi Eunho Nam,

    This a holiday week in the US, we will respond to you next week. Thanks for your patience

    -Bryan

  • Hi Eunho Nam,

    You are starting to change the example code so now it is going to be very hard for me to help you troubleshoot.  We are only able to give limited support as to code development.  I can appreciate that you want to reduce and simplify code, but in doing so you have changed the interrupt and have enabled all of the NVIC_ENABLE0.  At this point I would suggest going back to the the base example code and making incremental changes until the code responds in the way you desire.  Then once working in the original code, port the changes to your firmware development piece by piece.

    I would highly recommend limiting the actions of attempting an unknown interrupt by returning NVIC_ENABLE0 = 0x02 and then use UART_RX_INT_ENABLE() instead.  I would also recommend placing the function UART_ENABLE before the call to UART_RX_INT_ENABLE.

    All of that said, if your routine is working up until you TX to the UART, then most likely the issue is related to startup_ccs.c.  For the example program, the code is looking for UART_TESTING == 1 to set the call name to the interrupt routine otherwise it will go to the  IntDefaultHandler() instead.  As you have revamped the code to some degree, if you are using the original startup file but removed the configuration settings file, then you will be using the default handler instead of the desired handler.

    Best regards,

    Bob B