Page 1 of 1

pal Callback is not called with ch version 20.3.1

Posted: Mon May 18, 2020 4:18 am
by fresird
Hi! I have a project use Chibios19.1.3. I upgrade to the lastest Chibios_20.3.1. After that, the pal callback is not working.
I use "palEnableLineEvent" and "palSetLineCallback" the set the line and the callback function. the hardware is stm32f765zg, I set the chip define to "STM32F767xx" to "board.h" and I have checked the config file with "RT-STM32F767ZI-NUCLEO144", also I have used a scope to check the line signal. After switching to Chibios_20.3.x, the callback function is never called. any idea how to debug or fix this problem?

Re: pal Callback is not called with ch version 20.3.1

Posted: Mon May 18, 2020 4:56 am
by Giovanni
Hi,

Moving in "bug reports", which EXTI is not working exactly?

Giovanni

Re: pal Callback is not called with ch version 20.3.1

Posted: Mon May 18, 2020 5:30 am
by fresird
the Line is PAL_LINE(GPIOD, 2U)

Re: pal Callback is not called with ch version 20.3.1

Posted: Mon May 18, 2020 6:03 am
by Giovanni
Hi,

Could you check if the ISR is reached by placing a breakpoint? it is in stm32_exti2.inc, it is better if you compile with -O0 or the breakpoint could be skipped.

Giovanni

Re: pal Callback is not called with ch version 20.3.1

Posted: Mon May 18, 2020 6:49 am
by fresird
Hi!

the ISR is reached !
pr = 4
exti_serve_irq(pr, 0);

stm32_isr.c line 43:
#define exti_serve_irq(pr, channel) { \
\
if ((pr) & (1U << (channel))) { \
_pal_isr_code(channel); \
} \
}

so _pal_isr_code(channel) function is not called?

Re: pal Callback is not called with ch version 20.3.1

Posted: Mon May 18, 2020 6:59 am
by Giovanni
This is good, could you step into exti_serve_irq() and see which condition prevents the callback call? it is not far from there.

Edit: Nevermid, found the problem:

At line 84:

exti_serve_irq(pr, 0);

should be:

exti_serve_irq(pr, 2);

Giovanni

Re: pal Callback is not called with ch version 20.3.1

Posted: Mon May 18, 2020 7:08 am
by fresird
Hi! I edited the last post. It is exti_serve_irq(pr, 0); prevents the callback,
becaure pr = 4, and ((pr) & (1U << (0))) == 0.
I tempeory change exti_serve_irq(pr, 0); to exti_serve_irq(pr, 2); So that I can use the new Chibios_20.3.1
thanks for the help.

Re: pal Callback is not called with ch version 20.3.1

Posted: Mon May 18, 2020 7:10 am
by Giovanni
We posted at same time, anyway, it is a bug, it will be fixed in next release. EXTI4 contained the same error.

Your fix is correct.

Giovanni

Re: pal Callback is not called with ch version 20.3.1

Posted: Mon May 18, 2020 7:25 am
by Giovanni
Fixed as bug #1095.

Giovanni