I'm working on an STM32F303RB currently and I'm trying to get the ADC running. I can trigger the ADC once using my commandline-command. Now I want to trigger it 40k times per second (or less we'll see) from the pwm/timer callback. I could probably setup and automatic trigger to let the hardware do it for me but this seemed easier (the PWM callback function is demoed in the pwm example).
When I call adcStartConversion I get an SV#4 : non-I class function called from interrupt. Called from an ISR.
When I call adcStartConversionI I get an SV#10 misplaced I-class function. I-class function not called from within a critical zone.
The call stack says otherwise:
Code: Select all
#0 chSysHalt (reason=reason@entry=0x8011ffc "SV#10")
at chibios/os/rt/src/chsys.c:227
#1 0x0800a20c in chDbgCheckClassI () at chibios/os/rt/src/chdebug.c:256
#2 0x08000f3c in adcStartConversionI (adcp=0x200011a8 <ADCD1>, depth=8,
samples=0x20002af0 <samples1.lto_priv>,
grpp=0x8011398 <adcgrpcfg1.lto_priv>) at chibios/os/hal/src/hal_adc.c:191
#3 pwmpcb (pwmp=<optimized out>) at main.c:235
#4 0x0800f424 in VectorA4 ()
at chibios/os/hal/ports/STM32/STM32F3xx/stm32_isr.c:267
So how is this supposed to work?