Problem calling gptStartOneShotI from EXT callback

ChibiOS public support forum for all topics not covered by a specific support forum.

Moderators: RoccoMarco, lbednarz, tfAteba

Post Reply
wypoon
Posts: 2
Joined: Sun Aug 19, 2012 7:00 am

Problem calling gptStartOneShotI from EXT callback

Post by wypoon »

Target: STM32F407
Ver: Trunk

I'm getting the debug assertion error below when I try to use gptStartOneShotI() from within my EXT callback:
chDbgAssert(gptp->state == GPT_READY,"gptStartContinuousI(), #1", "invalid state") // gpt.c

main() {
gptStart(&GPTD2, &gpt2cfg);
gptPolledDelay(&GPTD2, 1000);
extStart(&EXTD1, &extcfg);
}

extcb1 {
chSysLockFromIsr();
gptStartOneShotI(&GPTD2, 200);
chSysUnlockFromIsr();
}

Am I doing something wrong, or is this a bug? Thanks....!
Attachments
USB_CDC_03.zip
(110.58 KiB) Downloaded 308 times
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Problem calling gptStartOneShotI from EXT callback

Post by Giovanni »

Hi,

It is possible you get two EXT callbacks in short time and the second one fails because the GPT is already active. Could you confirm if this is the case?

If so you could check the GPT ste before invoking gptStartOneShot() to check if has already been triggered.

Giovanni
wypoon
Posts: 2
Joined: Sun Aug 19, 2012 7:00 am

Re: Problem calling gptStartOneShotI from EXT callback

Post by wypoon »

Yup, that was it! I shouldn't have assumed that the monostable implementation was retriggerable :mrgreen: Thanks!
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Problem calling gptStartOneShotI from EXT callback

Post by Giovanni »

Actually, adding a retriggerable variant or just make it retriggerable is not a bad idea.

Giovanni
Post Reply