How do i read multiplexed ADC Channels? #706
Replies: 3 comments
-
I believe @rleh has more knowledge of the ADC and perhaps this particular issue. |
Beta Was this translation helpful? Give feedback.
-
Sorry for the long wait, I was busy with work/uni. As far as I can see, the F303CB only has a shared interrupt Try this: MODM_ISR(ADC1_2)
{
if(Adc1::getInterruptFlags() & Adc1::InterruptFlag::EndOfRegularConversion){
Adc1::acknowledgeInterruptFlag(Adc1::InterruptFlag::EndOfRegularConversion);
analog_adc_1[adc_1] = Adc1::getValue();
adc_1++;
if(adc_1 > 3){
adc_1 = 0;
}
}
if(Adc2::getInterruptFlags() & Adc2::InterruptFlag::EndOfRegularConversion){
Adc2::acknowledgeInterruptFlag(Adc2::InterruptFlag::EndOfRegularConversion);
analog_adc_2[adc_2] = Adc2::getValue();
adc_2++;
if(adc_2 > 3){
adc_2 = 0;
}
}
} The STM32 may crash or restart if an interrupt is not hooked correctly. It's unfortunate that there isn't a warning about providing the wrong handler. I'll try to see what I can do (it's difficult since this would need to happen at link time). I strongly recommend overwriting the |
Beta Was this translation helpful? Give feedback.
-
Sorry for the delay. I was busy studying for my exams, and now I have a lot of unread github notifications. The STM32F303 series have the same ADC IP as the STM32G4 series, which I started adding modm support for. Maybe I have broken the STM32F303 ADC driver while adding STM32G4 support in 1ab7834 (#287)? While testing the STM32G4 ADC driver from #324 on real hardware, I encountered unexpected problems that I have not yet investigated in detail. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am currently struggling to read all 4 main Channel from multiple ADC. I use a custom board file for a STM32F303CBT6 and more or less every thing works fine till I try to read the Multiplexed GPIOs on the ADCs. There are some problems that i am struggling with, one of them being that there is no example, where multiple channels are read. So I am not sure if I do it correctly and if that what I do is supposed to work with multiple channels.
One attempt that looked promising but failed.
Somehow the Stm crashes when i set the Interrupt for the second ADC
Adc2::enableInterrupt(Adc2::Interrupt::EndOfRegularConversion);
Beta Was this translation helpful? Give feedback.
All reactions