Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait() issue #2910

Closed
Testato opened this issue Oct 4, 2016 · 4 comments
Closed

Wait() issue #2910

Testato opened this issue Oct 4, 2016 · 4 comments

Comments

@Testato
Copy link

Testato commented Oct 4, 2016

if you try to use the wait() function on the classic mbed-dev (NOT mbed-os)
and you use a 100ms of delay
You will found a bug in the wait function. the timing made many errors, the Led jump blinking
I tested it on an F103 board

#include "mbed.h"

DigitalOut myled(PC_13);

int main() {
    while(1) {
        myled = 1;
        wait_ms(100);
        myled = 0;
        wait_ms(100);
    }
}`
@sg- sg- added the devices: st label Oct 5, 2016
@0xc0170
Copy link
Contributor

0xc0170 commented Oct 6, 2016

@bcostm
Copy link
Contributor

bcostm commented Oct 7, 2016

Thanks for reporting this issue. I reproduced it on the Nucleo_F103RB.

I fixed the problem by adding these lines in the timer_irq_handler function in hal_tick.c file:

    if (__HAL_TIM_GET_FLAG(&TimMasterHandle, TIM_FLAG_CC3) == SET) {
        if (__HAL_TIM_GET_IT_SOURCE(&TimMasterHandle, TIM_IT_CC3) == SET) {
            __HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC3);
        }
    }

    if (__HAL_TIM_GET_FLAG(&TimMasterHandle, TIM_FLAG_CC4) == SET) {
        if (__HAL_TIM_GET_IT_SOURCE(&TimMasterHandle, TIM_IT_CC4) == SET) {
            __HAL_TIM_CLEAR_IT(&TimMasterHandle, TIM_IT_CC4);
        }
    }

But I don't know why because channels 3 and 4 are not used... I continue my investigations. But in the mean time you can try it.

@bcostm
Copy link
Contributor

bcostm commented Oct 12, 2016

No, it is not related to CC3/CC4 interrupts.

It is related to the read of the timer master counter. I am going to send a fix soon.

@Testato
Copy link
Author

Testato commented Nov 22, 2016

solved on mbed version 129
Thanks

@Testato Testato closed this as completed Nov 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants