Hello,
I try to measure the width of a pulse using a general purpose timer. The function is invoked as callback to the EXTD1 driver, triggers on EXTI2 event:
void _extIRQ(EXTDriver *extp, expchannel_t channel)
{
if (_edgeChange == 0) {
gptStartContinuous(&GPTD5, 0); //greatest possible reset value
_edgeChange = 1;
} else {
gptStopTimer(&GPTD5);
_klineCfg.speed = 1000000 / gptGetCounterX(&GPTD5);
}
}
I can't invoke neighter gptStartContinuous nor gptStartContinuousI -> assert of improper I class use. It looks working properly if I disable CH_DBG_ENABLE_CHECKS in chconf.h. Could you please advice what is the proper way to use gptStartContinuous ?
GPT timer
Moderator: RoccoMarco
- Giovanni
- Site Admin
- Posts: 14893
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: GPT timer
Hi,
you need to use the I-class functions inside callbacks and ISRs AND you need to call them in between chSysLockFromISR()...chSysUnlockFromISR(). The state checker stops you if do it wrong.
In the RT reference manual there is a section "kernel concepts", read the paragraphs regarding system states and the picture with states.
Giovanni
you need to use the I-class functions inside callbacks and ISRs AND you need to call them in between chSysLockFromISR()...chSysUnlockFromISR(). The state checker stops you if do it wrong.
In the RT reference manual there is a section "kernel concepts", read the paragraphs regarding system states and the picture with states.
Giovanni