Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
Have come across a runtime error that's new to me and could use a pointer or two. The following bit of code compiles but throws an error at runtime. The serial debug kicks out :
mbed assertation failed: !are_interrupts_enabled(), file: /home/jenkins/mbed_jenkins/workspace/bm_wrlUY1701/mbed-os/hal/mbed_cr6
If I comment out disable/enable_irq there is no error. Can anyone shed a little light for me?
void doDCC() { __disable_irq(); Control.printf("<t 1 %d %d %d>", LocoAddress[ActiveAddress], LocoSpeed[ActiveAddress], LocoDirection[ActiveAddress]); __enable_irq(); } void setup() { LCD.setCursor(3,2); LCD.printf("DCC++ Controller 0.1"); Control.printf("<0>"); dcc_clk.attach(doDCC, dccTimer/1000); tone2(); } int main() { t_out.init(); spi.format(8,3); spi.frequency(2000000); pc.baud(115200); Control.baud(9600); channelA_.mode(PullUp); channelB_.mode(PullUp); chanA = channelA_.read(); chanB = channelB_.read(); currState_ = (chanA << 1) | (chanB); prevState_ = currState_; channelA_.rise(&encode); channelA_.fall(&encode); channelB_.rise(&encode); channelB_.fall(&encode); setup(); //... }