Arduino¶
That's a Blue Pill¶
NiftyDrum is powered by the STM32F103C8T6 microcontroller, the same chip found in the iconic "Blue Pill" development board.
If you're unfamiliar with the Blue Pill, it’s a widely recognized and versatile board based on the STM32F103C microcontroller family. With 72MHz clock speed, 64KB of flash memory, and 20KB of RAM, it offers plenty of flexibility for customization and experimentation.
Arduino IDE¶
NiftyDrum uses the same microcontroller as the Blue Pill, which means you can program the board using the Arduino IDE. However, you'll first need to install a C++ compiler that targets the STM32F1.
Warning
This section assumes you have already installed the Arduino IDE.
ARM None-EABI Toolchain¶
Linux users can install the ARM None-EABI toolchain directly from their package manager. The package is typically named gcc-arm-none-eabi.
Windows and macOS users should download the official ARM toolchain from Developer.arm.com. Make sure to select the correct version for your operating system.
Arduino STM32 SDK¶
Once you have a working ARM None-EABI toolchain, you will need to install the Arduino STM32 RonnaTech SDK.
Note
Although it's called Arduino STM32 RonnaTech SDK, this is actually a fork of Roger Clark's Arduino STM32 repository with some minor modifications.
Installation Steps¶
- Download and unzip the Arduino STM32 RonnaTech SDK.
- Move the unzipped
Arduino_STM32folder to the appropriate location:- Linux: Navigate to your home directory, then to the
Arduinofolder. Create a new folder namedhardwareand moveArduino_STM32into it. - Windows: Copy the
Arduino_STM32folder toMy Documents/Arduino/hardware. If thehardwarefolder doesn't exist, create it first. The final path should beDocuments/Arduino/hardware/Arduino_STM32. - macOS: Place the
Arduino_STM32folder inside~/Documents/Arduino/hardware. If thehardwarefolder doesn't exist, create it first. The final path should be~/Documents/Arduino/hardware/Arduino_STM32.
- Linux: Navigate to your home directory, then to the
Configure the Toolchain Path¶
After installing the SDK, you need to specify the location of your ARM None-EABI toolchain.
Create a new file named platform.local.txt in the Arduino_STM32/STM32_F1 folder.
If you installed the toolchain via a Linux package manager (e.g., sudo apt install gcc-arm-none-eabi), the compiler is typically located at /usr/bin/arm-none-eabi-g++. In this case, add the following to platform.local.txt:
Adjust the path according to your actual installation location.
Arduino IDE: Choose the Correct Board¶
Blink Example¶
Writing code for the NiftyDrum board is as straightforward as programming any Arduino. Here's a simple blink example:
// The setup function runs once when you press reset or power the board
void setup() {
// Initialize digital pin LED_BUILTIN as an output
pinMode(LED_BUILTIN, OUTPUT);
}
// The loop function runs repeatedly forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // Turn the LED on
delay(1000); // Wait for a second
digitalWrite(LED_BUILTIN, LOW); // Turn the LED off
delay(1000); // Wait for a second
}