Sorry for the duplicated information in this thread, but it is current.
It is typical that the 4 wire SWIM programmer interface is rarely 1:1, always verify the positions of the signals. Equally important is Vdd which is determined by looking at the voltage regulator part number on the top side. The W1209 has an AMS1117-5.0 which is normally powered from 12 volt (15 volt max on datasheet but HC specs rule) external screw terminals.
It is usually safe to program by back-feeding at the rated voltage, but be warned. The STLINK-V2 power should be on the 5 volt pin for this board. Only one power source at a time can be used. The voltage regulator requires a minimum of 6.5 volts plus the 0.7 volt diode drop so external power at the screw terminals should be a minimum of 7.2 volts.
I have traced the 4 pin header from top to bottom, located to the left of the LED.
Pin 4 is the GND at the board edge.
Pin 3 goes to pin 4 , ic STM8S003F TSSOP20 = NRST Reset
Pin 2 goes to pin 18, ic STM8S003F TSSOP20 = PD1/SWIM Interface to Debug or Programming
Pin 1 goes to +5.0 Vdc. Designated as square pad.
Checkout the HCDVBD0034 forum for details on installing the stm8flash burning utility.
On a Pi 3 or Pi Zero W: note the W1209 blaster part designation stm8s003?3 and the question mark and the dash small letter L for list below.
Code: Select all
./stm8flash -l | grep stm8s003
... stm8s003?3 ...
\ If you get programming errors then the next two lines must be run once.
echo "00 00 ff 00 ff 00 ff 00 ff 00 ff" | xxd -r -p > factory_defaults.bin
sudo ./stm8flash -c stlinkv2 -p stm8s003?3 -s opt -w factory_defaults.bin
sudo ./stm8flash -c stlinkv2 -p stm8s003?3 -s flash -w /home/pi/Downloads/out/W1209-FD/W1209-FD.ihx
In a few seconds the LED should display 4th
meaning eForth is running - celebrate now! A convenient ground for the PL2303 UART dongle is by the top edge of the programming header. RxD is either pin at the top of the +
button and TxD is the same on the -
button. The bottoms of the switches are all common ground. I have it working using picocom at 9600/N81
Thanks Thomas, great work!
https://github.com/TG9541/stm8ef/wiki/B ... e-key-pins
: sq DUP * . ;
: w WORDS ;
4 sq 16 ok
w sq IRET SAVEC RESET RAM NVM LOCKF ULOCKF LOCK ULOCK ADC@ ADC! ?KEYB P7S E7S WORDS .S DUMP ALLOT VARIABLE CREATE DOES> ] IMMEDIATE : ; OVERT ." $" ABORT" AFT REPEAT WHILE AHEAD ELSE THEN IF AGAIN UNTIL BEGIN +LOOP LOOP DO NEXT FOR $," COMPILE [COMPILE] LITERAL CALL, C, , ' [ NAME> \ ( .( ? . U. TYPE U.R .R CR SPACES SPACE NUF? KEY DECIMAL HEX str #> SIGN #S # HOLD <# DIGIT PACK$ ERASE FILL CMOVE @EXECUTE PAD HERE COUNT +! DEPTH PICK 0= ABS NEGATE NOT 1+ 1- 2+ 2- 2* 2/ EXG */ */MOD M* * UM* / MOD /MOD M/MOD UM/MOD WITHIN MIN MAX < U< = DNEGATE 2DUP ROT ?DUP FILE HAND BG TIM BL OUT last '?KEY 'EMIT hld BASE - 0< OR AND XOR + UM+ OVER SWAP DUP 2DROP DROP NIP >R R@ R> I C! C@ ! @ B! 2C@ 2C! 2@ 2! EXIT EXECUTE LEAVE EMIT ?KEY TX! ?RX hi 'BOOT BKEY OUT! COLD ok
cold \erases words except those added during NVM / RAM non-volatile memory (flash) mode.
reset \erases all
Note the relay coil is 12 volt and will not activate at 5 volt but the LED will light.
\ activate the relay 63 mA @ 12 volt external power in through the screw terminals
\ deactivate the relay 11 mA @ 12 volt