2026-04-01 1:19 AM
I have an application that uses the OCTOSPI1 interface to read from and write to an external NOR flash memory into an SRAM1 buffer. The read and write operations are performed in the NS section of the application. If I perform a transfer without using DMA, it works. However, if I try to use GPDMA1, I get a buffer with all data set to 0, with no error.
Additional information: the application works very well with GPDMA1 if I disable the MCU’s TrustZone mode.
I conclude that GPDMA is not fully initialized to work with TrustZone enabled, but I can’t figure out what’s missing despite my searches on this forum.
Any help would be greatly appreciated.
Solved! Go to Solution.
2026-04-02 12:11 AM
Hello @Phil5,
priv means privileged here. This is a state of cortex-m.
Reason why you need to set this configuration is because the RAM was setup by default as non secure and privileged with GTZC. If DMA is non privileged it cannot access privileged area.
If you change RAM configuration with GTZC to unprivileged, it will also solve your issue as both sides will be unprivileged
Best regards
Jocelyn
2026-04-01 7:52 AM
I solved the problem by initializing the DMA channel in private mode:
if (HAL_DMA_ConfigChannelAttributes(&handle_GPDMA1_Channel12_,
DMA_CHANNEL_NSEC | DMA_CHANNEL_PRIV) != HAL_OK)
{
Error_Handler();
}
Why private mode?
2026-04-02 12:11 AM
Hello @Phil5,
priv means privileged here. This is a state of cortex-m.
Reason why you need to set this configuration is because the RAM was setup by default as non secure and privileged with GTZC. If DMA is non privileged it cannot access privileged area.
If you change RAM configuration with GTZC to unprivileged, it will also solve your issue as both sides will be unprivileged
Best regards
Jocelyn
2026-04-02 1:51 AM
Thank you, it works as expected now.