cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to get ADC value on STM32N6570-DK

athern27
Associate III

 

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.

 

9 REPLIES 9
Andrew Neil
Super User

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.
athern27
Associate III

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.

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.

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

 

 

So check at the nearest accessible point to the 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.
TDK
Super User

> 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".

Hello @athern27 

I'm referring to UM3300 Table 13. STMod+ connector (CN4) pinout.

On the STMOD+, Pin #13 share PC9 (digital GPIO) and PB10 ADC. There are SB9 and SB16 to check.
In the MB1939 schematic, page 9, PB10 is also shared between STMOD_ADC and Arduino A5 connector.
If you need PB10 ADC on STMOD+, check if SB9 is soldered and SB16 must be open (to isolate PC9)

You can also use PB10 on the Arduino CN7 pin #6 (A5R). 

https://www.st.com/en/evaluation-tools/stm32n6570-dk.html#cad-resources

You can apply an input voltage = 3.3V thank to the opamp U6B + resistor voltage divisor R83/R84 (which decrease 3.3V with ratio 0.45, the PB10 ADC input will see 1.79V)
In your code, check first your ADC conversion using fixed value (exemple 1V), read ADC1 data register. You will expect to obtain:
1.0V/VREF * 4095 * 0.45 = 1023 lsb (with VREF=1.8V)
If it doesn't work, mesure PB10 using oscilloscope or voltmeter on STMOD+ or Arduino A5 pin.
Refer and try to existing examples in STM32Cube_N6_v1.1.0
https://github.com/STMicroelectronics/STM32CubeN6/tree/main/Projects/NUCLEO-N657X0-Q/Examples/ADC

Share your code.

Good luck.

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.

Hi @RomainR. 

We desoldered SB16, and SB9 was soldered by default. We then supplied 3.3V to pin 13 of the STMOD+ connector (on the fanout board) using the 3.3V output available on the same fanout board.

Now, we are successfully measuring 3.3V on the A5 connector using a multimeter. However, the ADC values we are receiving are still around 1800–2000, which do not align with the expected values calculated using the standard ADC conversion formula.
We tried on ADC1 and ADC2 by setting PB10 as ADC1_INP8 and ADC2_INP8 respectively.I am attaching the screenshots of the connections made and attaching my project as well.

Regards.

Image2.jpegImage1.jpeg

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,

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.