トップ 一覧 検索 ヘルプ RSS ログイン

Tips-stm8の変更点

  • 追加された行はこのように表示されます。
  • 削除された行はこのように表示されます。
!! STM8S103F3P6

! STM8 ボード
http://reinvent.hatenablog.com/entry/2017/07/25/214237

STM8S103F3P6

https://amzn.to/2SbSFyp

! 仕様
https://www.stmcu.jp/stm8/stm8s/stm8s103105/34603/

! 使う前に
 stm8flash -cstlinkv2 -pstm8s103?3 -u

!開発
SDCC
 
 #zypper install sdcc

sduino

 https://tenbaht.github.io/sduino/

!STM8FLASH
https://github.com/vdudouyt/stm8flash

https://github.com/vdudouyt/stm8flash

 $ git clone https://github.com/vdudouyt/stm8flash
 $ cd stm8flash
 $ make

PATch "Tries exceeded" が出る場合
 /stm8flash.n> diff -u ./try.h.o ./try.h 
 --- ./try.h.o   2020-02-07 12:21:13.353322945 +0900
 +++ ./try.h     2020-03-04 12:09:55.582435796 +0900
 @@ -1,5 +1,5 @@
  #include "error.h"
 -
 +/*
  #define TRY(times, statement) do {             \
         int c = (times);                        \
         while(c > 0) {                          \
 @@ -11,6 +11,7 @@
                 ERROR("Tries exceeded");        \
         }                                       \
  } while(0)
 +*/
  
  /*
  #define TRY(times, statement) do {             \
 @@ -25,3 +26,16 @@
         } \
  } while(0)
  */
 +#define TRY(times, statement) do {             \
 +       int c = (times*10);                     \
 +       while(c > 0) {                          \
 +               usleep(3000);                   \
 +               usleep(10000);                  \
 +               if((statement)) break;          \
 +               c--;                            \
 +       } \
 +       if(!c) {                                \
 +               ERROR("Tries exceeded");        \
 +       } \
 +} while(0)
 +
 > 

 echo "00 00 ff 00 ff 00 ff 00 ff 00 ff" | xxd -r -p > factory_defaults.bin
 stm8flash -c stlinkv2 -p stm8s103f3 -s opt -w factory_defaults.bin

http://nekomemo2.site/?page=4&cid=53

! STVP-STM8
STM8FLASH でうまく行かないとき

! GIT
https://github.com/tenbaht/sduino

https://tenbaht.github.io/sduino/

!FORTH
8bit CPU と言えば forth

https://github.com/TG9541/stm8ef

のMINDEV で使えそう。。

 make BOARD=MINDEV
 make default
 ( stm8flash をインストールすること )

https://github.com/TG9541/stm8ef/wiki/STM8S-Value-Line-Gadgets

! arduino bord manager

https://github.com/tenbaht/sduino/raw/master/package_sduino_stm8_index.json

https://raw.githubusercontent.com/stm32duino/BoardManagerFiles/master/STM32/package_stm_index.json

! ピンアサイン

 +V  D3  D2  D1  C7  C6  C5  C4  C3  B4  B5 
 
                                        3V3
 USB    RST   TEST-LED-B5              SWIM
 PWR    BUT   PWR--LED                  GND
                                       NRST
 
 -V  D4  D5  D6  RST A1  A2  GND 5V  3V3 A3

 
,
,1 	,PD4 	,UART_CLK/T2-1/beep 	,13 	,PWM
,2 	,PD5 	,TX/Ain5 	,14 	,Analog A3
,3 	,PD6 	,RX/Ain6 	,15 	,Analog A4
,4      ,RST
,5 	,PA1 	,(OscIn/ no HS) 	,0 	
,6 	,PA2 	,(OscIn/ no HS) 	,1 	
,7      ,GND
,8      ,5v
,9      ,3V3
,10 	,PA3 	,SS/T2-3 	,2 	,PWM
,
,11 	,PB5 	,SDA LED 	,3 	
,12 	,PB4 	,SCL 	,4 	
,13 	,PC3 	,T1-3/[T1-n1] 	,5 	,PWM, (n~)
,14 	,PC4 	,T1-4/Ain2/[T1-n2] 	,6 	,PWM, Analog A0, (n~)
,15 	,PC5 	,SCK/[T2-1] 	,7 	,(~)
,16 	,PC6 	,MOSI/[T1-1] 	,8 	,(~)
,17 	,PC7 	,MISO/[T1-2] 	,9 	,(~)
,18 	,PD1 	,(SWIM) 	,10 	,
,19 	,PD2 	,Ain3/[T2-3] 	,11 	,Analog A1, (~~)
,20 	,PD3 	,Ain4/T2-2 	,12 	,PWM, Analo

! Tips
https://hackaday.io/page/2128-the-070-stm8-board

https://tenbaht.github.io/sduino/hardware/stm8blue/

http://nekomemo2.site/?eid=1383