-
Notifications
You must be signed in to change notification settings - Fork 22
Build UsbMidiKlik4x4 from sources
I assume that you have an Arduino environment ready to use with STM32DUINO, and a Bluepill card on which you have downloaded the stm32duino bootloader. If not, please refer to the Roger Clarke wiki pages here : https://github.com/rogerclarkmelbourne/Arduino_STM32/wiki.
You will also need GIT which you can find at https://gitforwindows.org/ for Windows 10.
For other environments (Linux or MacOsX), install the git package.
1. Copy the midiXParser and PulseOut libraries into your Arduino library directory.
The Arduino user libraries directory is usually located at "C:\Users\ [user name] \Documents\Arduino\libraries".
Open a git bash by clicking on "Git bash here" on the right button menu on Windows 10, or open a terminal console with other OS.
CD to your Arduino libraries user directory, then clone the midiXParser and PulseOut repositories as follow :
$ cd "/c/Users/thekikgen/Documents/Arduino/libraries"
$
$ git clone https://github.com/TheKikGen/midiXparser.git
Cloning into 'midiXparser'...
remote: Enumerating objects: 52, done.
remote: Counting objects: 100% (52/52), done.
remote: Compressing objects: 100% (41/41), done.
remote: Total 244 (delta 22), reused 27 (delta 11), pack-reused 192
Receiving objects: 100% (244/244), 79.37 KiB | 883.00 KiB/s, done.
Resolving deltas: 100% (133/133), done.
$
$ git clone https://github.com/TheKikGen/PulseOut.git
Cloning into 'PulseOut'...
remote: Enumerating objects: 29, done.
remote: Total 29 (delta 0), reused 0 (delta 0), pack-reused 29
Unpacking objects: 100% (29/29), done.
2. Get the source of UsbMidiKlik4x4
In a bash command window, create a working directory (e.g. "ArduinoProjects" in your documents folder), and clone the UsbMidiKlik4x4 repository :
$ mkdir "/c/Users/thekikgen/Documents/ArduinoProjects/"
$ cd "/c/Users/thekikgen/Documents/ArduinoProjects/"
$ git clone https://github.com/TheKikGen/USBMidiKliK4x4.git
Cloning into 'USBMidiKliK4x4'...
remote: Enumerating objects: 69, done.
remote: Counting objects: 100% (69/69), done.
remote: Compressing objects: 100% (63/63), done.
remote: Total 1043 (delta 39), reused 14 (delta 6), pack-reused 974
Receiving objects: 100% (1043/1043), 27.17 MiB | 1.31 MiB/s, done.
Resolving deltas: 100% (695/695), done.
$
3. Build the firmware and upload it to your Bluepill
As no make script is generated with Arduino projects, you must open the Arduino IDE, usually by double-clicking on the UsbMidiKliK4x4.ino file to build the firmware.
In the "tool" menu, choose :
. "Generic STM32F103C series" as board type
. "Faster -O2" as optimize option
. "STM32F103C8 (20k RAM.64k Flash)" as variant
. "72 Mhz" as CPU speed
. "STM32duino bootloader" as upload method
Connect the Bluepill to the USB port of your computer and then click on the right arrow icon in the tool bar to compile and upload the firmware. The compilation will start as you will see at the bottom of the screen.
When the prompt "Assuming the board is in perpetual bootloader mode and continuing to attempt dfu programming..." , appears, press the reset button on the Bluepill to enable DFU mode. The firmware will be uploaded immediatly.
If the firmware was correctly uploaded, the LED will flash rapidly, indicating that the USBMidiKlik4x4 "configuration mode" is enabled. Reset the Bluepill again, and you should see the USBMidiKlik4x4 in your preferred midi software.
Searching for DFU device [1EAF:0003]...
Found it!
Opening USB Device 0x1eaf:0x0003...
Found Runtime: [0x1eaf:0x0003] devnum=1, cfg=0, intf=0, alt=2, name="STM32duino bootloader v1.0 Upload to Flash 0x8002000"
Setting Configuration 1...
Claiming USB DFU Interface...
Setting Alternate Setting ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
Transfer Size = 0x0400
bytes_per_hash=1234
Starting download: [##################################################] finished!
state(8) = dfuMANIFEST-WAIT-RESET, status(0) = No error condition is present
error resetting after download: usb_reset: could not reset device, win error: Un périphérique qui n’existe pas a été spécifié.
Done!
NB : The "error resetting after download error" is normal with the Bluepill because no reset line exists.