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.

DMA UART on CC3200 - Int keeps firing

Other Parts Discussed in Thread: CC3200

Hi,

I was playing with the uart dma example of CC3200 SDK. I wanted a DMA based UART receive so I thought that is a good place to start. I commented some parts of the example code, which you can find below. 

I wanted to configure a DMA RX and didn't want to wait until RX complete. So, I commented while check for bRxDone in the main. If I run this code. as expected, 8 characters from the uart are stored into the ucTextBuff. After that, If I press a key, the program goes to UARTIntHandler and keeps on triggering although I clear the UART interrupts in the handler. I cannot workout why is that happening. Please note that I'm not disabling the UART DMA s as in the example. 

Can someone please explain why the interrupt is keep on triggering after 9th keypress?

Thanks in advance..

Cheers,

Sam

static void UARTIntHandler()
{
    //
    // Check if RX
    //
    if(!bRxDone)
    {	
	//
	// Disable UART RX DMA
	//
    //   MAP_UARTDMADisable(UARTA0_BASE,UART_DMA_RX);

	//
	// Siganl RX done
	//
    //    bRxDone = true;
    }
    else
    {
	//
	// Disable UART TX DMA
	//
        MAP_UARTDMADisable(UARTA0_BASE,UART_DMA_TX);
    }

    //
    // Clear the UART Interrupt
    //
    MAP_UARTIntClear(UARTA0_BASE,UART_INT_DMATX|UART_INT_DMARX);
}

//*****************************************************************************
//
//! Main function handling the UART and DMA configuration. It takes 8 
//! characters from terminal without displaying them. The string of 8 
//! caracters will be printed on the terminal as soon as 8th character is
//! typed in.
//!
//! \param  None
//!
//! \return None
//!
//*****************************************************************************
void main()
{
    //
    // Initailizing the board
    //
    BoardInit();

    //
    // Initialize the RX done flash
    //
    bRxDone = false;

    //
    // Initialize uDMA
    //
    UDMAInit();

    //
    // Muxing for Enabling UART_TX and UART_RX.
    //
    PinMuxConfig();

    //
    // Register interrupt handler for UART
    //
    MAP_UARTIntRegister(UARTA0_BASE,UARTIntHandler);

    //
    // Enable DMA done interrupts for uart
    //
    MAP_UARTIntEnable(UARTA0_BASE,UART_INT_DMARX);

    //
    // Initialising the Terminal.
    //
    MAP_UARTConfigSetExpClk(CONSOLE,MAP_PRCMPeripheralClockGet(CONSOLE_PERIPH),
                            UART_BAUD_RATE,
                            (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
                            UART_CONFIG_PAR_NONE));
    //
    // Clear terminal
    //
    ClearTerm();

    //
    // Display Banner
    //
    DisplayBanner(APP_NAME);


    Message("\t\t****************************************************\n\r");
    Message("\t\t  Type in a string of 8 characters, the characters  \n\r");
    Message("\t\t  will not be displayed on the terminal until \n\r");
    Message("\t\t  8th character is entered.\n\r") ;
    Message("\t\t****************************************************\n\r");
    Message("\n\n\n\r");

    //
    // Set the message
    //
    Message("Type in 8 characters:");

    //
    // Configure the UART Tx and Rx FIFO level to 1/8 i.e 2 characters
    //
    UARTFIFOLevelSet(UARTA0_BASE,UART_FIFO_TX1_8,UART_FIFO_RX1_8);

    //
    // Setup DMA transfer for UART A0
    //
    UDMASetupTransfer(UDMA_CH8_UARTA0_RX,
                      UDMA_MODE_BASIC,
                      8,
                      UDMA_SIZE_8,
                      UDMA_ARB_2,
                      (void *)(UARTA0_BASE+UART_O_DR),
                      UDMA_SRC_INC_NONE,
                      (void *)ucTextBuff,
                      UDMA_DST_INC_8);

    //
    // Enable Rx DMA request from UART
    //
    MAP_UARTDMAEnable(UARTA0_BASE,UART_DMA_RX);

    //
    // Wait for RX to complete
    //
//    while(!bRxDone)
//    {

//    }

    //
    // Setup DMA transfer for UART A0
    //
   // UDMASetupTransfer(UDMA_CH9_UARTA0_TX,
   //                   UDMA_MODE_BASIC,
   //                   8,
    //                  UDMA_SIZE_8,
   //                   UDMA_ARB_2,
   //                   (void *)ucTextBuff,
   //                   UDMA_SRC_INC_8,
    //                  (void *)(UARTA0_BASE+UART_O_DR),
    //                  UDMA_DST_INC_NONE);

    //
    // Enable TX DMA request
    //
    //MAP_UARTDMAEnable(UARTA0_BASE,UART_DMA_TX);

    while(1)
    {
      //
      // Inifite loop
      //
    }
}

  • It seems, like the NVIC interrupt is still pending. You can try the following -
    a) In your UART interrupt handler 'UARTIntHandler', in the very beginning (first thing to do), clear UART interrupt source i.e MAP_UARTIntClear(UARTA0_BASE,UART_INT_DMATX|UART_INT_DMARX);
    b) At the end of the service routine, insert 'MAP_IntPendClear(INT_UART0); // this should clear any pending interrupt on this NVIC line.

    Thanks
  • Thanks for your reply. I will try that and post here.