cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F446 CAN bus initialisation

fab04
Associate III

Hi everybody,

I used a STM32F446 to communicate on NMEA2000 (CAN bus).

The two pins (RX/TX) of my µc are connected to an isolator SI8621 (https://www.skyworksinc.com/-/media/Skyworks/SL/documents/public/data-sheets/si861x-2x-datasheet.pdf) and then, a can transceiver is connected MCP2542 (https://ww1.microchip.com/downloads/aemDocuments/documents/APID/ProductDocuments/DataSheets/MCP2542FD-MCP2542WFD-4WFD-Data-Sheet-DS20005514C.pdf)

My board doesn't supply the NMEA2000 (the +12V is provided by T-bone of CAN bus - (I have a voltage regulator 12V to 5V on my board).

When I supplied the NMEA2000, it works fine. But, NMEA2000 is an option, and by default nothing will be connected on the connector, so no there is no supply on the CAN bus transceiver, so the initialization of CAN bus doesn't work (timeout error).

It's no use to put a pull-up resistor on RX or a end of line resistor because there is no voltage.

For me the only solution that I see, is that the user (I've a screen) says if NMEA2000 is used or not. If this one is not used, I didn't initialize it, and if it's actived by user, I can initialize it.

Do you think there is another solution to do it ?

 

 

2 REPLIES 2
mƎALLEm
ST Employee

Hello,

Not sure I understood the question and it's hard to help you based on that description. 

You may need to schematize your system in a figure.

Do you mean that you have only tow nodes on the CAN bus: node 1:  STM32F446, node 2: "NMEA2000"? and sometimes you power off that "NMEA2000" so the bus is no more functional? if it's the case, that's not possible when CAN is in Normal mode. You need either to detect that NMEA2000 is powered off therefore, you will put the CAN transceiver in Standby mode and disable any transmit or switch to a loopback mode till the next power on of NMEA2000.

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
fab04
Associate III

hello,

sorry for my explanation.

Yes, I used two can bus on my STM32F446. The first (it works well - my board supplied it), I used it to communicate with other products, and no problem.

The second one, I used it for NMEA2000. I've put a schematic of this part in attached document.

So, NMEA2000 is isolated and powered by an external power supply. But sometimes, this bus will not be used, and the isolated side will not be supplied).

If I start my STM32F446 and if the nmea2000 bus is supplied, it works  well.

If I start my STM32F446 and if the nmea2000 bus is not supplied, it doesn't work, the SW will go in hardfault after the HAL_CAN_Start().