cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H74 ADC

shahaf321
Associate III

Hi all, im using STM37H74x evaluation board and i managed to get most of it working (PWM, DAC etc..)

but when i try using the ADC i get strange input, putting the configuration aside, this is what my main looks like below.

im using ADC1 ch6, according to the reference manual in order to use this output i had to change SB

so that SB37 is on and SB38 is off , if i did understand that correctly.

shahaf321_0-1703690875562.png

my output did not seem to mind the pin input and just constantly showed a random value that was between 8000 and 11000

note that the ADC is 16bit. and that i have tried the same method on differently channels and ADCs on the MCU.

What am i missing?

this is my main:

 

int main(void)
{
printf("***********************\n");
printf("started: Ver: %.2f\n",VERSION);
printf("***********************\n\n");
  HAL_Init();
  SystemClock_Config();
  PeriphCommonClock_Config();
 
  MX_USART3_UART_Init();
  MX_USB_OTG_FS_PCD_Init();
  MX_ADC1_Init();
  MX_ADC2_Init();
  MX_ADC3_Init();
  MX_FDCAN1_Init();
  MX_I2C2_Init();
  MX_SPI4_Init();
  MX_TIM2_Init();
  MX_TIM4_Init();
  MX_TIM15_Init();
  MX_TIM17_Init();
  MX_DAC1_Init();
  MX_USART1_UART_Init();
  MX_USART2_UART_Init();
  /* USER CODE BEGIN 2 */
  HAL_TIM_Base_Start(&htim2);
  HAL_TIM_Base_Start(&htim4);
  HAL_DAC_Start(&hdac1, DAC_CHANNEL_1);
 
  dac_out(1.1); //accepts V as input
  //start_plan(1);
 
  int adc_i;
  int raw;
  while(1)
  {
  //adc
  //printf("%d\n",read_ADC());
  HAL_ADC_Start(&hadc1);
  HAL_ADC_PollForConversion(&hadc1, HAL_MAX_DELAY);
  raw = HAL_ADC_GetValue(&hadc1);
  printf("adc: %d\n",raw);
 
  //delay
  HAL_Delay(1);
  }
}
4 REPLIES 4
TDK
Guru

> STM37H74x evaluation board

You could be a little more precise, as there are multiple that fit this description. Well, technically none fit this description, but several fit STM32H74x.

TDK_0-1703697497393.png

 

Download the schematic for your board and ensure the pin that CubeMX is using for the ADC channel is connected to the header where you are applying the voltage.

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

Hi Thanks for taking the time to respond,

the board im reffering to is "NUCLEO-H743ZI2"

i did just realize there was a conflict between documentations in the pinout which explained why i couldn't get it to work.

maybe you can shed some light on this matter,
on the schematic "PF12" is connected to CN10 Pin7 
on the Nucleo pinout doc "PF12" is connected to CN7 pin20

which is not making me need to recheck my entire layout.

Thanks! :)

 

shahaf321_0-1703755411992.png

shahaf321_1-1703755451789.png

 

 

 

 

 

Hi,

ADC1 in6 is on pin PF12 , H743Z/144pin .

MB1364 has (when sb37 closed, 38 open) it on CN10, pin7 .

-> check, what MBxxx version you have ! and whats MBxxx from the other picture -- where you found this ?

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

 

it appears i was looking at the ZI documentation which is Obsolette

instead of the ZI2 documentations...

thanks everyone :)