-
Notifications
You must be signed in to change notification settings - Fork 116
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
Nested OC_LOCK_OD causing permanently disabled interrupts. #34
Comments
Very technically, primask shall always be stored as local variable. Can you point out how your call stack looks like when this happens? |
Or maybe disable |
I'm seeing this problem is well. CO_LOCK_OD has a __disable_irq() function inside: Where as CO_UNLOCK_OD only set the mask: Should there be an enable irq inside CO_UNLOCK_OD ? |
No. __set_PRIMASK will enable the interrupts, if these have been enabled before __disable_irq() has been called. |
Ok, somehow the __set_PRIMASK is not re-enabling the interrupts for me. |
This will happen if this happens:
So is there a case when LOCK is called twice in a sequence |
Hi
After the update in CanopenNode where OD is always locked on a SDO call (Always call OD lock macros on SDO operations), my code broke down; the interrupts isnt enabled again.
This change caused nested OC_LOCK_OD to happen and since there is only one variable for storing the primask in the CO_CANmodule_t struct, the interrupts will never be enabled again.
The result was that the code stopped working on a HAL_Delay (infinite while loop) in anothert part of the application since OC_LOCK/__disable_irq apparantly also disable systicks.
I noticed this during a eeprom save (0x1010) because I had OC_LOCK_OD/UNLOCK on the OD-entry to be saved in the "storeEeprom"-function.
Is there any better way to implement this?
Ie. not disabling global interrupts, only the timer in charge of the interrupts and some other way of storing primask?
The text was updated successfully, but these errors were encountered: