GPTs not stoped in Continuous mode
GPTs not stoped in Continuous mode
When the timer is running in continuous mode , it is not possible to stop. The function gpt_lld_stop can stop the timer only if the value of the status GPT_READY, and in this mode, the status GPT_CONTINUOUS. It is an error code or something I 'm doing wrong ?
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: GPTs not stoped in Continuous mode
Hi,
It should work in any state, this is the performed check:
Are you experiencing something different?
Giovanni
It should work in any state, this is the performed check:
Code: Select all
chDbgAssert((gptp->state == GPT_READY) || (gptp->state == GPT_CONTINUOUS) ||
(gptp->state == GPT_ONESHOT),
"gptStopTimerI(), #1", "invalid state");
Are you experiencing something different?
Giovanni
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: GPTs not stoped in Continuous mode
Sorry, I misunderstood, you have first to call gptStopTimer() then gptStop().
gptStopTimer() stops the continuous operation, gptStop() stops the whole driver.
Giovanni
gptStopTimer() stops the continuous operation, gptStop() stops the whole driver.
Giovanni
Re: GPTs not stoped in Continuous mode
I use Chibios 2.6.8.(whit mcu stm32f401)
My code:
In file /os/os/hal/platforms/STM32/TIMv1/gpt_lld.c function gpt_lld_stop, not stop timer:
Sorry for my English.
My code:
Code: Select all
gptStart(&GPTD2, &Player_GPT_cfg);
gptStartContinuous(&Player_GPT, PLAYER_GPT_INTERVAL);
...
gptStop(&GPTD2);
In file /os/os/hal/platforms/STM32/TIMv1/gpt_lld.c function gpt_lld_stop, not stop timer:
Code: Select all
void gpt_lld_stop(GPTDriver *gptp) {
if (gptp->state == GPT_READY) {
gptp->tim->CR1 = 0; /* Timer disabled. */
gptp->tim->DIER = 0; /* All IRQs disabled. */
gptp->tim->SR = 0; /* Clear pending IRQs. */
...
Sorry for my English.
Re: GPTs not stoped in Continuous mode
I think it should be a function gpt_lld_stop of :
And it work.
Code: Select all
if (gptp->state != GPT_UNINIT) {
gptp->tim->CR1 = 0; /* Timer disabled. */
gptp->tim->DIER = 0; /* All IRQs disabled. */
gptp->tim->SR = 0; /* Clear pending IRQs. */
...
And it work.
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: GPTs not stoped in Continuous mode
Please read my previous answer, gptStop() is not meant to stop the current operation, you have to use gptStopTimer() for that.
If you enable the state checker in chconf.h you would get an usage violation from using gptStop() while an operation is in progress.
Giovanni
If you enable the state checker in chconf.h you would get an usage violation from using gptStop() while an operation is in progress.
Giovanni