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.

我有一块C5515 EzDSP的开发板,想用DMA中断的方式接收Uart串口数据,不知道怎么配置



我有一块C5515 EzDSP的开发板,想用DMA中断的方式接收Uart串口数据,不知道怎么配置,如何配置串口,DMA,以及中断

  • 你好,

    到下面的网站下载C55XCSL-LOWPOWER,安装后,参考c55_lp\c55_csl_3.03\c55xx_csl\ccs_v5.0_examples\uart\CSL_UART_dmaExample中的例程。
    http://www.ti.com/tool/sprc133

  • 我找到这个例程了,但是这个例程是用while接收的,我想用中断接收,不知道怎么配置

  • 那你可以和另外一个中断例程CSL_UART_IntExample合并。

  • 你看看我这么配置可以吗?

     

    sysClk = getSysClk();
     mySetup.clkInput = sysClk;
     status = SYS_setEBSR(CSL_EBSR_FIELD_PPMODE,
                              CSL_EBSR_PPMODE_1);
     status = UART_init(&uartObj,CSL_UART_INST_0,UART_POLLED);
     status = SYS_setEBSR(CSL_EBSR_FIELD_PPMODE,
                              CSL_EBSR_PPMODE_1);
     hUart = (CSL_UartHandle)(&uartObj);
     status = UART_setup(hUart,&mySetup);
     RxConfig.pingPongMode = CSL_DMA_PING_PONG_DISABLE;
     RxConfig.autoMode = CSL_DMA_AUTORELOAD_DISABLE;
     RxConfig.burstLen = CSL_DMA_TXBURST_1WORD;
     RxConfig.trigger  = CSL_DMA_EVENT_TRIGGER;
     RxConfig.dmaEvt   = CSL_DMA_EVT_UART_RX;
     RxConfig.dmaInt   = CSL_DMA_INTERRUPT_ENABLE;
     RxConfig.chanDir  = CSL_DMA_READ;
     RxConfig.trfType  = CSL_DMA_TRANSFER_IO_MEMORY;
     RxConfig.dataLen  = CSL_UART_RDBUF_SIZE;
     RxConfig.srcAddr  = (Uint32)&(hUart->uartRegs->THR);
     RxConfig.destAddr = (Uint32)DMARxBuf;

     DMARxHandle = CSL_configDmaForUart(&DMARxChanObj, CSL_DMA_CHAN4);
     if(DMARxHandle == NULL)
     {
      printf("DMA Config for Uart Read Failed!\n!");

     }

    IRQ_globalDisable();
     IRQ_clearAll();
     IRQ_disableAll();
     IRQ_setVecs((Uint32)&VECSTART);
     IRQ_clear(DMA_EVENT);
     IRQ_plug (DMA_EVENT, &dma_isr);
     IRQ_enable(DMA_EVENT);
     IRQ_globalEnable();

     status = DMA_start(DMARxHandle);
     if(status != CSL_SOK)
     {
       printf("Uart Dma Read Failed!!\n");

     }
     status = UART_setup(hUart,&mySetup);

  • 你在板子上调试不通吗? 是中断没产生还是DMA没搬?

  • 中断没有产生

  • 我看到你的event ID是DMA_EVENT, 你是要用DMA中断,不是uart中断?