Nissan-LEAF-Battery-Upgrade icon indicating copy to clipboard operation
Nissan-LEAF-Battery-Upgrade copied to clipboard

Flashing 2 Port STM32 ARM Based CAN Bridge Using Linux

Open riceke opened this issue 8 months ago • 6 comments

Hello Dala!

First, I just wanted to thank you for all the fantastic work you have been doing with the CAN bridge software! It made it possible for me to upgrade my 2012 LEAF with a 40kWh battery instead of having to retire it and buy a new car.

I know that this is not really an issue per se (as you clearly state that Windows is needed for flashing), but I do not use Windows (the person that helped me with the upgrade does though) and I wanted to try and see if I can flash a new version of the firmware using STLINK and/or STM32CubeProgrammer under Linux.

I have the ST Link V2 USB device connected to the JTAG interface on the STM32F105/F107 based 18 in 1 CAN filter board and I have been able to flash the contents of the 'canbridge.srec' file onto the board and also verified the flash contents against the file.

But, when I replace the same type board, currently in my LEAF, with my newly flashed board it does not work (a lot of CAN bus errors and so forth). Putting back the Windows programmed board makes everything work again.

I am investigating, to start with, that the CPU on my board really executes the code in flash (i.e. starting at 0x08000000) and that it is not instead just executing an initial bootloader (may need setting of some option bytes), but I am also wondering if there is something additional missing that is done by the "magic" 'BridgeFlasher.exe'.

Is there any source available for the 'BridgeFlasher.exe'? I have seen some screen dumps where it says that it successfully patched the 'canbridge.srec' file before flashing it. Exactly what needs patching in the 'canbridge.srec' file and why?

Any other ideas that could point me in a working direction?

Thank you very much for your attention and have a nice day!

riceke avatar Jul 01 '24 17:07 riceke