Line follower code for Mighty Bug-A boards
Current version: Electronic Experience (v1.4.0)
This repository is intended to serve as a base project to build firmwares for cheap chinese Bluepill boards based on STM32F103C8T6 Cortex M3 processor. We use libopencm3 as our main library and flash the boards with a simple USB to serial converter using stm32loader.py.
Initialise submodules
git submodule init
git submodule update
There are different options to get the toolchain up and running:
- On some Linux distributions (Debian and Ubuntu) you can install them from the repositories looking for gcc-arm-eabi or gcc-arm-none-eabi
- You can also download it from the ARM web page using the following link and choosing the right one for your OS: https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads In order to install this verion unpack it and add TOLCHAIN_PATH/bin' and TOLCHAIN_PATH/sbin to your PATH system variable.
Once the toolchain is installed properly you can build by using the provided Makefile. The first time you must use make all
to download libopencm3 and build it. After that you can use make bin
to speed up compilation avoiding to rebuild libopencm3 every time.
The resulting binary firmware bluepill_test.bin can be flashed to the actual board using a simple USB to serial converter (FTDI or similar). The wiring should be as follows:
Bluepill | FTDI |
---|---|
GND | GND |
3.3V | 3.3V |
A9 | RXD |
A10 | TXD |
Note that in order to flash a binary firmware it is necessary to configure the BOOT0 jumper in position 1 as shown in the following picture:
To talk to the board you can use a python script called stm32loader.py:
wget https://raw.githubusercontent.com/jsnyder/stm32loader/master/stm32loader.py
To use this software you have to install pyserial.
sudo pip install pyserial
Finally you can flash the new firmware with the command shown below. Remember to change SERIAL_PORT with the path assigned to your USB to serial converter (e.g. dev/ttyUSB0):
python stm32loader.py -p SERIAL_PORT -e -w -V -g 0x08000000 -v bluepill_test.bin
It is possible to build and flash the firmware and the tests as well. Use "make help" to read the propper make targets.
The Makefiles are ready for using with the black pill (the newest blue pill version). Use the following commands to compile for the black pill:
PILL=BLACK make
or define PILL=BLACK as an environment variable
- for our line follower, we are using the chassis from https://gitlab.com/punkto/line_follower_3d_designs
- stm32loader.py: https://github.com/jsnyder/stm32loader
- libopencm3: https://github.com/libopencm3/libopencm3
- pill_blink: https://github.com/satoshinm/pill_blink
- Large set of examples with the stm32f1 microcontroller: https://github.com/g4lvanix/STM32F1-workarea
- Micromouse project https://github.com/Theseus/bulebule
- Cyclops project: line follower: https://github.com/Resaj/cyclops-project