6 years ago.

Reset target fail while CAN Bus connected

Hi

I am currently using CAN Bus with STM32 F446 RE

There is an other device on the bus broadcast CAN messages at 100 Hz600 Hz

The issue occur if I reset STM32 with BUS connected, a message on UART:

can ESR 0x0000.0000 + timeout status 0

appear and LED keep on blinking with specific pattern.

This will not occur if i reset the target with BUS unconnected.

I assume this as a problem with current mbed CAN Bus library, this issue occur back to Ver. 145

For earlier version although the UART message & LED keep silence, the acknowledge function will fail.

I'm looking for solution for this problem, the only method I use now is manually disconnect BUS to STM32 before power up.

The code I use is show as following:

TEST

#include "mbed.h" // Revision 166

CAN can2(D4, D10);

int main(){
    can2.frequency(1000000);
    while(1){
    }
}

1 Answer

5 years, 11 months ago.

I try to remove the frequency change command from main() and try to set it at the declare stage.

This method work fine.

Modified

#include "mbed.h" // Revision 166
 
CAN can2(D4, D10, 1000000); //Set frequency at declaration
 
int main(){
    //can2.frequency(1000000); //Avoid changing frequency when working
    while(1){
    }
}

Accepted Answer

Assigned to SHENG-HEN HSIEH 5 years, 11 months ago.

This means that the question has been accepted and is being worked on.