Skip to content

Commit 146c548

Browse files
committed
further splitting up the documentation
1 parent 8756d12 commit 146c548

12 files changed

Lines changed: 585 additions & 499 deletions

File tree

README.md

Lines changed: 9 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -117,36 +117,16 @@ visual developer IDE might be possible, but is not done (yet?).
117117

118118
## Supported hardware
119119

120-
The simple breakout boards are build around a CPU STM8S103F3P6 with 16MHz internal
121-
oscillator, 8kB flash, 1kB RAM, and 640 byte EEPROM. The CPU includes a
122-
UART, SPI, I2C, PWM, 10 bit ADC, 3 timer, and up to 14 I/O pins - quite similar to the Atmel ATmega8.
120+
[STM8S103 breakout board](https://tenbaht.github.io/sduino/hardware/stm8blue.html):
121+
works
123122

124-
One (red) LED is connected to GPIO PB5 (CPU pin 11). The push button is for
125-
reset. The CPU runs on 3.3V, a linear regulator is integrated on the
126-
board. The micro USB connector is only for (5V) power supply, the data lines
127-
are not connected.
123+
[ESP14 Wifi board](https://tenbaht.github.io/sduino/hardware/esp14.html):
124+
untested, but expected to work.
128125

129-
All CPU pins are easily accessible on (optional) pin headers
130-
(pitch 2.54mm, perfect for breadboards).
126+
[STM8S105 Discovery board](https://tenbaht.github.io/sduino/hardware/stm8disco.html):
127+
not supported yet, but work in progress.
131128

132129

133-
I am using the ST-Link V2 compatible flash tool in the green plastic
134-
housing. The one in the metal housing uses a different pinout.
135-
136-
Connection to the green flashtool:
137-
138-
|Signal name |CPU board |Flash tool |Metal flash tool
139-
|------ |-----: |-----: |-----:
140-
|3V3 |1 |2 | 7
141-
|SWIM |2 |5 | 5
142-
|GND |3 |7 | 3
143-
|NRST |4 |9 | 1
144-
145-
My breakout boards came preprogrammed with a blink program and with active
146-
write protection bits. For unlocking before first use:
147-
148-
stm8flash -cstlinkv2 -pstm8s103?3 -u
149-
150130

151131
## Compatibility with the Arduino world
152132

@@ -277,64 +257,6 @@ Migration guideline within the STM8L familiy
277257

278258

279259

280-
## Programmer
281-
282-
STM8 uses the SWIM protocol, STM32 uses SWD protocol.
283-
284-
| STM8-Board | SWIM-Verbinder P3
285-
| ---------- | -----------------
286-
| 1 | 3V3
287-
| 2 | SWIM (PD1)
288-
| 3 | GND
289-
| 4 | NRST
290-
291-
292-
Discovery STM32F0308 as ST-Link/V2 (SWD only, not usable for the STM8):
293-
294-
|Pin out CN3 | SWD
295-
|----------- | --------------
296-
|1 | ? detect oder so?
297-
|2 |JTCK/SWCLK
298-
|3 |GND
299-
|4 |JTMS/SWDIO
300-
|5 |NRST
301-
|6 |SWO
302-
303-
304-
Pinout of Chinese ST-Link V2-clone with green plasic housing:
305-
306-
+-----+
307-
T_JRST | 1 2| 3V3
308-
5V | 3 4| T_JTCK/T_SWCLK
309-
SWIM 5 6| T_JTMS/T_SWDIO
310-
GND | 7 8| T_JTDO
311-
SWIM RST| 9 10| T_JTDI
312-
+-----+
313-
314-
Pinout of Chinese ST-Link V2-clone with metal housing:
315-
316-
+-----+
317-
RST | 1 2| SWDIO
318-
GND | 3 4| GND
319-
SWIM 5 6| SWCLK
320-
3V3 | 7 8| 3V3
321-
5V | 9 10| 5V
322-
+-----+
323-
324-
For Linux: required lines in /etc/udev/rules.d/99-stlink.rules:
325-
326-
# ST-Link/V2 programming adapter
327-
328-
# ST-Link V1
329-
#SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device",
330-
ATTR{idVendor}=="0483", ATTR{idProduct}=="3744", MODE="0666", GROUP="plugdev"
331-
332-
# ST-Link/V2, the china adapter with the green plastic housing
333-
#SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTR{idVendor}=="0483", ATTR{idProduct}=="3748", MODE="0666"
334-
ATTR{idVendor}=="0483", ATTR{idProduct}=="3748", MODE="0666", GROUP="plugdev"
335-
336-
337-
338260

339261
## Pin number mappings
340262

@@ -345,9 +267,9 @@ Ideally, all these numbers would be the same and all programs could be
345267
compiled without changes.
346268

347269
[Here](https://tenbaht.github.io/sduino/pin_mapping.md)
348-
I discuss some possible pin mapping and check how close we could get the the
349-
ideal mapping. Unfortunatly, it turns out that a perfect mapping is not
350-
possible.
270+
I discuss some possible pin mapping strategies and check how close we could
271+
get the the ideal mapping. Unfortunatly, it turns out that a perfect mapping
272+
is not possible.
351273

352274
In the end I chose a simple geometric numbering for the square UFQFPN20
353275
package starting with port pin PA1 and counting up from 0. This results in
@@ -405,53 +327,6 @@ paratheses):
405327

406328

407329

408-
## Notes for the Arduino port
409-
410-
### Additional compile-time flags
411-
412-
Some internal details can be influenced by setting compile-time defines
413-
using the `CFLAGS=-Dflagname` line in the Makefile.
414-
415-
Compile-time flag | Purpose
416-
----------------- | --------
417-
`SUPPORT_ALTERNATE_MAPPINGS` | Allow the use of `alternateFunctions()`
418-
`ENABLE_SWIM` | Do not disable the remote debugging
419-
function on the SWIM pin. This means that this pin can not be used for
420-
normal I/O functions.
421-
`USE_SPL` | Use SPL functions for I/O access instead
422-
of direct register accesses. Useful only for debugging and porting to other
423-
CPU variants. Do not use for regular development.
424-
`` |
425-
`` |
426-
`` |
427-
428-
429-
430-
431-
#### Use of the timers
432-
timer1: PWM for PC6, PC7 (8,9), could be used for ADC
433-
timer2: PWM for PA3 (2)
434-
timer4: millis()
435-
436-
#### ADC
437-
the prescaler is initialised for an ADC clock in the range of 1..2 MHz. The
438-
minimum prescaler value is 2, so for a clock speed of less than 2 MHz the
439-
required minimum ADC clock frequency can not be reached anymore.
440-
441-
#### Mapping of logical pin numbers to register addresses
442-
Die ganze Pin->Portadressen-Arithmetik könnte komlett entrümpelt werden. Statt
443-
Tabellen fest im Code enthalten.
444-
445-
#### Inefficient compilation
446-
`digitalWrite` wird spektakulär umständlich übersetzt. Hier lohnt sich
447-
Handassembler.
448-
449-
#### Accessing the alternate pin functions
450-
Added `alternateFunction()` to allow switching of some pins to their alternate
451-
functions. This allows for three more PWM pins, but maybe it adds to much
452-
complexity for the Arduino API. Not sure if it should stay. Has to be
453-
enabled by defining `SUPPORT_ALTERNATE_MAPPINGS`.
454-
455330

456331
### Performance compared with the original Arduino environment
457332

@@ -475,12 +350,3 @@ a library.
475350
|02. Digital/ |
476351
|Debounce |192 |2016 |digital
477352

478-
479-
480-
### Useful CPU features that are not supported by the Arduino API
481-
482-
**Input-Capture-Mode:** Available for all four channels, at least for timer1. Would be great for precise time measurements. Maybe build a library?
483-
484-
**Encoder interface mode:** Kann von Haus aus mit Quadratur-Encodern umgehen
485-
und in Hardware zählen -> perfekt für die Druckerschlitten-Motorsteuerung.
486-
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
Nur in src-split: bak.
2+
Nur in src-split: doit.
3+
Nur in src-split: doit.bak.
4+
diff -ru src/Makefile src-split/Makefile
5+
--- src/Makefile 2016-12-15 20:36:53.146101008 +0100
6+
+++ src-split/Makefile 2016-12-17 23:21:31.539563260 +0100
7+
@@ -1,9 +1,10 @@
8+
CC=sdcc
9+
AR=sdar
10+
-CFLAGS=-c -mstm8 -DSTM8S103 -I ../inc --opt-code-size -I.
11+
+CFLAGS=-c -mstm8 -DSTM8S103 -I ../../inc -I../../src --opt-code-size -I.
12+
LDFLAGS=-rc
13+
-#SOURCES=$(wildcard stm8*.c)
14+
-SOURCES= \
15+
+SOURCES=$(wildcard stm*.c)
16+
+
17+
+LIBSOURCES= \
18+
stm8s_adc1.c \
19+
stm8s_awu.c \
20+
stm8s_beep.c \
21+
Nur in src-split: spl-splitprepare.patch.
22+
diff -ru src/stm8s_adc2.c src-split/stm8s_adc2.c
23+
--- src/stm8s_adc2.c 2016-12-15 20:36:53.150101020 +0100
24+
+++ src-split/stm8s_adc2.c 2016-12-17 23:58:38.065995864 +0100
25+
@@ -1,4 +1,4 @@
26+
-/**
27+
+/***
28+
******************************************************************************
29+
* @file stm8s_adc2.c
30+
* @author MCD Application Team
31+
diff -ru src/stm8s_can.c src-split/stm8s_can.c
32+
--- src/stm8s_can.c 2016-12-15 20:36:53.150101020 +0100
33+
+++ src-split/stm8s_can.c 2016-12-18 00:00:53.858390814 +0100
34+
@@ -1,4 +1,4 @@
35+
-/**
36+
+/***
37+
******************************************************************************
38+
* @file stm8s_can.c
39+
* @author MCD Application Team
40+
diff -ru src/stm8s_clk.c src-split/stm8s_clk.c
41+
--- src/stm8s_clk.c 2016-12-15 20:36:53.150101020 +0100
42+
+++ src-split/stm8s_clk.c 2016-12-17 23:42:34.875237402 +0100
43+
@@ -40,7 +40,7 @@
44+
45+
/* Private Constants ---------------------------------------------------------*/
46+
47+
-/**
48+
+/**
49+
* @addtogroup CLK_Private_Constants
50+
* @{
51+
*/
52+
Nur in src: stm8s_conf.h.
53+
diff -ru src/stm8s_flash.c src-split/stm8s_flash.c
54+
--- src/stm8s_flash.c 2016-12-15 20:36:53.150101020 +0100
55+
+++ src-split/stm8s_flash.c 2016-12-17 23:57:30.841800646 +0100
56+
@@ -31,7 +31,7 @@
57+
/** @addtogroup STM8S_StdPeriph_Driver
58+
* @{
59+
*/
60+
-/**
61+
+/***
62+
@code
63+
This driver provides functions to configure and program the Flash memory of all
64+
STM8S devices.
65+
@@ -88,12 +88,13 @@
66+
67+
/* Private Constants ---------------------------------------------------------*/
68+
69+
-/** @addtogroup FLASH_Private_functions
70+
+/**
71+
+ * @addtogroup FLASH_Private_functions
72+
* @{
73+
*/
74+
75+
#if defined (_SDCC_)
76+
-/**
77+
+/***
78+
* @brief write single byte to address
79+
* @note is required for SDCC, which doesn't yet support far pointers.
80+
* For simplicity 16- and 24-bit pointers are treated identically.
81+
@@ -116,7 +117,7 @@
82+
}
83+
84+
85+
-/**
86+
+/***
87+
* @brief Reads any byte from flash memory
88+
* @note is required for SDCC, which doesn't yet support far pointers.
89+
* For simplicity 16- and 24-bit pointers are treated identically.
90+
Nur in src: stm8s_it.h.
91+
Binärdateien src/stm8s.lib und src-split/stm8s.lib sind verschieden.
92+
diff -ru src/stm8s_rst.c src-split/stm8s_rst.c
93+
--- src/stm8s_rst.c 2016-12-15 20:36:53.150101020 +0100
94+
+++ src-split/stm8s_rst.c 2016-12-17 23:43:27.235385164 +0100
95+
@@ -39,7 +39,7 @@
96+
/* Private function prototypes -----------------------------------------------*/
97+
/* Private Constants ---------------------------------------------------------*/
98+
/* Public functions ----------------------------------------------------------*/
99+
-/**
100+
+/**
101+
* @addtogroup RST_Public_Functions
102+
* @{
103+
*/
104+
Nur in src: stm8s_tim3.c.
105+
Nur in src: stm8s_tim5.c.
106+
diff -ru src/stm8s_tim6.c src-split/stm8s_tim6.c
107+
--- src/stm8s_tim6.c 2016-12-15 20:36:53.150101020 +0100
108+
+++ src-split/stm8s_tim6.c 2016-12-18 00:00:39.314348474 +0100
109+
@@ -1,4 +1,4 @@
110+
-/**
111+
+/***
112+
******************************************************************************
113+
* @file stm8s_tim6.c
114+
* @author MCD Application Team
115+
diff -ru src/stm8s_uart1.c src-split/stm8s_uart1.c
116+
--- src/stm8s_uart1.c 2016-12-15 20:36:53.150101020 +0100
117+
+++ src-split/stm8s_uart1.c 2016-12-17 23:59:31.362150778 +0100
118+
@@ -1,4 +1,4 @@
119+
-/**
120+
+/***
121+
********************************************************************************
122+
* @file stm8s_uart1.c
123+
* @author MCD Application Team
124+
diff -ru src/stm8s_uart2.c src-split/stm8s_uart2.c
125+
--- src/stm8s_uart2.c 2016-12-15 20:36:53.150101020 +0100
126+
+++ src-split/stm8s_uart2.c 2016-12-17 23:59:27.090138356 +0100
127+
@@ -1,4 +1,4 @@
128+
-/**
129+
+/***
130+
********************************************************************************
131+
* @file stm8s_uart2.c
132+
* @author MCD Application Team
133+
diff -ru src/stm8s_uart3.c src-split/stm8s_uart3.c
134+
--- src/stm8s_uart3.c 2016-12-15 20:36:53.150101020 +0100
135+
+++ src-split/stm8s_uart3.c 2016-12-17 23:59:21.506122120 +0100
136+
@@ -1,4 +1,4 @@
137+
-/**
138+
+/***
139+
********************************************************************************
140+
* @file stm8s_uart3.c
141+
* @author MCD Application Team
142+
diff -ru src/stm8s_uart4.c src-split/stm8s_uart4.c
143+
--- src/stm8s_uart4.c 2016-12-15 20:36:53.150101020 +0100
144+
+++ src-split/stm8s_uart4.c 2016-12-17 23:59:01.358063551 +0100
145+
@@ -1,4 +1,4 @@
146+
-/**
147+
+/***
148+
********************************************************************************
149+
* @file stm8s_uart4.c
150+
* @author MCD Application Team

_config.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
theme: jekyll-theme-slate
1+
theme: jekyll-theme-slate
2+
markdown: kramdown
3+
kramdown:
4+
input: GFM
5+
hard_wrap: false

docs/_config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
theme: jekyll-theme-slate
2+
23
markdown: kramdown
4+
5+
kramdown:
6+
input: GFM
7+
hard_wrap: false

0 commit comments

Comments
 (0)