Skip to content

Firmware

Dilshan R Jayakody edited this page Jun 18, 2022 · 9 revisions

Building the firmware

Following software and hardware components are necessary to compile and flash the StarPointer firmware:

This firmware is developed in a Linux environment, and therefore it is recommended to use a Linux-based system to build the firmware.

The complete source code of the StarPointer firmware is available on the GitHub repository. Use the following commands to obtain the source code with the LibOpenCM3 library:

git clone [email protected]:dilshan/star-pointer.git
cd star-pointer/
git submodule update --init --recursive

After cloning the source code, issue the following commands to compile the firmware:

cd firmware/libopencm3/
make

cd ..
make

After the successful compilation, the starpointer.hex file may need to generate in the firmware directory.

The compiled firmware binary is also available to download in the release section of this project repository.

Flash firmware

To flash the firmware connect ST-LINK/V2 USB programmer to the J2 ICP port.

J2 ICP port pinouts

To flash the firmware, use the stlink-gui tool with a 0x08000000 memory offset.

STlink GUI memory offset configuration

If stlink-gui is not detecting the MCU, follow the steps given below:

  1. Short-circuit the JP1 jumper
  2. Click the Connect button at stlink-gui and immediately remove the short-circuit applied in JP1.

Monitoring the firmware logs

Firmware logs can use to identify the firmware/device issues. To access the firmware logs, connect the 3.3V USB to TTL serial adapter to the J1 port.

Serial terminal pinouts

The firmware logs can view using a serial console tool such as minicom with the following parameters:

  • baud rate: 38400
  • Data bits: 8
  • Parity bit: No
  • Stop bit: 1

If all the modules and peripherals are working fine, the serial console must display a log message similar to the below listing:

SysTick verification completed
Initialize I2C interface 2
Initialize magnetometer
Compass scale = 0.920000
Initialize accelerometer
Loading user configuration
Latitdue : 0.000000
Longitude : 0.000000
Offset MAG: 0.000000
Offset INC: 0.000000
Initialize RTC
TIME = 15:7:11
DATE = 15-0-2022
Setup USB CDC interface