cancel
Showing results for 
Search instead for 
Did you mean: 

Using STM32F427 bootloader with canbus

PSalm
Associate II

Hello!

We have custom board build with STM32F427 and embedded linux and i am trying to connect the STM32 bootloader with canbus. On the board the STM32 uses CAN2.

I can toggle the pins BOOT0 and RESET from the linux, and i can program the stm32 fine with UART bootloader from my personal laptop.

However i would like to program the STM32 from the embedded linux using canbus. In our stm32 application code the can-bus works fine -- i am able to send and receive messages from/to linux-stm32 (with 125kbs - frequency verified with oscilloscope)

Now when i boot to bootloader and try to send can bootloader sync frame 079 the stm32 never acks the message. This causes the linux to try re-transmission, that the stm32 never replies. -> I am under the impression that the CAN-frame is not detected as described on application note.

I am able to confirm that PB12 - CAN2_RX is toggled with proper looking pattern with oscilloscope.

To make sure the stm32 is in bootloader mode, i later try to connect to uart-bootloader and it works fine (-> i would say the device is in bootloader mode). I did try also without the uart connected to make sure it would not cause any issues.

Any ideas how to continue the debugging of the bootloader? Or what could be wrong?

5 REPLIES 5

The loader is sensitive to the external clock source being used, and also transitions on other pins that it is monitoring for connections.

We've had the occasional user of the CAN loader here, but it's not heavily used. For commercial projects you might want to check with your FAE.

I personally would probably try jumping into the ROM loader from application space, or running it from the debugger, and get a feeling for what is happening internally.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
PSalm
Associate II

Hi Thanks for your reply! I'll check with the debugger if i get any sense on the behaviour.

I was also suspecting the external pins (that it for example goes to SPI bootloader mode) but as the UART bootloader works after the i have failed with the CAN-bootloader i was under the impression that it would be either in a) uart bootloader loop or b) in detect bootloader loop. Grounding the uart did not help though.

AvaTar
Lead

ST has an application note describing the bootloader algorithm. Don't have a link available at the moment.

Have you tried different baudrates ?

The 125 kBps might mot work well in the bootloader, when clocked from HSI (with 8MHz, I think).

PSalm
Associate II

Yes i have. The 125kbs is described in the application note as the baudrate that should be used to get the canx bootloader frame detect done.

To make sure i tried baudrates 100khz + N*1khz for N = 0,1,2,...50 (with linux script) and made sure with scope that the bus was sent

It did not help.

PSalm
Associate II

Hello, just for update. We found the reason; the CAN2 RX pin was wrong; it was on alternative mapping that worked fine for normal mode, but not for bootloader - reading the application note carefully would have solved the issue.