DMA access using SCI.UART in RA4M1 series controller.

Hi All,

 

I am trying to use DMA with UART in RA4M1 series controller, in a custom board. FSP v1.1.0.

I got few questions...

1. Can we use DMA along with SCI.UART?

I have tried to transfer a set of characters, likewise "Hello" through DMA.

I have assigned SCI9.TDR address as destination address for DMA.

Mode : Normal

Transfer Size : 1

Number of Transfers : 5

I have used a callback, to indicate end of DMA transfer. But I didn't get any callback in here.

Then i've tried transfering only one character. 

Mode : Normal

Transfer Size : 1

Number of Transfers : 1.

This time callback is generated.

What's happening in here? Why no DMA callback in case of 5 transfer and why at one transfer? 

I havent found any success while using other modes of DMA.

Bottom line : can we use DMA with uart in RA4M1 series controller? 

Parents
  • Hello viswa,

    EK_RA6M2_SCI_DMAC.zip

    Please find attached a project that shows how to use the DMAC with UART.  (FSP1.3.0, e2studio 2020-07)

     

    Please note that this is written and tested for a RA6M2 device as I do not have immediate access to a RA4M1.  However, you will be able to port this over.

     

    As Warren mentioned in an earlier post, the DMA is not directly supported when you add a UART stack; on the DTC is.

    However, it is possible by adding additional DMAC transfer drivers.

    In this example I use the DMA to perform data transmission and reception

    Configure the DMA transfer drivers are required, for example:

    When you run the code, the data string "Test Data String" will be transmitted twice.  The first time is via the CPU and interrupts, the second time is via the DMAC and interrupts.

    The key to getting the DMA to trigger is to disable the interrupts in the ICU interrupt enable register.  If you do not do this then their is contention between the CPU and the DMA, and you do not get the behviour you expect.

    I hope the code and comments in hal_entry.c explain this.

    Regards, Richard

  • hal_entry.zip Thanks for the help Richard. It worked for me. But i couldn't controll the flow. The last Dma request I place will overwrite the previous request. If I put a breakpoint between those requests then I can see the Whole transmitted message.

    I have these problems,

    1. After using these lines, DMA starts working but how to get UART back in control.

      " R_ICU->IELSR[SCI0_RXI_IRQn] = 0U;

        R_ICU->IELSR[SCI0_TXI_IRQn] = 0U; "

    2. How to ensure all data is transfered without using fifo.

    3.Datasheet mentions to clear IR flag, instead we are clearing all the IELSR register, why?

    4."  When using DMAC or DTC, be sure to write transmit data to TDR or TDRHL in the SCIn_TXI interrupt request handling routine. "its mentioned in datasheet. SCIn_TXI ISR routine is one time operation isnt it? Just before DMA takes over?. Please find the code attached .

     

Reply
  • hal_entry.zip Thanks for the help Richard. It worked for me. But i couldn't controll the flow. The last Dma request I place will overwrite the previous request. If I put a breakpoint between those requests then I can see the Whole transmitted message.

    I have these problems,

    1. After using these lines, DMA starts working but how to get UART back in control.

      " R_ICU->IELSR[SCI0_RXI_IRQn] = 0U;

        R_ICU->IELSR[SCI0_TXI_IRQn] = 0U; "

    2. How to ensure all data is transfered without using fifo.

    3.Datasheet mentions to clear IR flag, instead we are clearing all the IELSR register, why?

    4."  When using DMAC or DTC, be sure to write transmit data to TDR or TDRHL in the SCIn_TXI interrupt request handling routine. "its mentioned in datasheet. SCIn_TXI ISR routine is one time operation isnt it? Just before DMA takes over?. Please find the code attached .

     

Children