cancel
Showing results for 
Search instead for 
Did you mean: 

STM32N6(NUCLEO-N657X0-Q) ADC with TIM trigger

userskin1
Associate

Hello


I'm developing on the NUCLEO-N657X0-Q board using the STM32N657X0H3Q.
I'm trying to trigger the ADC when the CCR value on CH2 of TIM1 meets the up counter of TIM1. This triggers the ADC conversion. Once the ADC conversion is complete, a callback function is triggered to store the ADC value in a variable. To verify the callback function's operation, I'm trying to toggle the GPIO.

When I debug and observe the waveforms, I see the waveforms on CH1 and CH2 of TIM as designed. However, the problem is that the GPIO toggles aren't observed. When I check the ADC values ​​in debug mode, the g_adc_raw value is stuck around 1290 and the g_adc_mv value is stuck around 566. Connecting the ADC pin to GND doesn't return 0.

The STM32n6 example, ADC_SingleConversion_TriggerTimer_DMA, works normally, so there seems to be nothing wrong with the board itself.

I plan to control the DC-DC converter, so I need to read the value for each ADC conversion and run the controller, so I don't think DMA is necessary. However, I'm curious why the ADC isn't working in my current code.

I've only been using STM for a week, so I'm sure I'm missing something. Please let me know. I would really appreciate it.

I'll attach the main.c and project files.

1 REPLY 1
userskin1
Associate

I've resolved the issue where GPIO toggle outputs weren't observed through callback functions. In MX, I changed the system core/GPIO/PE13 Configuration/Pin Context Assignment to First Stage Boot Loader, and the toggle function now works properly after the ADC conversion completes following the trigger signal.

However, the ADC values ​​are still measured erratically.

 
 
 

ADC value.png