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? 

  • Hi Viswa-

    When adding the SCI_UART to the stack in FSP I get the following:

    This shows that the DTC is available, but not the DMAC. Note that the use of the DTC isn't recommended.


    Looking in the FSP User's Manual for the SCI_UART module we find the following:

    No mention of the DMAC, so I wouldn't expect it to available as part of FSP.

    The UART example project here: might help you get the UART working on your board.

    Let us know if you have additional questions.


  • Hello viswa,

    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

  • 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 .


  • Hi,


    Please look at the attached project.

    When the DMAC has finished writing data to the TDR, the DMAC end interrupt will trigger.

    I use this interrupt to enable the TEIE (transmit end interrupt)

    This interrupt will trigger when data transmission has completed and the TSR is empty.

    At this point, the SCI UART callback is called.

    In this callback I set a flag.

    At this point I reconfigure the DMAC and send more data.

    With this config, in my tests, there is no data corruption

    Please try this



  • Hi,


    Please find attached an update.

    This project will address the issue of not being able to switch between using the DMAC and CPU.

    You will see in the while(1) loop, the application will send 10 continuous data strings (on SCI0) via DMAC and then via the CPU.

    This process is repeated every time you press the SW1 button on the EK-RA4M1 board

    You will see that when a switch between DMAC and CPU is required (and vice-versa) we have to set / clear the IELSR (ICU Event Link Setting Register) and DELSR (DMAC Event Link Setting Register) accordingly

    Hope this helps



  • Thanks Richard. you are of great help for me.