The core doesn't seem to support it with the usual attachInterrupt method. I can make an example work using CubeMX, but porting my program over is going to be a big learning curve as i have never used HAL/cube before. I have tried low level register approach setting up ADC and NVIC.
The problem is I can't figure out how to get address (or offset) of my IRQHandler hooked into the vector table so that it invokes my function when triggered. I know I will have to manage the context saving and clean up myself. It looks like I'm about to go down the hole of compiler directives and linker scripts, which I know very little about.
Code: Select all
//*********** ISR handlers start here *************************
//void ADC1_2_IRQnHandler(void){
//void __irq_adc(void) {
extern "C" void ADC1_2_IRQHandler(void){
ADC_Flag++;
}
My other method is using the ADC watchdog signal(s) which are internally connected to the ETR function of Timer 8.
I set the timer/counter to ( 2^16) -1 then the ADC watchdog signal increments timer 8 and causes an overflow.
and I catch the timer interrupt
Code: Select all
//****** timer8 interrupts enable *********
MainTim8->attachInterrupt(pseudoADC_IT_Handler); //Phase A zero crossing trigger.
//*******start timer 8 **********
TIM8->CR1 |= 0X0001; //start - enable
1. Is there an elegant way?
2. Are there any examples of how to modify the linker? That I can understand hopefully
![Embarrassed :oops:](./images/smilies/icon_redface.gif)
3. Am I missing something simple?
Edit;
I see this https://www.stm32duino.com/viewtopic.php?f=41&t=110 now but it's a litle over my head.
can I mix this into an Arduino sketch?