Skip to content

JeeH example projects

This is a minimal self-contained PlatformIO project. It's not meant as starting point for "real" projects, but shows how little code and configuration is needed to blink an LED.

Back

f412-disco/

These examples are for the STM32F412ZG Discovery (PDF) board. This board has a variety of built-in peripherals, showing JeeH's features and driver support. All settings are configured in the platformio.ini file, with code generated in defs.hpp:

  • blink.cpp: the ubiquitous blinking LED demo
  • joy.cpp: joystick demo, each direction is tied to an LED
  • multi.cpp: blink multiple LEDs with a task and some timers
  • exti.cpp: respond to joystick using interrupts and events
  • pwm.cpp: blink an LED using hardware timer in PWM mode
  • hello.cpp: send greetings to the serial console via ST-Link
  • i2c.cpp: list all I2C devices connected to the I2C1 bus
  • spi.cpp: show ID and size of the on-board SPI flash chip
  • rng.cpp: use the RNG and CRC units to test internal RAM
  • lcd.cpp: draw some graphics on the built-in 240x240 LCD

I've also attached some additional devices for more examples:

  1. The "SPI2C tester" is a custom board with I2C and SPI (F)RAM chips (on the bottom). These are nice for testing, as their results are predictable and verifiable in software.
  2. An 128x32 OLED display, connected via I2C (bottom right).
  3. And a 160x80 LCD module, connected via SPI (top Arduino header).

Example code for these add-ons:

  • mem.cpp: read/write both "SPI2C" FRAM chips in multple modes
  • oled.cpp: display some text on the 128x32 I2C OLED display
  • draw.cpp: draw some graphics on the 160x80 SPI LCD display
  • sdspi.cpp: read FAT16-formatted µSD card using bit-bang SPI

Here's some basic analog signal processing, based on a 10 kΩ + 100 nF low-pass RC filter from PD12 to PC0:

  • plot.cpp: text plot of RC charge/decay of a 250 Hz PWM signal
  • graph.cpp: oscilloscope-like display of that same signal on the LCD

g474-weact/

This board illustrates a few debug logging approaches. It uses a Black Magic Probe to connect to WeAct's STM32G474CE board (see AliExpress). Unlike STM's Nucleo and Discovery boards, this target has no on-board hardware support for uploading and debugging. Since it has two single-row headers, the board can be used on a breadboard.

See the uploading page for information about setting up and connecting a BMP to this target device. The G474 examples are:

  • blink.cpp: not hard to guess, this one ... eh?
  • uart.cpp: set up a UART and send a greeting via the BMP
  • swo.cpp: set up the SWO link and send a greeting via the BMP
  • rtt.cpp: set up RTT and send a greeting via the BMP

Both SWO and RTT do need some additional scripting (pio-swo.py and pio-rtt.py) to properly configure the BMP via gdb. Each approach has its own trade-offs, but RTT + BMP appears to be the most convenient setup for day-to-day use.

See debugging for an example of how to use UART, SWO, or RTT with a BMP connected to this G474 board.

Back