AnsweredAssumed Answered

CubeMX Race condition

Question asked by Osama Dengler on Oct 19, 2015
The generated code initializes all peripherals and enables interrupts.
The application code's first hook is after peripheral initialization.
How do I ensure that no interrupts before all high level peripherals are ready?

In the RTC IRQ handler I read data from a sensor.
The sensor needs an initialization sequence before being operational.
Too bad that the RTC interrupt is enabled *before* I can initialize the sensor.
RTC-Interrupt orrurs, sensor not yet ready, crash.
__disable_irq() / __enable_irq() is not an option because it blocks SysTick which the initialization code relies on.

Off Course I can do "IfSensorIsEnabled()" in the RTC IRQ handler but why should I?
IMHO this is another case of bad embedded software architecture in CubeMX.