grigorig / stcgal

Open Source STC MCU ISP flash tool
678 stars 140 forks source link

Flash STC8G1K08 error in stcgal 1.10 #107

Closed qiwenmin closed 1 month ago

qiwenmin commented 1 month ago
$ pio run -e STC8G1K08 -t upload
Processing STC8G1K08 (board: STC8G1K08; platform: intel_mcs51)
------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/intel_mcs51/STC8G1K08.html
PLATFORM: Intel MCS-51 (8051) (2.2.0) > Generic STC8G1K08
HARDWARE: STC8G1K08 6MHz, 1.25KB RAM, 8KB Flash
PACKAGES:
 - tool-stcgal @ 1.110.0 (1.10)
 - tool-vnproch55x @ 1.0.220407
 - toolchain-sdcc @ 1.40400.0 (4.4.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/STC8G1K08/src/main.rel
Linking .pio/build/STC8G1K08/firmware.hex
Checking size .pio/build/STC8G1K08/firmware.hex
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
Flash: [          ]   1.8% (used 151 bytes from 8192 bytes)
Configuring upload protocol...
AVAILABLE: stcgal
CURRENT: upload_protocol = stcgal
Looking for upload port...
Auto-detected: /dev/cu.wchusbserial1410
Uploading .pio/build/STC8G1K08/firmware.hex
Cycling power: done
<- Packet data: 46 B9 68 00 38 50 00 A8 C9 60 85 01 02 FF FF BF BF FF 27 0B F7 20 73 55 00 F7 54 0C 86 AB 84 AC 0D 1D 1F FF 00 30 00 20 04 A5 22 05 25 11 FF 56 0F 35 5E 76 90 BB BB 14 9E 16
Waiting for MCU: done
Target model:
  Name: STC8G1K08-20/16PIN
  Magic: F754
  Code flash: 8.0 KB
  EEPROM flash: 4.0 KB
Target frequency: 11.062 MHz
Target BSL version: 7.3.12U
Target wakeup frequency: 34.475 KHz
Target ref. voltage: 1189 mV
Target mfg. date: 2022-05-25
Target options:
  reset_pin_enabled=False
  clock_gain=high
  watchdog_por_enabled=False
  watchdog_stop_idle=True
  watchdog_prescale=256
  low_voltage_reset=True
  low_voltage_threshold=0
  eeprom_erase_enabled=True
  bsl_pindetect_enabled=False
  por_reset_delay=long
  rstout_por_state=high
  uart1_remap=False
  uart2_passthrough=True
  uart2_pin_mode=push-pull
  epwm_open_drain=True
  program_eeprom_split=8192
Loading flash: 151 bytes (Intel HEX)
-> Packet data: 46 B9 6A 00 20 00 0C 00 00 17 00 2E 00 45 00 5C 00 73 00 8A 00 A1 00 B8 00 CF 00 E6 00 FF 00 06 86 16
<- Packet data: 46 B9 68 00 20 00 0C 19 79 1B 6B 1D 3C 1F 16 20 FC 22 D0 24 6E 26 39 28 07 29 C9 2B 88 2D 71 07 AB 16
-> Packet data: 46 B9 6A 00 20 00 0C AB 00 AC 00 AD 00 AB 01 AC 01 AD 01 AB 02 AC 02 AD 02 AB 03 AC 03 AD 03 08 B8 16
<- Packet data: 46 B9 68 00 20 00 0C 26 F9 27 0B 27 1D 26 FC 27 1A 27 20 27 02 27 17 27 2F 27 08 27 1A 27 32 05 59 16
Trimming frequency: 5.986 MHz
-> Packet data: 46 B9 6A 00 0E 01 00 00 FF 64 00 AB 80 03 07 16
<- Packet data: 46 B9 68 00 07 01 00 70 16
-> Packet data: 46 B9 6A 00 0B 05 00 00 5A A5 01 79 16
<- Packet data: 00
Protocol error: incorrect frame start
-> Packet data: 46 B9 6A 00 07 FF 01 70 16
Switching to 38400 baud: Disconnected!
*** [upload] Error 1
qiwenmin commented 1 month ago

This issue is cause by platformio boards defination (it uses stc8 as the stcgal_protocol). Using custom board file and specifying stcgal_protocol to stc8g, the issue is resolved.