Skip to main content
Senior
June 11, 2025
Solved

Unable to get ADC value on STM32N6570-DK

  • June 11, 2025
  • 3 replies
  • 1362 views

 

Hi everyone,

I’m currently working with the STM32N6570-DK board and trying to read an analog signal using the  ADC1/2 INP8 channel (PB10) using the MB1280C Fanout board (Pin 13) with STMOD+ connector. However, I'm consistently getting a value around 2000 (high impedance value), regardless of whether I connect the pin to GND or a 1.8V source.

For reference, I’ve used similar code on the STM32F441-RE board where it works perfectly, so I suspect this might be related to board-specific settings.

Steps to Reproduce:

  1. Create a default STM32N6570-DK project using STM32CubeIDE.
  2. Set PB10 to ADC2_INP8 mode in the .ioc file.
  3. Keep the ADC settings at their default configuration (12-bit resolution).
  4. Add UART print statements to output the ADC values over the COM port (as shown in my main.c file).
  5. Observe that the ADC value remains around 2000, regardless of the input voltage on PB10 or Pin 13 on the fanout board connected to STMOD+ connector.

I’m attaching my full project for reference.

 

Best answer by RomainR.

Hi @athern27 

After reviewing your code, there some additional thing to fix in main.c:

Include all C mandatory header (stdio.h is needed by snprintf)

/* USER CODE BEGIN Includes */
#include <stdio.h>
#include <string.h>
/* USER CODE END Includes */

 

You configured PLL1 to have output frequency = 1600MHz, then IC1/SYSA = 800MHz. 
But this frequency can only be reached in VOSHigh. Refer to RM0486 in section 13.6.2 Voltage scaling and DS14791 in  Table 24. General operating conditions.

In VOSLow, the SYSA frequency max = 600MHz. Here below the Clock configuration of PLL1 to update in your code, then regenerate the project.

RomainR_0-1749743980923.png

Then in MX_ADC1_Init, ADC is secure, so you need to configure the RIFSC as below:

static void MX_ADC1_Init(void)
{

 /* USER CODE BEGIN ADC1_Init 0 */

 /* USER CODE END ADC1_Init 0 */

 ADC_MultiModeTypeDef multimode = {0};
 ADC_ChannelConfTypeDef sConfig = {0};
 ADC_AnalogWDGConfTypeDef AnalogWDGConfig = {0};

 /* USER CODE BEGIN ADC1_Init 1 */
 __HAL_RCC_RIFSC_CLK_ENABLE();
 RIFSC->RISC_SECCFGRx[2] |= 0x1;
 /* USER CODE END ADC1_Init 1 */

 

Last step concern snprintf format, you need to change the %u to %d as below (ADC_RES is uint16_t type)

snprintf(buffer, sizeof(buffer), "\r\n%d", AD_RES);

With these change, you will be able to read correct ADC conversions on PB10 when applying voltage 0 to 3.3V on Arduino CN7 A5 or on STMOD+ AN #13 from 0 to 4095 decimal values (see my serial terminal)

RomainR_1-1749744520381.png

Refer to the corrected project in attachment.

Best regards,

Romain,

3 replies

Andrew Neil
Super User
June 11, 2025

Have you checked that the expected voltage is actually arriving at the ADC input pin on the STM32 package ?

Have you checked the board schematics and/or User Manual to check that there's nothing else on the board using your chosen pin?

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
athern27Author
Senior
June 11, 2025

HI @Andrew Neil
Thank you for replying.

I have checked the User manual and schematics and also tried with INP18 which was mapped on PA5 A0 (CN7 connector). I have been using the UM3300 user manual and RM0486 Reference manual for the configurations.

Kindly help.

Andrew Neil
Super User
June 11, 2025

And have you checked that the expected voltage is actually arriving at the ADC input pin on the STM32 package ?

If the voltage is not reaching the pin, then the ADC won't be able to read it!

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
athern27Author
Senior
June 11, 2025

I don't know which is the PB10 pin on the STM package as it has a VFBGA structure and i can't access those pins. But I have checked that SB16 0 ohm resistor is present and it is soldered, which was necessary to enable that ADC.

athern27_0-1749639593713.png

athern27_1-1749640666980.png

 

 

TDK
Super User
June 11, 2025

> ADC1/2 INP8 channel (PB10) using the MB1280C Fanout board (Pin 13)

Pin 13 is connected to PC9, not PB10. Or am I missing something?

TDK_0-1749645721500.png

 

"If you feel a post has answered your question, please click ""Accept as Solution""."