关于stc12c5a60s2在擦写过程中报错的问题
diggzhang opened this issue · 1 comments
使用stcflash可以正常读出芯片数据
$ python stcflash.py
Connect to /dev/ttyUSB0 at baudrate 2400
Detecting target... done
FOSC: 12.056MHz
Model: STC12C5A60S2 (ver6.2I)
ROM: 60KB
可是在烧录程序时候却发生如下错误
$ python stcflash.py foo.bin
Connect to /dev/ttyUSB0 at baudrate 2400
Detecting target... done
FOSC: 12.052MHz
Model: STC12C5A60S2 (ver6.2I)
ROM: 60KB
Baudrate: 57600
Erasing target...Traceback (most recent call last):
File "stcflash.py", line 578, in
main()
File "stcflash.py", line 574, in main
program(Programmer(conn, protocol), code)
File "stcflash.py", line 455, in program
prog.erase()
File "stcflash.py", line 362, in erase
cmd, dat = self.recv()
File "stcflash.py", line 180, in recv
raise IOError()
IOError
经查,是因为本款芯片ROM过大导致,而原程序timeout时间为1s,擦写时间不足,所以引发报错。
解决方案:
修改源程序第170行,增加timeout时间,这里设置为5s
170 def recv(self, timeout = 5, start = [0x46, 0xB9, 0x68]):
171 timeout += time.time()
172 while time.time() < timeout:
173 .............................................................................
This problem has been resolved in the latest release. Thanks for the report.