• TI Thinks Resolved

CC1312R: Can't Trigger UART0 Interrupt Handler

Prodigy 70 points

Replies: 4

Views: 75

Part Number: CC1312R

I am trying to get the UART0 interrupt to trigger on my device with nortos. I am trying to configure it to trigger on RX and RT and my code is as follows.

    // Enable the UART peripheral
    PRCMPeripheralRunEnable(PRCM_PERIPH_UART0);
    PRCMPeripheralSleepEnable(PRCM_PERIPH_UART0);
    PRCMPeripheralDeepSleepEnable(PRCM_PERIPH_UART0);
    PRCMLoadSet();
    while (!PRCMLoadGet());
    
    // Enable UART pins for Rx\Tx
    IOCPinTypeUart(UART0_BASE, IOID_19, IOID_18, IOID_UNUSED, IOID_UNUSED);

In another function I do the following.

//Disable UART before changing configuration
    UARTDisable(UART0_BASE);
    
    // Set the configuration of the UART.
    //  Clock rate 48 MHz
    //  8 Data bits per byte
    //  1 Stop Bits
    //  0 Parity
    UARTConfigSetExpClk(UART0_BASE, GET_MCU_CLOCK, 115200, UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE);
    
    // Enables the transmit and receive FIFOs.
    UARTFIFOEnable(UART0_BASE);
    
    // Disable hardware flow control for both CTS and RTS
    UARTHwFlowControlDisable(UART0_BASE);
    
    // Set interrupt levels for TX FIFO and RX FIFO
    UARTFIFOLevelSet(UART0_BASE, UART_FIFO_TX1_8, UART_FIFO_RX1_8);	
    
    // Enables the interrupt for UART0 for RX
    UARTIntEnable(UART0_BASE, UART_INT_RT | UART_INT_RX);
    
    // Registers the INTRX_DEBUG_IRQHandler function to be called after interrupt
    UARTIntRegister(UART0_BASE, INTRX_DEBUG_IRQHandler);
    
    // Enable the UART
    UARTEnable(UART0_BASE);

    IntMasterEnable();

So the RX and TX of the UART work correctly and I am able to communicate through it, but the interrupt handler INTRX_DEBUG_IRQHandler never triggers. I tried calling IntPendGet(INT_UART0_COMB) and it returns true. 

  • Hi Edward,

    Is there a reason you're using driverlib instead of TI Drivers? 

    With TI Drivers you could  use UART_MODE_CALLBACK and it will trigger interrupt on UART TX and RX. You will find some example in SDK docs: file:///C:/ti/simplelink_cc2640r2_sdk_1_40_00_45/docs/tidrivers/doxygen/html/_u_a_r_t_c_c26_x_x_8h.html

    Thanks,

    Alexis

  • In reply to Alexis Crandall20:

    We have a base application that we are using for different processors and want to make minimal changes to it across the different  designs. We want to be able to control registers an such directly through the code as well and thus have chosen to go with driverlib rather than the TI drivers. 

    Is there some method or call that I am missing in order to set up the interrupt? This issue is not specific to UARTs. I can't seem to be able to set up any interrupts such as GPIO.

  • In reply to Edward Lee4:

    I can see that when I send data over the UART, the UART0_COMB flag in NVIC_ISPR0.SETPEND5 is set. I am not sure why this is never addressed by the CPU.I have tried to see if something else is blocking the interrupt from being called, but I have not made much progress in that regard.

    I have also noticed that interrupt 26 is raised. The FLASH controller error event. I'm assuming that this is the reason the interrupts are never triggered. But I am unsure as to how to fix this issue.

  • In reply to Edward Lee4:

    Hi Edward,

    I believe this issue is already receiving support on another thread posted by the FAE: https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz/f/156/t/854840. I'll go ahead and close this one and continue support on the other thread as to avoid duplicates.

    Thanks,

    Alexis