Closed ceptimus closed 2 years ago
STC15W204S was marked as unsupported in source code. I don't have a STC15W204S so I can't test it locally, but I did test STC15W408AS before.
I just set the protocol of STC15W204S
to PROTOCOL_STC15B
-- you can pull and compile the latest code to see if it works.
Thanks very much for quick response.
It's better now, but still (I think) not quite right - it communicates and the erase option definitely worked - the program that was supplied in the chip no longer runs. It appears to then upload my hex file to the flash memory, but my code, which does run okay on a different STC15 chip (an STC15F2K60S2) (and is only 706 bytes) doesn't run on the STC15W204S - but maybe I have some settings wrong. I shall make further tests now and report back.
~/stc8prog/stc8prog -p /dev/ttyUSB0 -r 1 -f hourglass.ihx -d Loading hex file: Loaded 706 bytes between: 0000 to 02D6 02 00 21 32 00 00 00 00 00 00 00 32 00 00 00 00 00 00 00 32 00 00 00 00 00 00 00 02 01 7D 02 01 2B 75 81 22 12 02 D3 E5 82 60 03 02 00 1E 79 00 E9 44 00 60 1B 7A 00 90 02 D7 78 01 75 A0 00 E4 93 F2 A3 08 B8 00 02 05 A0 D9 F4 DA F2 75 A0 FF E4 78 FF F6 D8 FD 78 00 E8 44 00 60 0A 79 01 75 A0 00 E4 F3 09 D8 FC 78 00 E8 44 00 60 0C 79 00 90 00 01 E4 F0 A3 D8 FC D9 FA 75 20 09 75 10 00 75 11 01 75 12 03 75 13 06 75 14 07 02 00 1E E5 82 FF 24 C7 50 01 22 7E 00 75 21 0A 8E 22 8F 82 8E 83 C0 07 C0 06 12 02 9B AC 82 D0 06 D0 07 8C F0 05 F0 74 01 80 02 25 E0 D5 F0 FB FD 75 21 0A 75 22 00 8F 82 8E 83 C0 05 12 02 65 AE 82 D0 05 EE 24 FB 50 0D 8E 07 EF 24 FB 25 E0 FF 43 07 01 80 03 EE 2E FF E5 1F 60 0E EF 24 15 F9 EF 24 15 F8 86 06 ED 4E F7 22 EF 24 15 F9 EF 24 15 F8 86 07 ED F4 5F F7 22 AE 82 AF 83 7C 00 7D 00 C3 EC 9E ED 9F 50 15 7A 48 7B 06 00 1A BA FF 01 1B EA 4B 70 F6 0C BC 00 E7 0D 80 E4 22 75 91 3F 75 B1 CB C2 AF 75 89 20 75 8D 00 75 A8 88 43 88 40 D2 AF 7F 00 75 1F 00 8F 82 C0 07 12 00 8F D0 07 0F BF 39 00 40 EE 7F 00 75 1F 01 8F 82 C0 07 12 00 8F 90 03 E8 12 01 06 D0 07 75 1F 00 8F 82 C0 07 12 00 8F D0 07 0F BF 39 00 40 DC 80 D8 C0 E0 C0 F0 C0 D0 75 D0 08 E5 20 24 15 F9 87 0F 53 0F 3F 74 3F 6F FE E5 20 30 E0 04 8F 0D 80 02 8E 0D 75 92 00 75 91 3F 75 B2 00 75 B1 CB 8D 90 8F 92 8E 91 E5 20 C3 13 24 10 F9 87 0F 8F F0 05 F0 74 01 80 02 25 E0 D5 F0 FB FF 74 CB 6F FE E5 20 30 E0 04 8E 0D 80 02 8F 0D 8D B0 8F B2 8E B1 E5 20 70 05 75 20 09 80 02 15 20 D0 D0 D0 F0 D0 E0 32 E5 21 45 22 60 46 7A 01 E5 21 25 E0 F5 21 E5 22 33 40 12 F5 22 E5 82 95 21 E5 83 95 22 40 03 0A 80 E6 C3 E5 22 13 F5 22 E5 21 13 F5 21 C3 E5 82 95 21 F5 F0 E5 83 95 22 40 05 F5 83 85 F0 82 C3 E5 22 13 F5 22 E5 21 13 F5 21 DA E1 22 7A 10 E4 FB FC E5 82 25 E0 F5 82 E5 83 33 F5 83 EB 33 FB EC 33 FC EB 95 21 F5 F0 EC 95 22 40 06 FC AB F0 43 82 01 DA DD 22 C2 D5 E5 83 30 E7 0D D2 D5 E4 C3 95 82 F5 82 E4 95 83 F5 83 E5 22 30 E7 0B E4 C3 95 21 F5 21 E4 95 22 F5 22 12 01 EF 30 D5 0B E4 C3 95 82 F5 82 E4 95 83 F5 83 22 C2 D5 E5 83 30 E7 0D D2 D5 E4 C3 95 82 F5 82 E4 95 83 F5 83 E5 22 30 E7 0D B2 D5 E4 C3 95 21 F5 21 E4 95 22 F5 22 12 02 3C 30 D5 0B E4 C3 95 82 F5 82 E4 95 83 F5 83 22 75 82 00 22 Opening port /dev/ttyUSB0: done Reset MCU by pulling low dtr for 1 milliseconds Waiting for MCU: read 1 bytes: 0x46 | flag:1 read 2 bytes: 0xb9 | flag:2 0x68 | flag:3 read 2 bytes: 0x00 | flag:4 0x34 | sum:009C, count:46, index:0 flag:5 read 2 bytes: 0x50 | sum:00EC, index:1, count:46 flag:5 0x8f | sum:017B, index:2, count:46 flag:5 read 2 bytes: 0x43 | sum:01BE, index:3, count:46 flag:5 0x7a | sum:0238, index:4, count:46 flag:5 read 3 bytes: 0x9e | sum:02D6, index:5, count:46 flag:5 0xf7 | sum:03CD, index:6, count:46 flag:5 0xfa | sum:04C7, index:7, count:46 flag:5 read 2 bytes: 0x17 | sum:04DE, index:8, count:46 flag:5 0x00 | sum:04DE, index:9, count:46 flag:5 read 2 bytes: 0x5b | sum:0539, index:10, count:46 flag:5 0xa0 | sum:05D9, index:11, count:46 flag:5 read 2 bytes: 0x40 | sum:0619, index:12, count:46 flag:5 0xfd | sum:0716, index:13, count:46 flag:5 read 3 bytes: 0x27 | sum:073D, index:14, count:46 flag:5 0x55 | sum:0792, index:15, count:46 flag:5 0x00 | sum:0792, index:16, count:46 flag:5 read 2 bytes: 0x00 | sum:0792, index:17, count:46 flag:5 0x72 | sum:0804, index:18, count:46 flag:5 read 2 bytes: 0x54 | sum:0858, index:19, count:46 flag:5 0x00 | sum:0858, index:20, count:46 flag:5 read 2 bytes: 0xf5 | sum:094D, index:21, count:46 flag:5 0x14 | sum:0961, index:22, count:46 flag:5 read 2 bytes: 0x05 | sum:0966, index:23, count:46 flag:5 0x06 | sum:096C, index:24, count:46 flag:5 read 3 bytes: 0x70 | sum:09DC, index:25, count:46 flag:5 0x9e | sum:0A7A, index:26, count:46 flag:5 0x02 | sum:0A7C, index:27, count:46 flag:5 read 2 bytes: 0x1a | sum:0A96, index:28, count:46 flag:5 0x20 | sum:0AB6, index:29, count:46 flag:5 read 2 bytes: 0x21 | sum:0AD7, index:30, count:46 flag:5 0x23 | sum:0AFA, index:31, count:46 flag:5 read 2 bytes: 0x20 | sum:0B1A, index:32, count:46 flag:5 0x00 | sum:0B1A, index:33, count:46 flag:5 read 3 bytes: 0x14 | sum:0B2E, index:34, count:46 flag:5 0x10 | sum:0B3E, index:35, count:46 flag:5 0x04 | sum:0B42, index:36, count:46 flag:5 read 2 bytes: 0xea | sum:0C2C, index:37, count:46 flag:5 0xec | sum:0D18, index:38, count:46 flag:5 read 2 bytes: 0x9b | sum:0DB3, index:39, count:46 flag:5 0xff | sum:0EB2, index:40, count:46 flag:5 read 2 bytes: 0xff | sum:0FB1, index:41, count:46 flag:5 0xff | sum:10B0, index:42, count:46 flag:5 read 2 bytes: 0x21 | sum:10D1, index:43, count:46 flag:5 0x11 | sum:10E2, index:44, count:46 flag:5 read 3 bytes: 0x11 | sum:10F3, index:45, count:46 flag:5 0x11 | sum:1104, index:46, count:46 flag:6 0x11 | sum: 0x11 flag:7 read 2 bytes: 0x04 | sum check: 0x04 flag:8 0x16 | end byte reached flag:9 50 8F 43 7A 9E F7 FA 17 00 5B A0 40 FD 27 55 00 00 72 54 00 F5 14 05 06 70 9E 02 1A 20 21 23 20 00 14 10 04 EA EC 9B FF FF FF 21 11 11 11 detected MCU type: STC15W204S Protocol: STC15B F/W version: 7.2.5T IRC frequency(Hz): 6004800 Switching to 115200 baud, chip: TX: 46 B9 6A 00 0E 01 9E 40 FF CC 00 00 C3 03 E5 16 read 1 bytes: 0x46 | flag:1 read 2 bytes: 0xb9 | flag:2 0x68 | flag:3 read 2 bytes: 0x00 | flag:4 0x07 | sum:006F, count:1, index:0 flag:5 read 3 bytes: 0x01 | sum:0070, index:1, count:1 flag:6 0x00 | sum: 0x00 flag:7 0x70 | sum check: 0x70 flag:8 read 1 bytes: 0x16 | end byte reached flag:9 01 set, host: set, ping: TX: 46 B9 6A 00 0B 05 00 00 5A A5 01 79 16 read 9 bytes: 0x46 | flag:1 0xb9 | flag:2 0x68 | flag:3 0x00 | flag:4 0x07 | sum:006F, count:1, index:0 flag:5 0x05 | sum:0074, index:1, count:1 flag:6 0x00 | sum: 0x00 flag:7 0x74 | sum check: 0x74 flag:8 0x16 | end byte reached flag:9 05 succ Writing flash, size 727: 0.00%TX: 46 B9 6A 00 8B 22 00 00 5A A5 02 00 21 32 00 00 00 00 00 00 00 32 00 00 00 00 00 00 00 32 00 00 00 00 00 00 00 02 01 7D 02 01 2B 75 81 22 12 02 D3 E5 82 60 03 02 00 1E 79 00 E9 44 00 60 1B 7A 00 90 02 D7 78 01 75 A0 00 E4 93 F2 A3 08 B8 00 02 05 A0 D9 F4 DA F2 75 A0 FF E4 78 FF F6 D8 FD 78 00 E8 44 00 60 0A 79 01 75 A0 00 E4 F3 09 D8 FC 78 00 E8 44 00 60 0C 79 00 90 00 01 E4 F0 A3 D8 FC D9 FA 75 20 09 75 10 00 2D EA 16 read nothing read nothing read nothing read nothing read nothing read nothing read nothing read nothing read nothing read nothing TX: 46 B9 6A 00 8B 22 00 80 5A A5 75 11 01 75 12 03 75 13 06 75 14 07 02 00 1E E5 82 FF 24 C7 50 01 22 7E 00 75 21 0A 8E 22 8F 82 8E 83 C0 07 C0 06 12 02 9B AC 82 D0 06 D0 07 8C F0 05 F0 74 01 80 02 25 E0 D5 F0 FB FD 75 21 0A 75 22 00 8F 82 8E 83 C0 05 12 02 65 AE 82 D0 05 EE 24 FB 50 0D 8E 07 EF 24 FB 25 E0 FF 43 07 01 80 03 EE 2E FF E5 1F 60 0E EF 24 15 F9 EF 24 15 F8 86 06 ED 4E F7 22 EF 24 15 F9 EF 24 15 F8 86 37 CA 16 read nothing read nothing read nothing read nothing read nothing read nothing read nothing read nothing read nothing read nothing TX: 46 B9 6A 00 8B 22 01 00 5A A5 07 ED F4 5F F7 22 AE 82 AF 83 7C 00 7D 00 C3 EC 9E ED 9F 50 15 7A 48 7B 06 00 1A BA FF 01 1B EA 4B 70 F6 0C BC 00 E7 0D 80 E4 22 75 91 3F 75 B1 CB C2 AF 75 89 20 75 8D 00 75 A8 88 43 88 40 D2 AF 7F 00 75 1F 00 8F 82 C0 07 12 00 8F D0 07 0F BF 39 00 40 EE 7F 00 75 1F 01 8F 82 C0 07 12 00 8F 90 03 E8 12 01 06 D0 07 75 1F 00 8F 82 C0 07 12 00 8F D0 07 0F BF 39 00 40 DC 80 D8 C0 E0 C0 37 66 16 read nothing read nothing read nothing read nothing read nothing read nothing read nothing read nothing read nothing read nothing TX: 46 B9 6A 00 8B 22 01 80 5A A5 F0 C0 D0 75 D0 08 E5 20 24 15 F9 87 0F 53 0F 3F 74 3F 6F FE E5 20 30 E0 04 8F 0D 80 02 8E 0D 75 92 00 75 91 3F 75 B2 00 75 B1 CB 8D 90 8F 92 8E 91 E5 20 C3 13 24 10 F9 87 0F 8F F0 05 F0 74 01 80 02 25 E0 D5 F0 FB FF 74 CB 6F FE E5 20 30 E0 04 8E 0D 80 02 8F 0D 8D B0 8F B2 8E B1 E5 20 70 05 75 20 09 80 02 15 20 D0 D0 D0 F0 D0 E0 32 E5 21 45 22 60 46 7A 01 E5 21 25 E0 F5 21 E5 22 33 3D 87 16 read nothing read nothing read nothing read nothing read nothing read nothing read nothing read nothing read nothing read nothing TX: 46 B9 6A 00 8B 22 02 00 5A A5 40 12 F5 22 E5 82 95 21 E5 83 95 22 40 03 0A 80 E6 C3 E5 22 13 F5 22 E5 21 13 F5 21 C3 E5 82 95 21 F5 F0 E5 83 95 22 40 05 F5 83 85 F0 82 C3 E5 22 13 F5 22 E5 21 13 F5 21 DA E1 22 7A 10 E4 FB FC E5 82 25 E0 F5 82 E5 83 33 F5 83 EB 33 FB EC 33 FC EB 95 21 F5 F0 EC 95 22 40 06 FC AB F0 43 82 01 DA DD 22 C2 D5 E5 83 30 E7 0D D2 D5 E4 C3 95 82 F5 82 E4 95 83 F5 83 E5 22 30 E7 0B E4 C3 4A A2 16 read nothing read nothing read nothing read nothing read nothing read nothing read nothing read nothing read nothing read nothing TX: 46 B9 6A 00 62 22 02 80 5A A5 95 21 F5 21 E4 95 22 F5 22 12 01 EF 30 D5 0B E4 C3 95 82 F5 82 E4 95 83 F5 83 22 C2 D5 E5 83 30 E7 0D D2 D5 E4 C3 95 82 F5 82 E4 95 83 F5 83 E5 22 30 E7 0D B2 D5 E4 C3 95 21 F5 21 E4 95 22 F5 22 12 02 3C 30 D5 0B E4 C3 95 82 F5 82 E4 95 83 F5 83 22 75 82 00 22 32 58 16 read nothing read nothing read nothing read nothing read nothing read nothing read nothing read nothing read nothing read nothing done
I just tested with my STC15W408AS, with the hex from stc_diyclock.
I met the same problem if flashing without -e
option
milton:~/WorkC/stc8prog$ ./stc8prog -d -p /dev/ttyUSB0 -f clock-stc15w408as.hex
Loading hex file: Loaded 3871 bytes between: 0000 to 0F25
02 00 11 32 00 00 00 00 00 00 00 02 00 7B 02 02 5F 75 81 59 12 0E B6 E5 82 60 03 02 00 0E 79 00 E9 44 00 60 1B 7A 00 90
[...]
83 BD 92 C7 DC C8 88 89 8A B6 53 55 4E 00 4D 4F 4E 00 54 55 45 00 57 45 44 00 54 48 55 00 46 52 49 00 53 41 54 00
Opening port /dev/ttyUSB0: done
Waiting for MCU, please cycle power: read 3 bytes:
0x46 | flag:1
0xb9 | flag:2
0x68 | flag:3
read 2 bytes:
0x00 | flag:4
0x34 | sum:009C, count:46, index:0 flag:5
read 2 bytes:
0x50 | sum:00EC, index:1, count:46 flag:5
0x8a | sum:0176, index:2, count:46 flag:5
read 2 bytes:
0xc5 | sum:023B, index:3, count:46 flag:5
0x71 | sum:02AC, index:4, count:46 flag:5
read 2 bytes:
0x98 | sum:0344, index:5, count:46 flag:5
0xf5 | sum:0439, index:6, count:46 flag:5
read 3 bytes:
0x7b | sum:04B4, index:7, count:46 flag:5
0x9f | sum:0553, index:8, count:46 flag:5
0xff | sum:0652, index:9, count:46 flag:5
read 2 bytes:
0xff | sum:0751, index:10, count:46 flag:5
0xff | sum:0850, index:11, count:46 flag:5
read 2 bytes:
0xff | sum:094F, index:12, count:46 flag:5
0xff | sum:0A4E, index:13, count:46 flag:5
read 2 bytes:
0x27 | sum:0A75, index:14, count:46 flag:5
0x1e | sum:0A93, index:15, count:46 flag:5
read 3 bytes:
0x06 | sum:0A99, index:16, count:46 flag:5
0x00 | sum:0A99, index:17, count:46 flag:5
0x72 | sum:0B0B, index:18, count:46 flag:5
read 2 bytes:
0x54 | sum:0B5F, index:19, count:46 flag:5
0x00 | sum:0B5F, index:20, count:46 flag:5
read 2 bytes:
0xf5 | sum:0C54, index:21, count:46 flag:5
0x1f | sum:0C73, index:22, count:46 flag:5
read 2 bytes:
0x05 | sum:0C78, index:23, count:46 flag:5
0x06 | sum:0C7E, index:24, count:46 flag:5
read 2 bytes:
0x70 | sum:0CEE, index:25, count:46 flag:5
0x98 | sum:0D86, index:26, count:46 flag:5
read 3 bytes:
0x02 | sum:0D88, index:27, count:46 flag:5
0x0e | sum:0D96, index:28, count:46 flag:5
0x14 | sum:0DAA, index:29, count:46 flag:5
read 2 bytes:
0x16 | sum:0DC0, index:30, count:46 flag:5
0x18 | sum:0DD8, index:31, count:46 flag:5
read 2 bytes:
0x1c | sum:0DF4, index:32, count:46 flag:5
0x00 | sum:0DF4, index:33, count:46 flag:5
read 2 bytes:
0x34 | sum:0E28, index:34, count:46 flag:5
0x20 | sum:0E48, index:35, count:46 flag:5
read 3 bytes:
0x04 | sum:0E4C, index:36, count:46 flag:5
0xdc | sum:0F28, index:37, count:46 flag:5
0xf8 | sum:1020, index:38, count:46 flag:5
read 2 bytes:
0x71 | sum:1091, index:39, count:46 flag:5
0xbf | sum:1150, index:40, count:46 flag:5
read 2 bytes:
0xff | sum:124F, index:41, count:46 flag:5
0xff | sum:134E, index:42, count:46 flag:5
read 2 bytes:
0x21 | sum:136F, index:43, count:46 flag:5
0x11 | sum:1380, index:44, count:46 flag:5
read 3 bytes:
0x19 | sum:1399, index:45, count:46 flag:5
0x41 | sum:13DA, index:46, count:46 flag:6
0x13 | sum: 0x13 flag:7
read 2 bytes:
0xda | sum check: 0xDA flag:8
0x16 | end byte reached flag:9
50 8A C5 71 98 F5 7B 9F FF FF FF FF FF 27 1E 06 00 72 54 00 F5 1F 05 06 70 98 02 0E 14 16 18 1C 00 34 20 04 DC F8 71 BF FF FF 21 11 19 41
detected
MCU type: STC15W408AS
Protocol: STC15B
F/W version: 7.2.5T
IRC frequency(Hz): unadjusted
Switching to 115200 baud, chip: TX: 46 B9 6A 00 0E 01 98 40 FF CC 00 00 C3 03 DF 16
read 1 bytes:
0x46 | flag:1
read 2 bytes:
0xb9 | flag:2
0x68 | flag:3
read 2 bytes:
0x00 | flag:4
0x07 | sum:006F, count:1, index:0 flag:5
read 3 bytes:
0x01 | sum:0070, index:1, count:1 flag:6
0x00 | sum: 0x00 flag:7
0x70 | sum check: 0x70 flag:8
read 1 bytes:
0x16 | end byte reached flag:9
01
set, host: set, ping: TX: 46 B9 6A 00 0B 05 00 00 5A A5 01 79 16
read 9 bytes:
0x46 | flag:1
0xb9 | flag:2
0x68 | flag:3
0x00 | flag:4
0x07 | sum:006F, count:1, index:0 flag:5
0x05 | sum:0074, index:1, count:1 flag:6
0x00 | sum: 0x00 flag:7
0x74 | sum check: 0x74 flag:8
0x16 | end byte reached flag:9
05
succ
Writing flash, size 3878: 0.00%TX: 46 B9 6A 00 8B 22 00 00 5A A5 02 00 11 32 00 00 00 00 00 00 00 02 00 7B 02 02 5F 75 81 59 12 0E B6 E5 82 60 03 02 00 0E 79 00 E9 44 00 60 1B 7A 00 90 0F 26 78 01 75 A0 00 E4 93 F2 A3 08 B8 00 02 05 A0 D9 F4 DA F2 75 A0 FF E4 78 FF F6 D8 FD 78 00 E8 44 00 60 0A 79 01 75 A0 00 E4 F3 09 D8 FC 78 00 E8 44 00 60 0C 79 00 90 00 01 E4 F0 A3 D8 FC D9 FA 75 45 00 75 46 00 75 47 00 75 4E 00 D2 10 02 00 0E C0 E0 C0 F0 C0 33 ED 16
read nothing
read nothing
read nothing
read nothing
read nothing
read nothing
read nothing
read nothing
read nothing
read nothing
TX: 46 B9 6A 00 8B 22 00 80 5A A5 D0 75 D0 08 7F 00 74 03 55 3B FE 43 B0 3C 85 3A F0 E5 3B 84 AD F0 BD 04 00 50 17 EE 24 34 F9 87 A0 8E F0 05 F0 74 04 80 02 25 E0 D5 F0 FB F4 FE 52 B0 05 3B 74 64 B5 3C 02 80 03 02 01 A9 75 3C 00 05 3D E5 4E 60 0B 74 01 25 41 F5 41 E4 35 42 F5 42 74 0A B5 3D 3D 75 3D 00 B2 06 D2 07 05 3E 74 01 25 3F F5 3F E4 35 40 F5 40 74 05 B5 3E 24 75 3E 00 B2 05 74 14 B5 3F 06 E4 B5 40 02 80 02 36 1F 16
read nothing
read nothing
read nothing
read nothing
read nothing
read nothing
read nothing
read nothing
read nothing
read nothing
TX: 46 B9 6A 00 8B 22 01 00 5A A5 80 05 E4 F5 3F F5 40 C3 E5 3F 94 05 E5 40 64 80 94 80 92 04 E5 52 25 E0 FE A2 B1 E4 33 4E F5 52 E5 52 70 0D D2 12 20 11 17 E5 54 FE 04 F5 54 80 0F 30 12 0C 20 11 02 7F 01 C2 12 C2 11 75 54 00 E5 54 24 AF 50 07 D2 11 75 54 00 7F 02 E5 53 25 E0 FE A2 B0 E4 33 FD 4E F5 53 E5 53 70 0D D2 14 20 13 17 E5 55 FE 04 F5 55 80 0F 30 14 0C 20 13 02 7F 03 C2 14 C2 13 75 55 00 E5 55 24 AF 50 07 37 5A 16
read nothing
read nothing
read nothing
read nothing
read nothing
read nothing
read nothing
read nothing
read nothing
read nothing
TX: 46 B9 6A 00 8B 22 01 80 5A A5 D2 13 75 55 00 7F 04 BF 02 0C 30 14 09 D2 13 75 55 00 7F 05 80 0D BF 04 0A 30 12 07 D2 11 75 54 00 7F 05 E5 56 70 02 8F 56 05 3C E5 43 45 44 60 16 15 43 74 FF B5 43 02 15 44 E5 43 45 44 70 07 E5 56 70 03 75 56 06 D0 D0 D0 F0 D0 E0 32 75 8A A4 75 8C FF C2 8D D2 8C D2 A9 D2 AF 22 AE 82 AF 83 8E 04 8F 05 EE 2E FE EF 33 FF EE 2E FE EF 33 FF 30 60 06 EE 2E FE EF 33 FF EC 2E FE ED 3F FF 3C 6A 16
read nothing
read nothing
read nothing
read nothing
read nothing
read nothing
read nothing
read nothing
read nothing
read nothing
TX: 46 B9 6A 00 8B 22 02 00 5A A5 30 60 08 7C B3 7D 1A 7B 20 80 06 7C C9 7D 0E 7B 00 C3 EE 9C EF 9D 50 0B 0B EC 24 CE FC ED 34 FF FD 80 EE E5 2E 54 07 2B 24 FC F5 82 22 20 37 16 30 61 06 30 04 03 20 06 04 7F 00 80 02 7F 01 EF 24 FF 92 15 80 0A 30 61 07 30 04 04 A2 06 92 15 30 15 02 D2 03 22 E5 82 25 4B D4 F5 82 22 22 43 91 C0 43 92 C0 12 0B 33 12 0A 51 12 01 CE 10 07 02 80 FB AF 56 75 56 00 E5 38 54 03 70 27 75 82 30 F1 16
[...]
read nothing
read nothing
read nothing
read nothing
read nothing
read nothing
read nothing
read nothing
read nothing
read nothing
done
But if flashing with -e
, it seems working
milton:~/WorkC/stc8prog$ ./stc8prog -d -p /dev/ttyUSB0 -e -f clock-stc15w408as.hex
Loading hex file: Loaded 3871 bytes between: 0000 to 0F25
02 00 11 32 00 00 00 00 00 00 00 02 00 7B 02 02 5F 75 81 59 12 0E B6 E5 82 60 03 02 00 0E 79 00 E9 44 00 60 1B 7A 00 90 F5 F0 EC 95 59 40 06 FC AB F0 43 82 01 DA DD 22 C2 D5 E5 83 30 E7 0D D2 D5 E4 C3 95 82 F5 82 E4 95 83 F5 83 E5 59 30 E7 0B E4 C3 95 58 F5 58 E4 95 59 F5 59 12 0D D2 30 D5 0B E4 C3 95 82 F5 82 E4 95 83 F5 83 22 C2 D5 E5 83 30 E7 0D D2 D5 E4
[...]
E4 95 83 F5 83 22 75 82 00 22 C0 F9 A4 B0 99 92 82 F8 80 90 FF BF 8B 7F 88 83 C6 A1 86 8E C2 8B FB E1 8A C7 C8 AB A3 8C 98 AF 92 F8 E3 C1 81 89 91 B6 C0 CF A4 86 8B 92 90 C7 80 82 FF BF 99 7F 81 98 F0 8C B0 B1 D0 99 DF CC 91 F8 C1 9D 9C A1 83 BD 92 C7 DC C8 88 89 8A B6 53 55 4E 00 4D 4F 4E 00 54 55 45 00 57 45 44 00 54 48 55 00 46 52 49 00 53 41 54 00
Opening port /dev/ttyUSB0: done
Waiting for MCU, please cycle power: read 3 bytes:
0x46 | flag:1
0xb9 | flag:2
0x68 | flag:3
read 2 bytes:
0x00 | flag:4
0x34 | sum:009C, count:46, index:0 flag:5
read 2 bytes:
0x50 | sum:00EC, index:1, count:46 flag:5
0x8a | sum:0176, index:2, count:46 flag:5
read 2 bytes:
0xc5 | sum:023B, index:3, count:46 flag:5
0x71 | sum:02AC, index:4, count:46 flag:5
read 3 bytes:
0x98 | sum:0344, index:5, count:46 flag:5
0xf5 | sum:0439, index:6, count:46 flag:5
0x7b | sum:04B4, index:7, count:46 flag:5
read 2 bytes:
0x9f | sum:0553, index:8, count:46 flag:5
0xff | sum:0652, index:9, count:46 flag:5
read 2 bytes:
0xff | sum:0751, index:10, count:46 flag:5
0xff | sum:0850, index:11, count:46 flag:5
read 2 bytes:
0xff | sum:094F, index:12, count:46 flag:5
0xff | sum:0A4E, index:13, count:46 flag:5
read 2 bytes:
0x27 | sum:0A75, index:14, count:46 flag:5
0x19 | sum:0A8E, index:15, count:46 flag:5
read 3 bytes:
0x00 | sum:0A8E, index:16, count:46 flag:5
0x00 | sum:0A8E, index:17, count:46 flag:5
0x72 | sum:0B00, index:18, count:46 flag:5
read 2 bytes:
0x54 | sum:0B54, index:19, count:46 flag:5
0x00 | sum:0B54, index:20, count:46 flag:5
read 2 bytes:
0xf5 | sum:0C49, index:21, count:46 flag:5
0x1f | sum:0C68, index:22, count:46 flag:5
read 2 bytes:
0x05 | sum:0C6D, index:23, count:46 flag:5
0x06 | sum:0C73, index:24, count:46 flag:5
read 2 bytes:
0x70 | sum:0CE3, index:25, count:46 flag:5
0x98 | sum:0D7B, index:26, count:46 flag:5
read 3 bytes:
0x02 | sum:0D7D, index:27, count:46 flag:5
0x0e | sum:0D8B, index:28, count:46 flag:5
0x14 | sum:0D9F, index:29, count:46 flag:5
read 2 bytes:
0x16 | sum:0DB5, index:30, count:46 flag:5
0x18 | sum:0DCD, index:31, count:46 flag:5
read 2 bytes:
0x1c | sum:0DE9, index:32, count:46 flag:5
0x00 | sum:0DE9, index:33, count:46 flag:5
read 2 bytes:
0x34 | sum:0E1D, index:34, count:46 flag:5
0x20 | sum:0E3D, index:35, count:46 flag:5
read 3 bytes:
0x04 | sum:0E41, index:36, count:46 flag:5
0xdc | sum:0F1D, index:37, count:46 flag:5
0xf8 | sum:1015, index:38, count:46 flag:5
read 2 bytes:
0x71 | sum:1086, index:39, count:46 flag:5
0xbf | sum:1145, index:40, count:46 flag:5
read 2 bytes:
0xff | sum:1244, index:41, count:46 flag:5
0xff | sum:1343, index:42, count:46 flag:5
read 2 bytes:
0x21 | sum:1364, index:43, count:46 flag:5
0x11 | sum:1375, index:44, count:46 flag:5
read 3 bytes:
0x19 | sum:138E, index:45, count:46 flag:5
0x41 | sum:13CF, index:46, count:46 flag:6
0x13 | sum: 0x13 flag:7
read 2 bytes:
0xcf | sum check: 0xCF flag:8
0x16 | end byte reached flag:9
50 8A C5 71 98 F5 7B 9F FF FF FF FF FF 27 19 00 00 72 54 00 F5 1F 05 06 70 98 02 0E 14 16 18 1C 00 34 20 04 DC F8 71 BF FF FF 21 11 19 41
detected
MCU type: STC15W408AS
Protocol: STC15B
F/W version: 7.2.5T
IRC frequency(Hz): unadjusted
Switching to 115200 baud, chip: TX: 46 B9 6A 00 0E 01 98 40 FF CC 00 00 C3 03 DF 16
read 1 bytes:
0x46 | flag:1
read 2 bytes:
0xb9 | flag:2
0x68 | flag:3
read 2 bytes:
0x00 | flag:4
0x07 | sum:006F, count:1, index:0 flag:5
read 3 bytes:
0x01 | sum:0070, index:1, count:1 flag:6
0x00 | sum: 0x00 flag:7
0x70 | sum check: 0x70 flag:8
read 1 bytes:
0x16 | end byte reached flag:9
01
set, host: set, ping: TX: 46 B9 6A 00 0B 05 00 00 5A A5 01 79 16
read 9 bytes:
0x46 | flag:1
0xb9 | flag:2
0x68 | flag:3
0x00 | flag:4
0x07 | sum:006F, count:1, index:0 flag:5
0x05 | sum:0074, index:1, count:1 flag:6
0x00 | sum: 0x00 flag:7
0x74 | sum check: 0x74 flag:8
0x16 | end byte reached flag:9
05
succ
Erasing chip: TX: 46 B9 6A 00 0B 03 00 00 5A A5 01 77 16
read 16 bytes:
0x46 | flag:1
0xb9 | flag:2
0x68 | flag:3
0x00 | flag:4
0x0e | sum:0076, count:8, index:0 flag:5
0x03 | sum:0079, index:1, count:8 flag:5
0xf5 | sum:016E, index:2, count:8 flag:5
0x1f | sum:018D, index:3, count:8 flag:5
0xc4 | sum:0251, index:4, count:8 flag:5
0xc1 | sum:0312, index:5, count:8 flag:5
0x0b | sum:031D, index:6, count:8 flag:5
0x62 | sum:037F, index:7, count:8 flag:5
0xc2 | sum:0441, index:8, count:8 flag:6
0x04 | sum: 0x04 flag:7
0x41 | sum check: 0x41 flag:8
0x16 | end byte reached flag:9
03 F5 1F C4 C1 0B 62 C2
succ
Writing flash, size 3878: 0.00%TX: 46 B9 6A 00 8B 22 00 00 5A A5 02 00 11 32 00 00 00 00 00 00 00 02 00 7B 02 02 5F 75 81 59 12 0E B6 E5 82 60 03 02 00 0E 79 00 E9 44 00 60 1B 7A 00 90 0F 26 78 01 75 A0 00 E4 93 F2 A3 08 B8 00 02 05 A0 D9 F4 DA F2 75 A0 FF E4 78 FF F6 D8 FD 78 00 E8 44 00 60 0A 79 01 75 A0 00 E4 F3 09 D8 FC 78 00 E8 44 00 60 0C 79 00 90 00 01 E4 F0 A3 D8 FC D9 FA 75 45 00 75 46 00 75 47 00 75 4E 00 D2 10 02 00 0E C0 E0 C0 F0 C0 33 ED 16
read nothing
read nothing
read nothing
read 10 bytes:
0x46 | flag:1
0xb9 | flag:2
0x68 | flag:3
0x00 | flag:4
0x08 | sum:0070, count:2, index:0 flag:5
0x02 | sum:0072, index:1, count:2 flag:5
0x54 | sum:00C6, index:2, count:2 flag:6
0x00 | sum: 0x00 flag:7
0xc6 | sum check: 0xC6 flag:8
0x16 | end byte reached flag:9
02 54
3.30%TX: 46 B9 6A 00 8B 02 00 80 5A A5 D0 75 D0 08 7F 00 74 03 55 3B FE 43 B0 3C 85 3A F0 E5 3B 84 AD F0 BD 04 00 50 17 EE 24 34 F9 87 A0 8E F0 05 F0 74 04 80 02 25 E0 D5 F0 FB F4 FE 52 B0 05 3B 74 64 B5 3C 02 80 03 02 01 A9 75 3C 00 05 3D E5 4E 60 0B 74 01 25 41 F5 41 E4 35 42 F5 42 74 0A B5 3D 3D 75 3D 00 B2 06 D2 07 05 3E 74 01 25 3F F5 3F E4 35 40 F5 40 74 05 B5 3E 24 75 3E 00 B2 05 74 14 B5 3F 06 E4 B5 40 02 80 02 35 FF 16
[...]
read nothing
read nothing
read 10 bytes:
0x46 | flag:1
0xb9 | flag:2
0x68 | flag:3
0x00 | flag:4
0x08 | sum:0070, count:2, index:0 flag:5
0x02 | sum:0072, index:1, count:2 flag:5
0x54 | sum:00C6, index:2, count:2 flag:6
0x00 | sum: 0x00 flag:7
0xc6 | sum check: 0xC6 flag:8
0x16 | end byte reached flag:9
02 54
99.02%TX: 46 B9 6A 00 31 02 0F 00 5A A5 83 BD 92 C7 DC C8 88 89 8A B6 53 55 4E 00 4D 4F 4E 00 54 55 45 00 57 45 44 00 54 48 55 00 46 52 49 00 53 41 54 00 0E A1 16
read nothing
read 10 bytes:
0x46 | flag:1
0xb9 | flag:2
0x68 | flag:3
0x00 | flag:4
0x08 | sum:0070, count:2, index:0 flag:5
0x02 | sum:0072, index:1, count:2 flag:5
0x54 | sum:00C6, index:2, count:2 flag:6
0x00 | sum: 0x00 flag:7
0xc6 | sum check: 0xC6 flag:8
0x16 | end byte reached flag:9
02 54
100.00% done
I guess -e
option is required when flashing this type?
Thanks. Adding the -e option works for my STC15W204S too.
I'd previously tried running stc8prog first with just the -e option, and then again with just the -f option. The -e option alone does erase any existing program in the chip, but then the -f option alone doesn't succeed in flashing a new program to the erased chip. Combining both the -e and -f options together works correctly.
I'm probably doing something wrong, but I don't know what.
System: Kernel: 5.4.0-120-generic x86_64 bits: 64 compiler: gcc v: 9.4.0 Desktop: Cinnamon 5.2.7 wm: muffin dm: LightDM Distro: Linux Mint 20.3 Una base: Ubuntu 20.04 focal Interface: genuine FTDI that works okay with other STC microcontrollers (and ATMEL chips, etc)
./stc8prog -p /dev/ttyUSB0 -d Opening port /dev/ttyUSB0: done Waiting for MCU, please cycle power: read 1 bytes: 0x46 | flag:1 read 4 bytes: 0xb9 | flag:2 0x68 | flag:3 0x00 | flag:4 0x34 | sum:009C, count:46, index:0 flag:5 read 3 bytes: 0x50 | sum:00EC, index:1, count:46 flag:5 0x8f | sum:017B, index:2, count:46 flag:5 0x43 | sum:01BE, index:3, count:46 flag:5 read 3 bytes: 0x7a | sum:0238, index:4, count:46 flag:5 0x9e | sum:02D6, index:5, count:46 flag:5 0xf7 | sum:03CD, index:6, count:46 flag:5 read 4 bytes: 0xba | sum:0487, index:7, count:46 flag:5 0x9f | sum:0526, index:8, count:46 flag:5 0x00 | sum:0526, index:9, count:46 flag:5 0x5b | sum:0581, index:10, count:46 flag:5 read 3 bytes: 0xa0 | sum:0621, index:11, count:46 flag:5 0x40 | sum:0661, index:12, count:46 flag:5 0xfd | sum:075E, index:13, count:46 flag:5 read 4 bytes: 0x27 | sum:0785, index:14, count:46 flag:5 0x46 | sum:07CB, index:15, count:46 flag:5 0x00 | sum:07CB, index:16, count:46 flag:5 0x00 | sum:07CB, index:17, count:46 flag:5 read 3 bytes: 0x72 | sum:083D, index:18, count:46 flag:5 0x54 | sum:0891, index:19, count:46 flag:5 0x00 | sum:0891, index:20, count:46 flag:5 read 4 bytes: 0xf5 | sum:0986, index:21, count:46 flag:5 0x14 | sum:099A, index:22, count:46 flag:5 0x05 | sum:099F, index:23, count:46 flag:5 0x06 | sum:09A5, index:24, count:46 flag:5 read 3 bytes: 0x70 | sum:0A15, index:25, count:46 flag:5 0x9e | sum:0AB3, index:26, count:46 flag:5 0x02 | sum:0AB5, index:27, count:46 flag:5 read 4 bytes: 0x1a | sum:0ACF, index:28, count:46 flag:5 0x20 | sum:0AEF, index:29, count:46 flag:5 0x21 | sum:0B10, index:30, count:46 flag:5 0x23 | sum:0B33, index:31, count:46 flag:5 read 3 bytes: 0x20 | sum:0B53, index:32, count:46 flag:5 0x00 | sum:0B53, index:33, count:46 flag:5 0x14 | sum:0B67, index:34, count:46 flag:5 read 4 bytes: 0x10 | sum:0B77, index:35, count:46 flag:5 0x04 | sum:0B7B, index:36, count:46 flag:5 0xea | sum:0C65, index:37, count:46 flag:5 0xec | sum:0D51, index:38, count:46 flag:5 read 3 bytes: 0x9e | sum:0DEF, index:39, count:46 flag:5 0xff | sum:0EEE, index:40, count:46 flag:5 0xff | sum:0FED, index:41, count:46 flag:5 read 4 bytes: 0xff | sum:10EC, index:42, count:46 flag:5 0x21 | sum:110D, index:43, count:46 flag:5 0x11 | sum:111E, index:44, count:46 flag:5 0x11 | sum:112F, index:45, count:46 flag:5 read 3 bytes: 0x11 | sum:1140, index:46, count:46 flag:6 0x11 | sum: 0x11 flag:7 0x40 | sum check: 0x40 flag:8 read 1 bytes: 0x16 | end byte reached flag:9 50 8F 43 7A 9E F7 BA 9F 00 5B A0 40 FD 27 46 00 00 72 54 00 F5 14 05 06 70 9E 02 1A 20 21 23 20 00 14 10 04 EA EC 9E FF FF FF 21 11 11 11 detected MCU type: STC15W204S Protocol: unsupported protocol: 0000