cancel
Showing results for 
Search instead for 
Did you mean: 

STM32N657X0-Q ADC+TIMER+DMA

Thomas_H
Associate

Hi, 
I would like to develop an application using ADC + TIMER + DMA. My base code doesn’t work, and I don’t understand why. 

To debug, I introduce the variable "toto". This value of this variable doesn't change. 

I use STM32CubeIDEv1.19.

Best regards

Thomas- H

3 REPLIES 3
RomainR.
ST Employee

Hello @Thomas_H 

After checking your code, you forgot to configure the security privilege of analog path of ADC Channel_0 (PA1) and you do not configure the RIF aware peripherals such as ADC12 and GPDMA channel.
Remember that the STM32N6 is always in secure context.
Check the code below or refer to the existing project: 
STM32Cube_FW_N6_V1.3.0\Projects\NUCLEO-N657X0-Q\Examples\ADC\ADC_SingleConversion_TriggerTimer_DMA
Best regards,
Romain,

/* set all required IPs as secure privileged */
  __HAL_RCC_RIFSC_CLK_ENABLE();

  /*RISUP configuration*/
  HAL_RIF_RISC_SetSlaveSecureAttributes(RIF_RISC_PERIPH_INDEX_ADC12 , RIF_ATTRIBUTE_SEC | RIF_ATTRIBUTE_NPRIV);

  /* RIF-Aware IPs Config */

  /* set up GPDMA configuration */
  /* set GPDMA1 channel 0 used by ADC1 */
  if (HAL_DMA_ConfigChannelAttributes(&handle_GPDMA1_Channel0,DMA_CHANNEL_SEC|DMA_CHANNEL_PRIV|DMA_CHANNEL_SRC_SEC|DMA_CHANNEL_DEST_SEC)!= HAL_OK )
  {
    Error_Handler();
  }

  /* set up GPIO configuration */
  HAL_GPIO_ConfigPinAttributes(GPIOA,GPIO_PIN_1,GPIO_PIN_SEC|GPIO_PIN_NPRIV);

security  

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Hello,

Thank you for your reply.

I will test with your modifications.

Can the lines to be added to my code not be generated automatically by STM32CubeIDE?

Kind regards

Hello @Thomas_H 
Actually, when using STM32CubeMX 6.16.1 in standalone and STM32CubeIDE 2.0.0, this additional code must be added manually in reference to the example I'm referring previously.
I requested internally a change request to fix it and for a correct code generation in the next version of CubeMX (internal ticket number 224882)
Best regards,

Romain,

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.