This is a design for an easy to use and easy to make key-chain sized STM8S001J3M3 dongle with CH330N USB-UART, e.g. for STM8 eForth (which turns it into an interactive development environment). It can also be for interfacing, e.g., 1Wire or I2C sensors, as an IR-code transmitter, or prototyping software for "Low density" STM8S µCs (which all have 8K Flash, 1K RAM and 128-640 bytes EEPROM). If you're an 8bit computing and retro-computing affectionado: the typical performance is like a "6502 @ >20MHz" and it's about as easy to program.
The STM8S001J3M3 UART works in "half-duplex" mode (PD5/UART_TX
) with the CH330N USB-UART in wired-or configuration (D1). The internal pull-up of PD5
should be active (the STM8 eForth STM8S001J3 base image takes care of that). This configuration allows IAP (in application programming) in Forth and ICP (in circuit programming) through PD1/SWIM
through pin8 of the µC.
All components, including the PCB and the SMD USB-A connector are easy to obtain (e.g. here for the USB connector - refer to the BOM is in the docs folder).
J2 provides the following signals:
Pin | Label | Pin STM8S001 | GPIO | Features |
---|---|---|---|---|
1 | 5V | 4 | VDD | 5V from USB or external supply |
2 | GND | 2 | VSS | GND |
3 | SDA | 5 | PB5 | I2C_SDA w/ 4k7 pull-up |
- | 5 | PA3 | TIM2_CH3, [SPI_NSS], [UART1_TX] | |
4 | SCL | 6 | PB4 | I2C_SCL w/ 4k7 pull-up, [ADC_ETR] |
5 | LSS | PC3 | NPN "Low Side" switch w/ 47R, e.g. IR LED @ 100mA | |
6 | PC3 | 7 | PC3 | TIM1_CH3, [TLI], [TIM1_CH1N] same as LS NPN base |
- | 7 | PC4 | TIM1_CH4, CLK_CCO, AIN2, [TIM1_CH3] | |
- | 7 | PC5 | SPI_SCK, [TIM2_CH1] | |
7 | SWIM | 8 | PD1 | SWIM |
- | 8 | PC6 | SPI_MOSI, [TIM1_CH1] | |
- | 8 | PD3 | TIM2_CH2, TIM2_CH2, ADC_ETR | |
- | 8 | PD5 | UART1_TX, AIN5 | |
8 | PD6 | 1 | PD6 | UART1_RX, AIN6 |
- | 1 | PA1 | [OSC_IN] |
Note: the circuit relies on the USB port short-circuit protection!
- Pins 1, 2, 3 and 4 can be used for testing I2C modules w/ 5V supply (e.g. STM8 eForth I2C Master)
- Pins 1 and 5 can be used for a 100mA IR LED (e.g. IR Remote Control)
- Pins 1, 2 and 8 can be used for connecting an IR receiver
- Pins 1, 2 and 3 can control a WS2812 LED strip
- Pin 3 and can be used for RS485 after remapping the UART to PA3 (e.g. using the Forth SWIMCOM binary)
- Learn programming Forth ...
Populating the PCB by hand is easy. I recommend starting with D1, then U1, U2, C1 and C2. On the front side populate Q1 and the passive components first, then J1 and finally J2.
The following components are optional (e.g. if J2 isn't needed): R1, R2, R3, R4, Q1 and J2.