Configuring XDMAC on the SAME70 with FREERTOS

Hello,

I would like configure the XDMAC on the SAME70, while using FreeRTOS. Does anyone have experience with this for tips and/or documention?

Can you elaborate on your question? I assume an XDMAC is a DMA. What issues are you anticipating? I’ve used DMA access to peripherals many times and the RTOS doesn’t really make any difference to how I do it.

We use SAME70 XDMAC and FreeRTOS. What do you want to know? We use the end-of-DMA interrupt to call TaskNotifyGiveFromISR and wake up the task that was waiting for DMA to complete.

@dc42 Well, when I use the XDMAC code on an seperate project, the program runs fine. But in combinatie with the FreeRTOS project, the program crashes at xdmac_channel_enable(). Do you know what could be the issue?

Does the program run if you don’t enable cache on the SAME70?

If it does, have you used the SAME70 MPU to generate a shared (non-cached) RAM area, and allocated all the DMA buffers in that area? We had to move a number of memory areas declared in third-party libraries (for example, the Microchip SD-MMC stack) into non-cached memory before we could safely enable the cache.

@dc42 Thank you for your quick response. No, unfortunately the program (with FreeRTOS) does not run when not defined CONF_BOARD_ENABLE_CACHE

If it’s any help, you can find our code in the following projects:

https://github.com/Duet3D/RepRapFirmware (main project, build configuration Duet3 uses the SAME70). We use the XDMAC for SPI send/receive in files src/Movement/StepperDrivers/TMC51xx.cpp and src/LinuxIntrace/DataTransfer.cpp

https://github.com/Duet3D/CoreNG (partial hardware abstraction layer). The Microchip-supplied HSMCI driver uses the XDMAC.

https://github.com/Duet3D/RRFLibraries (C++ interface to FreeRTOS, and other utility functions and classes)