Skip to content

Commit 7401535

Browse files
committed
use git blob files instead of a real website
1 parent 2b8410e commit 7401535

7 files changed

Lines changed: 299 additions & 137 deletions

File tree

README.md

Lines changed: 24 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ couple of days.
2323

2424
Find more in detail information about the supported boards, needed tools and
2525
the library APIs on the
26-
[project website](https://tenbaht.github.io/sduino/).
26+
[project documentation files](https://github.com/tenbaht/sduino/blob/master/docs/index.md).
2727

2828
All you need to get stated is a simple STM8S103F breakout board and a
2929
ST-Link V2 compatible flash programmer. Three boards and one flash
@@ -103,7 +103,7 @@ improves significantly from version to version. Be sure to use
103103
version that might be included in your distribution. Version 3.5.0 as
104104
included with ubuntu 16.04 is definitly too old and compilation will fail
105105
due to some compiler errors.
106-
[More information on installing SDCC](sdcc.md)
106+
[More information on installing SDCC](blob/master/docs/sdcc.md)
107107

108108
Support for the Cosmic compiler under Windows and integration into the ST
109109
visual developer IDE might be possible, but is not done (yet?).
@@ -112,13 +112,13 @@ visual developer IDE might be possible, but is not done (yet?).
112112

113113
## Supported hardware
114114

115-
[STM8S103 breakout board](https://tenbaht.github.io/sduino/hardware/stm8blue.html):
115+
[STM8S103 breakout board](blob/master/docs/hardware/stm8blue.md):
116116
works
117117

118-
[ESP14 Wifi board](https://tenbaht.github.io/sduino/hardware/esp14.html):
118+
[ESP14 Wifi board](blob/master/docs/hardware/esp14.md):
119119
untested, but expected to work.
120120

121-
[STM8S105 Discovery board](https://tenbaht.github.io/sduino/hardware/stm8disco.html):
121+
[STM8S105 Discovery board](blob/master/docs/hardware/stm8disco.md):
122122
not supported yet, but work in progress.
123123

124124

@@ -147,6 +147,8 @@ an option.
147147

148148

149149

150+
## Current status and to-do list
151+
150152
## Current status and to-do list
151153

152154
#### tested and working
@@ -157,16 +159,23 @@ an option.
157159
`analogWrite()`
158160
`ShiftOut()`
159161
WMath: `map()`
160-
HardwareSerial
162+
[HardwareSerial]
161163
Print (without float)
162-
SPI: working, no interrupt support
163-
LiquidCrystal (for text LCD based on the HD44780 controller)
164-
PCD8544 (for Nokia 5110 type displays)
165-
[Stepper](Stepper.md) (multi-instance design for more than one stepper at a time)
166-
ssd1306 (for monochrome OLED displays based on SSD1306 controller)
164+
[SPI](https://github.com/tenbaht/sduino/blob/master/docs/SPI.md):
165+
working, no interrupt support
166+
[LiquidCrystal](https://github.com/tenbaht/sduino/blob/master/docs/api/LiquidCrystal.md):
167+
Text LCD based on the HD44780 controller
168+
[PCD8544](https://github.com/tenbaht/sduino/blob/master/docs/api/PCD8544.md):
169+
Nokia 5110 type displays
170+
[Mini_SSD1306](https://github.com/tenbaht/sduino/blob/master/docs/api/Mini_SSD1306.md):
171+
Monochrome OLED displays based on the SSD1306 controller
172+
[Stepper](https://github.com/tenbaht/sduino/blob/master/docs/api/Stepper.md):
173+
Multi-instance design for more than one stepper at a time
174+
[Servo](https://github.com/tenbaht/sduino/blob/master/docs/api/Servo.md):
175+
Multi-instance design for more than one servo at a time)
167176

168177
#### implemented and partly working
169-
Wire/I2C: no deadlock protection yet
178+
Wire/I2C
170179

171180
#### tested, but not working
172181
`alternateFunctions()`
@@ -186,6 +195,7 @@ module WCharacter
186195
module WString
187196

188197

198+
189199
The compile environment needs to detect which interrupts are actively used
190200
and link only the needed ones into the binary. See test/digitalWrite:
191201
Compiling with the straight Makefile.classic does not add UART interrupt
@@ -227,7 +237,7 @@ $1.60-$3.00 for an ATmega8.
227237

228238
## Further reading and application notes
229239

230-
[sduino project website](https://tenbaht.github.io/sduino/):
240+
[project documentation files](https://github.com/tenbaht/sduino/blob/master/docs/index.md).
231241
More in detail information about supported boards, tools and the API.
232242

233243
[PM0051](http://www.st.com/resource/en/programming_manual/cd00191343.pdf):
@@ -261,87 +271,8 @@ hard-coded assumptions about the number of pins with special functions.
261271
Ideally, all these numbers would be the same and all programs could be
262272
compiled without changes.
263273

264-
[Here](https://tenbaht.github.io/sduino/pin_mapping.md)
274+
[Here](blob/master/docs/pin_mapping.md)
265275
I discuss some possible pin mapping strategies and check how close we could
266276
get the the ideal mapping. Unfortunatly, it turns out that a perfect mapping
267277
is not possible.
268278

269-
In the end I chose a simple geometric numbering for the square UFQFPN20
270-
package starting with port pin PA1 and counting up from 0. This results in
271-
this mapping:
272-
273-
sduino pin | STM8S103 CPU port pin
274-
---------- | ---------------------
275-
0-2 | PA1-PA3
276-
3-4 | PB5-PB4 (reverse order)
277-
5-9 | PC3-PC7
278-
10-15 | PD1-PD6
279-
280-
serial: 14,15
281-
SPI: 2,7,8,9
282-
I2C: 3,4
283-
Analog: 6,11,12,14,15
284-
PWM: 2,5,6,12 plus either only 13 or 7-9 but not 13 (via alternate mapping)
285-
286-
+ Easy and logical for use on a breadboard
287-
+ Very clear and logical port pin ordering
288-
- Analog pins are still scattered around
289-
+ TX and RX would be the rarely used analog pin numbers A3/A4 at
290-
the end of the analog pin number list
291-
+ At least the analog pins are in data sheet order
292-
- All functions use totally different pin numbers than Arduino
293-
294-
I am still not really happy with this mapping. Instead of simplifing things
295-
it only adds another layer of abstraction and confusion. To avoid this I
296-
added definitions for the regular CPU pin names like `PA1` and `PD2`. In the
297-
end, this notation seem a lot easier to me. I am open for suggestions for a
298-
better pin number mapping.
299-
300-
The chosen pin mapping for the STM8S103 (possible alternate function in
301-
paratheses):
302-
303-
|Phys. STM8 pin|Name |Functions |Geometrical mapping|special funcion
304-
|---: |--- |--- | --- |---
305-
|1 |PD4 |UART_CLK/T2-1/beep |13 |PWM
306-
|2 |PD5 |TX/Ain5 |14 |Analog A3
307-
|3 |PD6 |RX/Ain6 |15 |Analog A4
308-
|5 |PA1 |(OscIn, kein HS) |0 |
309-
|6 |PA2 |(OscIn, kein HS) |1 |
310-
|10 |PA3 |SS/T2-3 |2 |PWM
311-
|11 |PB5 |SDA LED |3 |
312-
|12 |PB4 |SCL |4 |
313-
|13 |PC3 |T1-3/[T1-n1] |5 |PWM, (n~)
314-
|14 |PC4 |T1-4/Ain2/[T1-n2] |6 |PWM, Analog A0, (n~)
315-
|15 |PC5 |SCK/[T2-1] |7 |(~)
316-
|16 |PC6 |MOSI/[T1-1] |8 |(~)
317-
|17 |PC7 |MISO/[T1-2] |9 |(~)
318-
|18 |PD1 |(SWIM) |10 |
319-
|19 |PD2 |Ain3/[T2-3] |11 |Analog A1, (~~)
320-
|20 |PD3 |Ain4/T2-2 |12 |PWM, Analog A2
321-
322-
323-
324-
325-
326-
### Performance compared with the original Arduino environment
327-
328-
Benchmarking the original Arduino examples from Arduino 1.0.5. The simple
329-
Blinky compiles to 57 bytes of code, the total binary including the sduino
330-
libraries is 1868 Bytes (0x74c).
331-
332-
So far, wiring_analog depends on wiring_digital, even when analogWrite is not
333-
used. This could be solved by compiling the sduino functions separately into
334-
a library.
335-
336-
|Name |Code |Total |Linked files other than main and wiring
337-
|--------------------- |------ |----- |-----------------------------
338-
|01. Basics/ |
339-
|BareMinimum |2 |1238 |-
340-
|Blink |57 |1870 |wiring_digital
341-
|AnalogReadSerial |205 |3452 |digital, analog, serial, print
342-
|DigitalReadSerial |57 |3160 |digital, serial, print
343-
|Fade |226 |2189 |digital, analog
344-
|ReadAnalogVoltage | | |float not yet implemented
345-
|02. Digital/ |
346-
|Debounce |192 |2016 |digital
347-

docs/hardware/esp14.md

Lines changed: 85 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,90 @@
11
# ESP-14
22

33
An ESP-8266 Wifi-Controller together with a STM8S003 CPU for about $2 -
4-
incredible. I am still waiting for mine to be delivered, so nothing is
5-
tested yet. But the STM8S003 is very similar to the STM8S103 used on the
6-
[STM8S103 breakout boards](stm8blue.html) and I expect all software to run
7-
here as well.
4+
incredible. Since the STM8S003 is almost identical to the STM8S103 used on
5+
the [STM8S103 breakout boards](stm8blue.html) all software runs here as well.
6+
7+
8+
Using the same pin numbering scheme as with the stm8blue boards it looks
9+
like this:
810

911
![ESP14 sduino pin numbering](esp14.png)
12+
13+
14+
15+
## Differences between the '003 and the '103 CPUs
16+
17+
Very slim. All differences that I could find so far:
18+
19+
Feature | STM8S003 | STM8S103
20+
------------ | ------------- | ------------
21+
EEPROM size | 128 Bytes | 640 Bytes
22+
23+
I am not sure why the '003 is sold for half the price, or, to but it the
24+
other way around, why anybody should choose the '103 at all. Did I miss an
25+
important difference?
26+
27+
28+
29+
## Using the Wifi connection
30+
31+
The ESP-14 is basically an ESP-01 Wifi-module together with a STM8S breakout
32+
board combined into one PCB. The ESP part comes preprogrammed with the
33+
usual ESP AT-Firmware and is connected to the RX/TX pins of the STM8S.
34+
35+
It feels like having a classic ATmega8-Arduino with a build-in ESP-01
36+
module. Using the [WiFiEsp library](https://github.com/bportaluri/WiFiEsp)
37+
we could have a programming experience very similar to using an Arduino with
38+
a Wifi-shield.
39+
40+
Problem is the limited flash space of the '003. Even the very basic
41+
WebServer example that comes with the WiFiEsp library needs more then 14kB
42+
flash and more than 1kB RAM when compiled for an Arduino Uno. Even if the
43+
library could be carefully optimized to fit into the 8kB flash of an '003 -
44+
there would be no space left for the actual user code.
45+
46+
It is still possible to do very simple task by just sending AT-strings to
47+
the ESP. But here we are definitly leaving Ardunio territory. Here we have
48+
to start from scratch and do it all by ourself. This is not going to be
49+
beginner-friendly anymore.
50+
51+
The major remaining advantage of the STM8S over the ESP is power efficiency.
52+
The STM8S runs on almost nothing, while the ESP draws anything between 50
53+
and 200mA even for the simplest tasks.
54+
55+
In most cases you might want to implement the external communication part of
56+
the application on the ESP, using the
57+
[ESP8266 Arduino port](https://github.com/esp8266/Arduino).
58+
59+
The STM8S is better suited to local control and measurement and other
60+
energy- and time-critical tasks. Both CPUs use separate power supply inputs.
61+
Using an additional PMOS transistor the STM8S could control the power supply
62+
for the ESP and help extending battery life by activating the big brother
63+
only when its services are actually required.
64+
65+
66+
67+
## Poor design choice
68+
69+
Overall, the '003 is a very questionable CPU choice by AI Thinker. The '003
70+
is clearly one of the cheapest CPUs on the market, but the applications for
71+
this module are heavily restricted the the small flash memory.
72+
73+
Why didn't they use an ATmega328? Just one dollar more and the whole Arduino
74+
universe opens up? Or at least an STM8S005K6T6C, offering 32kB flash and 2kB
75+
RAM for only 40 cents more, if you want to go really cheap.
76+
77+
And why would you need an additional PMOS to control the ESP power supply?
78+
Why is this not included on the PCB already? This could the big killer
79+
feature of the current combination.
80+
81+
82+
83+
## The upside
84+
85+
Having a beefy 32 bit CPU and using it as an I/O-coprocessor while running
86+
the main application on an resticted 8-bitter is a weired concept. Things
87+
like the Arduino Yun or the Arduino WiFi-shield don't make too much sense.
88+
89+
It is much more sensible to use the big CPU to control the small one than
90+
the other way around. Maybe this board can help to promote that concept.

0 commit comments

Comments
 (0)