Started April 30, 2021
This is a port of RGBNode to Rust using a Bluepill with a STM32F103 microcontroller. It uses usbd-serial to connect to a computer via serial, which can control the RGB output from a computer using a simple line-based text protocol. It also has an IR receiver using the infrared library, with some custom codes that can also control the RGB output.
I've been using OpenOCD to flash and debug the board. To build the code and flash the board:
cargo build --release openocd -f openocd.cfg -c "program target/thumbv7m-none-eabi/release/rgbnode-rs verify reset exit"
It is also possible to flash the program from within gdb:
openocd # then, in a separate terminal run gdb-multiarch target/thumbv7m-none-eabi/release/rgbnode-rs (gdb) target extended-remote :3333 (gdb) monitor arm semihosting enable (gdb) load (gdb) run
A .gdbinit file is include which will connect to the remote debugger and enable semihosting, but it must be explicitly allow from ~/.gdbinit with a line like:
Note: the OpenOCD target in openocd.cfg has been set to stm32f1x-clone.cfg, which is a copy of the standard
set _CPUTAPID 0x1ba01477 changed to
set _CPUTAPID 0x2ba01477 in order to work with
the CKS clone of the STM32 chip on my very cheap bluepill boards.
These boards also have an incorrect pullup resistor for D+ (10kOhm instead of 1.8kOhm), which makes the USB device unable to be recognized by my computer. I've attached an external 1.8kOhm resistor between 3.3V and PA12. See https://cgit.pinealservo.com/BluePill_Rust/resources/src/branch/master/notes.org#headline-2 for more details
Using via Serial
The following commands are recognized over serial:
Toggle power. If the optional argument is provided, turn on (1) or off (0)
Change the intensity (brightness) to the given value
Change the colour to a preset indexed colour (the actual number will be mod the number of index colours)
Change the delay used by animations to the given value. For strobe, this will be the time between flashes.
For colour swirl, this will be the fade time, follow by twice this delay of hold time between colour changes
Change the colour mode to use (this is mapped to the IR remote channel numbers)
Change just the red colour channel to the given value
Change just the green colour channel to the given value
Change just the blue colour channel to the given value
Increment the indexed colour to use
Decrement the indexed colour to use
Print the firmware version number
Get the Sourcehttps://github.com/transistorfet/rgbnode-rs/
Or clone with:
git clone email@example.com:transistorfet/rgbnode-rs