Skip to main content
Visitor II
June 7, 2023
Solved

Facing issue in read ADC with GPDMA in STM32U585ZIT6Qwith trust zone option enabled

  • June 7, 2023
  • 14 replies
  • 12954 views

Hi;

I am using STM32U585ZIT6Q controller in my current project. I am enabled Trust Zone option.

I have configured ADC 1 (4 channel) in non secure with GPDMA.I am not able to read ADC data. I have attached all configuration. I have used HCLK(160MHz) for ADC.

if i got working example then it will more helpful.

Please help me for same.

    This topic has been closed for replies.
    Best answer by RomainR.

    Here attached my previous project with ADC1 in non secure context (NS) and in 12bit resolution.

    I also added ADC1 channel computation en mV for VREFINT, VBAT and Degree Celsius for TempSensor.

    I do not implemented ADC4, it's up to you for its implementation where you want.


    _legacyfs_online_stmicro_images_0693W00000dDcOSQA0.pngAs explained before, I just changed ADC1 secure context as following.


    _legacyfs_online_stmicro_images_0693W00000dDcQnQAK.png

    • Regenerated the projet
    • Move ADC1 user code and callback from \secure\main.c to \Nonsecure\main.c

    Good luck.

    Romain,

    14 replies

    ST Employee
    June 12, 2023

    Hello JShah.7 (Community Member)

    Change the Runtime context of your ADC1 in the STM32CubeMX configuration from M33S to M33NS.


    _legacyfs_online_stmicro_images_0693W00000dDa62QAC.pngThen apply same ADC1 and GPDMA1 Parameters setting than my .ioc example, except for GPDMA1 Security, you need to configure a new Channel in Non Secure/Non Priviledged.

    Then configure NVIC _NS to generate new GPDMA channel and ADC1 global interrupt.

    Check also Security GTZC_S and GTZC_NS, ADC1 should be configured in Non secure mode.

    Regards,

    romain,

    RomainR.Answer
    ST Employee
    June 12, 2023

    Here attached my previous project with ADC1 in non secure context (NS) and in 12bit resolution.

    I also added ADC1 channel computation en mV for VREFINT, VBAT and Degree Celsius for TempSensor.

    I do not implemented ADC4, it's up to you for its implementation where you want.


    _legacyfs_online_stmicro_images_0693W00000dDcOSQA0.pngAs explained before, I just changed ADC1 secure context as following.


    _legacyfs_online_stmicro_images_0693W00000dDcQnQAK.png

    • Regenerated the projet
    • Move ADC1 user code and callback from \secure\main.c to \Nonsecure\main.c

    Good luck.

    Romain,

    Visitor II
    July 25, 2024

    Hello I have a similar issue .

    does this mean that we cant use ADC1 on the secure side of the code?

    JShah.7Author
    Visitor II
    June 13, 2023

    Hi @RomainR.​ 

    Thanks for support. Code is working fine.