Flashing (Advanced) - erichelgeson/BlueSCSI GitHub Wiki

[!IMPORTANT] If you are looking for BlueSCSI v2 documentation please go here: https://github.com/BlueSCSI/BlueSCSI-v2/wiki

This page is for developers ONLY!

If you're a User, CLICK HERE: BlueSCSI-Updater

(DO NOT follow the content below if you are a user!)


Developers, you have 2 options to flash BlueSCSI:

  1. Flash the .bin file directly from STM32 ST-LINK Utility (windows only) or STM32CubeProgrammer (cross platform). Use this method if you are not a developer and just wish to get the code to the BluePill - and for some reason don't/can't use the BlueSCSI Updater.

  2. Flash by setting up the Visual Studio Code IDE, installing the ARM toolchain and PlatformIO extensions, and re-compiling and programming. If you are a developer and plan to contribute this method is what you should use.


OPTION 1: Using STLink v2

Setup STLinkV2

STLink's are device programmers needed to load the USB Bootloader or for development and debugging. If your BlueSCSI has USB capability you do not need this.

Be sure to buy the "Clone" STLink V2 programmer - the official STLink programmer does not work.

160190399-a3275132-822e-42ad-894b-af20bde0e57f

Make sure the STLinkV2 is up to date - Latest Firmware

Connect pins SWDIO, GND, SWCLK, and 3.3v from the programmer to the Blue Pill.

NOTE: These are not the same as Serial ports.

Procedure (STM32 ST-Link Utility or STM32CubeProgrammer)

  • Grab the latest bin file from the Releases page.
  • Remove SD Card
  • Open STM32 ST-Link Utility or STM32CubeProgrammer
  • Move the BOOT0 jumper (furthest from the reset button) to 1
  • Connect the BluePill to the STLink
  • Press & release the reset button on the BluePill
  • Click Connect in STM32 ST-Link Utility or STM32CubeProgrammer
  • STM32CubeProgrammer - Goto the Erasing & Programming tab on the Left.
    • File Path: Select the bin file from Step 1
    • Start Address: 0x08000000
    • Checked: Verify programming & Run after Programming
    • Click Start Programming

image

  • After programmed - move BOOT0 jumper back to 0
  • Press & release the reset button on the BluePill
  • You should see the LED PC_13 flashing 5x indicating no SD Card detected.
  • Disconnect the BluePill from the STlink - It's ready to go!

OPTION 2: Procedure (PlatformIO)

  • Remove SD Card
  • Move the BOOT0 jumper (furthest from the button switch) to 1
  • Push the reset button on the BluePill
  • Run the PlatformIO: Upload task.
    • Expected output:
Uploading .pio/build/genericSTM32F103C8/firmware.elf
xPack OpenOCD, x86_64 Open On-Chip Debugger 0.10.0+dev-00378-ge5be992df (2020-06-26-12:31)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 1

0
hla_swd
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x08000194 msp: 0x20000690
** Programming Started **
** Programming Finished **
** Verify Started **
** Verified OK **.      <-- Everything flashed OK
** Resetting Target **
  • Move BOOT0 jumper back to 0
  • Push the reset switch on the BluePill
  • You should see the LED PC_13 flashing 5x indicating no SD Card detected.

The following YouTube video demonstrates the steps of flashing & updating your BlueSCSI https://www.youtube.com/watch?v=bRLAOts_MTM

Option 2.5: Hardcore command line only

If you don't want to rebuild on Linux, you can use the st-flash utility. YOU MUST HAVE THE BOOT 0 JUMPER SET TO 1 for this procedure.

To install:

 cd ~
 git clone https://github.com/stlink-org/stlink
 cd stlink
 cmake .
 make
 sudo make install
 sudo cp config/udev/rules.d/49-stlink* /etc/udev/rules.d
 sudo udevadm control --reload-rules
 sudo udevadm trigger

To flash:

  st-info --probe
  # should return with something meaningful
  st-flash --reset write ./firmware.bin 0x08000000
  # You should see "Flash written and verified! jolly good!"
  # You can ignore a warning about NRST not being connected, if you get that.

Trouble Shooting

Move the jumper furthest away from the RESET switch to 1. Reset and try to program again.

If the device is not detected you may need to hold reset, click program, once it is detected release reset.

If you are unable to get the device in DFU mode for programming you may need to use STM32CubeProgrammer to erase the chip.

Alternative upload methods

See the uploading documentation on PlatformIO for alternatives.