Skip to main content
Explorer
September 4, 2024
Solved

ADC3 interrupt handler not working on STM32H743

  • September 4, 2024
  • 3 replies
  • 1318 views

I have the following problem with my STM32H743:

I want to use the ADC3 for an injected conversion, but the ADC3 interrupt does not call the 

ADC3_IRQHandler, instead the SysTick_Handler is called whenever an ADC3 interrupt happens. 
 
When I read the ISPR from the SysTick_Handler, I can check which interrupt is active and clear the interrupt in the ADC3 ISR register. (So technically I can get everything to work, but I don't want to handle the ADC3 interrupt in the SysTick_Handler)
 
I already read the NVIC registers while debugging and the ADC3 interrupt definitely happens, it just isn't handled by the right handler.
I also checked the ISR vector table in the FLASH to see, if the entry for the ADC3 interrupt holds the wrong value but it points to the ADC3_IRQHandler as it should.
 
I am all out of ideas where to look or what to look for anymore. 

This is what the SysTick_Handler looks like at the moment:

__irq void SysTick_Handler() {
 volatile int ipsr = __get_IPSR();

 if (ipsr == 15) {
 // do the systick thing
 } else if ((ipsr == 143) && (ADC3->ISR & ADC_ISR_JEOS)) {
 ADC3->ISR = ADC_ISR_JEOS;
 // do the ADC thing
 }
}

 Does anyone have an idea, what could cause this?

    This topic has been closed for replies.
    Best answer by TDK

    143 - 15 = 128. So it's off by 128, I'm sure that's not a coincidence.

    I would say that's an issue with SCB->VTOR not being set to a multiple of the vector table length.

    If my interpretation of your screenshot is correct, you have SCB->VTOR = 0x08020200. Perhaps this isn't valid and it needs to be a multiple of 0x400. I'm not going to dig into documentation but that seems probable given the symptoms. Try 0x08020000 or 0x08020400.

    3 replies

    Super User
    September 4, 2024

    > ADC3->ISR = ADC_ISR_JEOS;

    Put a breakpoint on this line and, when it gets hit, show the value of the SCB->ICSR register in a screenshot, along with SCB->VTOR and the relevant entries in there for the 15th and 143rd interrupt addresses.

    tl12Author
    Explorer
    September 5, 2024

    ICSR.PNGVTOR.PNG
    The active exeption at this breakpoint is the ADC3 interrupt and the VTOR value seems to align with the observed vector table offset:
    VectorTable.PNG
    The vector table entries for SysTick_Handler and ADC3_IRQHandler are highlighted.

    TDKAnswer
    Super User
    September 5, 2024

    143 - 15 = 128. So it's off by 128, I'm sure that's not a coincidence.

    I would say that's an issue with SCB->VTOR not being set to a multiple of the vector table length.

    If my interpretation of your screenshot is correct, you have SCB->VTOR = 0x08020200. Perhaps this isn't valid and it needs to be a multiple of 0x400. I'm not going to dig into documentation but that seems probable given the symptoms. Try 0x08020000 or 0x08020400.

    Visitor II
    September 4, 2024

    Use a debugger to step through the code and inspect the exact state when the SysTick_Handler is invoked. Check the state of all registers, particularly IPSR and ICSR, to see what might be causing the jump to the SysTick_Handler instead of ADC3_IRQHandler.

    tl12Author
    Explorer
    September 5, 2024

    0x08020400 worked, thanks! :)