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.

RM44L520: Use DMA from task/unprivileged function

Part Number: RM44L520
Other Parts Discussed in Thread: HALCOGEN

Hi all!

I'm trying to make use of the DMA to optimize the transmission of log messages. I've setup the application using HALCoGen RM44L520_FreeRTOS, enabled the MPU and configured the SCI to send blocks of data via interrupt. That all works file. Then I tried to send the data via DMA but got stuck in triggering the DMA from an unprivileged task and seeking for advice how you have done that. This is what I've observed so far:

  • In the default setup the system region (0xfff80000 - 0xffffffff) is configured as USER_RO_NOEXEC. So the MPU won't let any task write to dmaREG.
  • The TRM says that the hardware channel enable bit is automatically reset at the end of a block transfer.
  • I've configured the control packet to element count = 1 and frame count = length of message to transfer a single byte from RAM to sciREG->TD per DMA request
  • I've configured the block transfer complete interrupt to release the hardware and wont to allow other tasks to send more messages.
  • In order to do that, I have to set the hardware channel enable bit again. This is not allowed as its part of the system region, which is USER_RO_NOEXEC. I've tried to change the MPU to allow the write, but did not succeed, as the TRM says that this bits can only be written in privileged mode.

Do you have any hints for me how to use the DMA from unprivileged tasks?

Jan

  • Hi Jan,

    The DMA registers and its local RAM can only be accessed in privilege mode. 

    The DMA memory has a protection mechanism. The DMA memory regions can be configured to be fully accessible, read only, write only, or no accessible. Please take a look at the DMA memory protection control register. By default, the regions are not defined.

  • Hi QJ Wang!

    Many thanks for your response.

    I've implemented the DMA configuration from unprivileged tasks now by using the mechanism from mpu_warpper.c: there prvRaisePriviledge() is used to execute kernel functions followed by portRESET_PRIVILEDGE() to go back to previous state.

    That works well without modifying the MPU setup.

    The DMA memory has a protection mechanism.

    IIRC thats for protection where the DMA is allowed to read from or write to.