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.

cc2541 uart isr

Other Parts Discussed in Thread: CC2541

cc2541 , uart1

I have done my uart init in this way but not get any interrupt

void uart_init(void)
{
 
    // Enable UART on channel 1 alternate 1, 115200,8/N/1 w/o flow control
    URX1IE = 1;         // enable receive interrupt on UART1
    // UART pins on p0.2, p0.3, p0.4, p0.5 (CTS/RTS/TXD/RXD respectively)
    
    P0SEL |=  BIT(2) | BIT(3) | BIT(4) | BIT(5);          //BIT(2) | BIT(3) |
    P2DIR |= BIT(6);    // UART1 has priority in Port0
    U1BAUD = BAUD_M;    // baud mantissa
    U1GCR = BAUD_E;     // baud exponent
    //U1UCR = BIT(1);     // stop bit state is high, and flow is disabled (set BIT(6) to enable)
    U1UCR = 0x82;
    U1CSR = BIT(7) | BIT(6);    // set USART mode to UART, and enable
   EA = 1;  

#pragma vector=URX1_VECTOR
__interrupt void uart1_rx_isr(void)
{

}

  • Hi Amit,
    You also have to enable the specific UART interrupts in the CPU (IENx). Please see chapter 17.6 of the User Guide. Generally, I would recommend using the hal_uart module that comes with the BLE stack installer.

    Peder