STG-800 lococube mini-PLC
Overview
The Barth Electronik STG-800 lococube mini-PLC [1] board is based on the STM32F091 microcontroller from ST Microelectronics. It has analog and digital inputs, digital power outputs and a CAN bus interface.
Warning
If you program this board with Zephyr firmware, the original miCon-L firmware will be irreversibly overwritten.
Hardware
Microcontroller STM32F091CCUx in UFQFPN48 package. Max frequency 48 MHz.
ARM Cortex M0+ core
32 kByte SRAM
256 kByte flash
8 kByte EEPROM via I2C
Supply voltage +7 to +32 Volt
Temperature range -40 to +70 °C
Vibration Resistant and Rugged Sealing
Green user LED
3 analog inputs 0-30 Volt, 12 bit ADC
2 digital inputs
4 high-side digital outputs, capable of 1.5 A
1 low-side PWM digital output, capable of 2 A
CAN bus interface
Debug serial port, 3.3 Volt compatible
Serial wire debug (SWD) connector
Default Zephyr Peripheral Mapping
Label |
Pin |
|---|---|
LED |
PA8 |
EEPROM (8 kByte):
Signal |
MCU pin |
Default pin mux |
|---|---|---|
SDA |
PB14 |
I2C2 |
SCL |
PB13 |
I2C2 |
CAN controller:
Signal |
MCU pin |
Default pin mux |
|---|---|---|
CAN_TX |
PB9 |
CAN1 |
CAN_RX |
PB8 |
CAN1 |
CAN_S |
PB6 |
GPIO for CAN transceiver enable |
X1 Connector (Supply and CAN bus):
Connector pin |
Label |
Description |
|---|---|---|
1 |
+VDD |
+7 to +32 Volt, use fuse max 5 A |
2 |
GND |
|
3 |
CANH |
|
4 |
CANL |
There are no CAN termination resistors on this board.
X2 Connector (Inputs and outputs):
Connector pin |
Label |
MCU pin |
Description |
Default pin mux |
|---|---|---|---|---|
1 |
IN1 |
PA0 |
Analog in 0-30 Volt |
ADC_IN0 |
2 |
IN2 |
PA1 |
Analog in 0-30 Volt |
ADC_IN1 |
3 |
IN3 |
PA2 |
Analog in 0-30 Volt |
ADC_IN2 |
4 |
IN4 |
PA12 |
Digital in max 30 Volt |
|
5 |
IN5 |
PA15 |
Digital in max 30 Volt |
|
6 |
OUT1 |
PC13 |
Digital out highside |
|
7 |
OUT2 |
PC14 |
Digital out highside |
|
8 |
OUT3 |
PC15 |
Digital out highside |
|
9 |
OUT4 |
PA4 |
Digital out highside |
|
10 |
OUT5 |
PB7 |
Digital out lowside |
There are pulldown resistors on all inputs. Do not switch the highside digital outputs (OUT1-OUT4) faster than 100 Hz, due to heat disipation in the drivers.
X3 Connector (Programming):
Connector pin |
MCU pin |
Signal |
ST-Link/V2 pin |
|---|---|---|---|
1, closest to ISP text |
+3.3 Volt |
1 |
|
2 |
GND |
4 |
|
3 |
PA13 |
SWDIO |
7 |
4 |
PA14 |
SWCLK |
9 |
5 |
RESET |
15 |
X4 Connector (Debug serial port):
Pin |
Comment |
MCU pin |
Signal |
Default pin mux |
|---|---|---|---|---|
1 |
Closest to TTL232 text |
GND |
||
2 |
Connect to host TX |
PA10 |
RX (3.3 Volt) |
USART1 |
3 |
Connect to host RX |
PA9 |
TX (3.3 Volt) |
USART1 |
Supported Features
The stg_800 board supports the hardware features listed below.
- on-chip / on-board
- Feature integrated in the SoC / present on the board.
- 2 / 2
-
Number of instances that are enabled / disabled.
Click on the label to see the first instance of this feature in the board/SoC DTS files. -
vnd,foo -
Compatible string for the Devicetree binding matching the feature.
Click on the link to view the binding documentation.
stg_800/stm32f091xc target
On-target memory for this board target: 32 KiB of RAM, 256 KiB of Flash.
Type |
Location |
Description |
Compatible |
|---|---|---|---|
CPU |
on-chip |
ARM Cortex-M0 CPU1 |
|
ADC |
on-chip |
STM32 ADC1 |
|
CAN |
on-chip |
STM32 CAN controller1 |
|
Clock control |
on-chip |
STM32F0/G0 RCC (Reset and Clock controller)1 |
|
on-chip |
STM32 HSE Clock1 |
||
on-chip |
|||
on-chip |
STM32 LSE Clock1 |
||
on-chip |
STM32F0/F3 Main PLL1 |
||
Counter |
on-chip |
STM32 counters9 |
|
CRC |
on-chip |
STM32 CRC calculation unit1 |
|
DAC |
on-chip |
STM32 family DAC1 |
|
DMA |
on-chip |
STM32 DMA controller (V2bis) for the stm32F0, stm32F1 and stm32L1 soc families11 |
|
Flash controller |
on-chip |
STM32 Family flash controller1 |
|
GPIO & Headers |
on-chip |
STM32 GPIO Controller6 |
|
I2C |
on-chip |
||
IIO |
on-board |
Voltage Divider3 |
|
Input |
on-chip |
STM32 Tocuh Sensing Controller (TSC) driver1 |
|
Interrupt controller |
on-chip |
ARMv6-M NVIC (Nested Vectored Interrupt Controller) controller1 |
|
on-chip |
STM32 External Interrupt Controller1 |
||
LED |
on-board |
Group of GPIO-controlled LEDs1 |
|
Memory controller |
on-chip |
STM32 Battery Backed RAM1 |
|
MTD |
on-chip |
STM32 flash memory1 |
|
on-board |
I2C EEPROMs compatible with Atmel’s AT24 family1 |
||
NVMEM |
on-chip |
Fixed layout for Non-Volatile memory1 |
|
OTP memory |
on-chip |
STM32 embedded NVM OTP1 |
|
PHY |
on-board |
Simple GPIO controlled CAN transceiver1 |
|
Pin control |
on-chip |
STM32 Pin controller1 |
|
PWM |
on-chip |
STM32 PWM7 |
|
Reset controller |
on-chip |
STM32 Reset and Clock Control (RCC) Controller1 |
|
RTC |
on-chip |
STM32 RTC1 |
|
Sensors |
on-chip |
STM32 VREF+1 |
|
on-chip |
STM32 family TEMP node for production calibrated sensors with two calibration temperatures1 |
||
on-chip |
STM32 VBAT1 |
||
Serial controller |
on-chip |
||
SMbus |
on-chip |
STM32 SMBus controller2 |
|
SPI |
on-chip |
STM32 SPI controller with embedded Rx and Tx FIFOs2 |
|
Timer |
on-chip |
ARMv6-M System Tick1 |
|
on-chip |
STM32 timers9 |
||
Watchdog |
on-chip |
STM32 watchdog1 |
|
on-chip |
STM32 system window watchdog1 |
Programming and Debugging
The stg_800 board supports the runners and associated west commands listed below.
| flash | debug | debugserver | attach | rtt | reset | |
|---|---|---|---|---|---|---|
| jlink | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| openocd | ✅ | ✅ (default) | ✅ | ✅ | ✅ | |
| stm32cubeprogrammer | ✅ (default) |
Connect a ST-Link/V2 programmer to the X3 connector of the board. See the table above for how the pins of the ST-Link/V2 programmer should be connected to pins of the board connector.
In order to be able to program new firmware to the board, the “option bytes” of the microcontroller must be erased to disable read/write protection. This can be done using the STM32CubeProgrammer [2] software.
The board is configured to be flashed using west STM32CubeProgrammer runner, so its installation is required.
Alternatively, OpenOCD or JLink can also be used to flash the board using
the --runner (or -r) option:
$ west flash --runner openocd
$ west flash --runner jlink
Flashing
To run the Blinky sample:
# From the root of the zephyr repository
west build -b stg_800 samples/basic/blinky/
west flash
Try also the Hello World, Analog-to-Digital Converter (ADC) with devicetree, EEPROM and Controller Area Network (CAN) counter samples.
Use the shell to read the input pins and control the output pins:
# From the root of the zephyr repository
west build -b stg_800 samples/sensor/sensor_shell -- -DCONFIG_GPIO=y -DCONFIG_GPIO_SHELL=y
west flash
Read analog voltage on IN1 (which is around 12 Volt in this example):
uart:~$ sensor get input1
channel type=42(voltage) index=0 shift=4 num_samples=1 value=87626876000ns (11.984414)
Read digital signal on IN4 (pin A12):
uart:~$ gpio conf gpioa 12 ih
uart:~$ gpio get gpioa 12
1
Set digital OUT1 (pin C13) to high:
uart:~$ gpio conf gpioc 13 oh0
uart:~$ gpio set gpioc 13 1