/open-cleverpad

Open source firmware for MIDIPLUS SmartPAD MIDI controller

Primary LanguageRustApache License 2.0Apache-2.0

open-cleverpad

An open firmware for MIDIPLUS SmartPAD (being a pretty cheap launchpad-like MIDI-controller)

This project is developed and maintained by DerFetzer. Feature and pull requests are very welcome!

Features

  • All pads, encoders and the buttons at the bottom generate standard MIDI messages when used.
  • Pads support 64 colors instead of only 8 with the stock firmware.
  • All LEDs can be fully controlled via MIDI messages.
  • Left buttons set the channel for encoder messages.
  • Right buttons set the channel for the pads.
  • Switch the channels via MIDI messages.

MIDI Messages

Have a look at the included Ardour MIDI map to get an idea of how it could be used.

  • Pads: note_on/note_off channel=m note=0-64 velocity=127/0 where m can be set with the buttons on the right
  • Buttons at the bottom: note_on/note_off channel=8/9 note=0-3 velocity=127/0
  • Encoders: control_change channel=n control=1-8 value=v time=0 where n can be set with the buttons on the left and v works according to enc-l here by default
  • Set encoder parameters:
    • send control_change channel=n control=112, value=0-4 to change the behavior of encoders of channel n to 0=enc-r, 1=enc-l, 2=enc-2, 3=enc-b as described here. When the value is 4 encoders send absolute values. The current internal value can be set with the corresponding encoder message.
    • send control_change channel=n control=113, value=1-33 to change the value multiplier of encoders of channel n when they are moved fast (the default is 10)
  • Set encoder channel: send control_change, control=110, value=0-7
  • Set pad channel: send control_change, control=111, value=0-7
  • Set LED color: send note_on with the same channel and note as the pad/button generates, note_off disables the LED with any values
    • Buttons at the bottom: any value greater 0 enables the LED
    • Pads: value is interpreted as 0b0bbggrr

Installation

  • [Only once] This firmware is designed to be used with the HID-bootloader.
    • Download the repository.
    • Compile the bootloader by executing make smartpad inside ./bootloader/F1 folder or use the precompiled binary from the bin folder.
    • Important: The original firmware will be lost after this step and cannot be restored!
    • Flash the resulting binary via SWD as described here or with any other method you are comfortable with.
  • In order to enter bootloader mode you have to push and hold the first pad in the third row during power up for about 1 second.
  • Use the precompiled binary from the bin folder or run cargo objcopy --release -- --bin open-cleverpad -O binary open-cleverpad.bin to generate the binary from source.
  • Flash the .bin file using hid-flash tool from ./cli folder with something like the following: hid-flash open-cleverpad.bin tty0. Just use any serial device and ignore messages like error, counldn't open [/dev/tty0].

Developer Documentation

  • The used STM32F103RBT6 unfortunately has flash read protection activated and there is a function that resets the microcontroller when there is activity on the SWD interface.

  • There is an update mechanism in the original firmware but I did not look at it for long. Current updater can be downloaded at MIDIPLUS homepage.

  • s0len0id assembled a great documentation of stock firmware function here.

  • In order to remove read protection you have to mass erase the device, so the original firmware will be lost. You have to try during startup with something like the following:

$ openocd -f /usr/share/openocd/scripts/interface/stlink-v1.cfg -f /usr/share/openocd/scripts/target/stm32f1x.cfg  -c init -c "reset halt" -c "flash banks" -c "stm32f1x mass_erase 0" -c "stm32f1x unlock 0"
  • For reverse engineered information about the used hardware see hardware folder.

Dependencies

  • rust-std components (pre-compiled core crate) for the ARM Cortex-M3 targets. Run:
$ rustup target add thumbv7m-none-eabi

License

This crate is licensed under either of

at your option.

Credits

This crate is based on the cortex-m-quickstart template.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Code of Conduct

Contribution to this crate is organized under the terms of the Rust Code of Conduct, the maintainer of this crate, DerFetzer, promises to intervene to uphold that code of conduct.