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.
11 years, 2 months ago.
CAN interrupt problem
Hi guys,
I just met a strange problem about CAN interrupt.
I have a simple program as following:
include the mbed library with this snippet
#include "mbed.h" DigitalOut led(LED1); CAN can2(p30, p29); void rec(void) { CANMessage msg; if(can2.read(msg)) led=1; } int main() { led=0; can2.frequency(1000000); // can2.attach(rec, CAN::RxIrq); while(1) rec(); }
When there is a message on the CAN bus, the LED 1 will be on.
But when I use the interrupt:
include the mbed library with this snippet
#include "mbed.h" DigitalOut led(LED1); CAN can2(p30, p29); void rec(void) { CANMessage msg; if(can2.read(msg)) led=1; } int main() { led=0; can2.frequency(1000000); can2.attach(rec, CAN::RxIrq); while(1); // rec(); }
The LED won't be on, not even in the following code:
include the mbed library with this snippet
#include "mbed.h" DigitalOut led(LED1); CAN can2(p30, p29); void rec(void) { // CANMessage msg; // if(can2.read(msg)) led=1; } int main() { led=0; can2.frequency(1000000); can2.attach(rec, CAN::RxIrq); while(1); // rec(); }
What do I miss? Or What's wrong with the CAN interrupt?
2 Answers
11 years, 2 months ago.
The BUG has been found!! Check out: https://github.com/mbedmicro/mbed/issues/56 Thank you very much Richard Low!