STM32F407 based Arduino Mega replacement for speeduino
This processor board has been made mainly for the BMW PnP boards that are based on speeduino V0.4 design. Not all arduino Mega pins are connected so support other speeduino boards varies.
! Official V0.3: Supported - not tested/verified
! Official V0.4: Supported - not tested/verified
+ BMW PnP boards: Supported - tested/verified
- 2001-05 MX5 PNP: Not supported
! 1996-97 MX5 PNP: Supported - not tested/verified
! 1989-95 MX5 PNP: Supported - not tested/verified
- NO2C: Not supported
- UA4C: Partly supported (No Fuel pump/tacho)
- If you wish to use the native USB on STM32, set the two USB switches to "On" and FTDI switches to "Off". No Serial0 available in this mode (bluetooth dongles don't work etc.)
- If you wish to use the FTDU USB to Serial converter, set the two USB switches to "Off" and FTDI switches to "On". Serial0 is available on this mode (requires different binary file to work)
- By setting PWR switch to "On" position, the speeduino board is powered by USB. This is usefull for bench testing etc. but for regular use is recommended to have this in "Off" position.
- RST DIP switch is not used or available in some board revisions.
- Install https://www.st.com/content/st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-programmers/stm32cubeprog.html
- Download one of the precombiled Speeduino binaries for this board, located here: https://github.com/pazi88/STM32_mega/tree/main/Speeduino%20binary%20files
- Press down Boot0 button and connect usb cable to the board. Once connected, release Boot0 button. Alternately press down Boot0 and reset buttons simultaneously when usb is already connected. You should see new device "STM32 Bootloader"
- Run STM32 Cube Programmer. (In windows, exe is is located at: C:\Program Files (x86)\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin )
- From right, select "USB" and click "Connect"
- Click "Open file" and browse the previously downloaded binary file.
- Click "Download"
- Now you should be able to connect to the board using the USB cable and use Tuner Studio. After first FW upload, you can use the "STM32 commands" menu in TS to enter Boot0.
Alternatively you can connect ST-Link dongle to the 4-pins on the PCB labeled "ST-Link" and select "ST-LINK" in the STM32 Cube Programmer. In this way, there is no need to go to Boot0 mode.
To be able to compile and upload for this board, follow these steps:
- Install the arduino IDE
- Install the stm32duino core from: https://github.com/stm32duino/Arduino_Core_STM32 (version 1.9.0)
- Install https://www.st.com/content/st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-programmers/stm32cubeprog.html
- Replace the F407xx variant files in STM32 core with these files: https://github.com/pazi88/STM32_mega/tree/main/STM32_core%20files
- Download 202012 or 202103 Speeduino FW release
- Open the code in Arduino IDE.
- In arduino IDE select Tools->Board: GENERIC STM32F4 series
- In Arduino IDE select Tools->Board part number: "BLACK F407VE"
- In Arduino IDE select Tools->USART support: Enabled (generic serial)
- In Arduino IDE select Tools->USB support: CDC (generic serial)
- Open the globals.h file located in project folder
- Look at line 55..58 and replace line "//#define USE_SPI_EEPROM PB0" with "#define USE_SPI_EEPROM PE1" /*Use M25Qxx SPI flash */
- Open the init.ino file located in project folder
- Look at line 1320.. ish and remove the STM32 specific pin mappings for v0.4 board (otherwise the SMT32 mega will lockup)
- Build the speeduino project.
- Press down Boot0 button and connect usb cable to the board. Once connected, release Boot0 button. Alternately press down Boot0 and reset buttons simultaneously when usb is already connected. You should see new device "STM32 Bootloader"
- In Arduino IDE select Upload method: "STM32CubeProgrammer DFU"
- Upload the code
Alternatively you can connect ST-Link dongle to the 4-pins on the PCB labeled "ST-Link" and select Upload method"STM32CubeProgrammer SWD". In this way, there is no need to go to Boot0 mode.
After these steps you should be able to connect to the board using the USB cable and use Tuner Studio. After first FW upload, you can use the "STM32 commands" menu in TS to enter Boot0.