This is inspired by Arduino. Directly before connect, DTR is asserted
for 0.5 seconds and then deasserted again. With a small external
circuit, the MCU can be power-cycled with this control signal.
In case the MCU draws very little power, it may even be possible to
supply power directly from the DTR pin.
The cpu core voltage setting is only available on newer parts, so do not
try to support it on older ones. The option packet is too short on some
parts, which resulted in an assertion hit.
There may be a nicer solution, but this works for now.
Fixesgrigorig/stcgal#6.
Initialization is messed up on older Linux kernels and that results
in 9600 baud being used unconditionally in some cases. Setting the
baud rate separately seems to work around this successfully.
Fixesgrigorig/stcgal#5.
Use the newer sync sequence. Refactor the pulse() function to make
it somewhat generic, so we can use it without worrying about writing
the exactly right number of bytes.
This seems to get STC15W4 series chips working.
Add Intel HEX support with the help of the IHex library. IHex needed
some modifications to make it work with Python 3.
Intel HEX files are autodetected, based on file extension (.hex,
.ihx or .ihex).
Split up single script into a package with multiple modules.
Also add a setuptools control file. With this, stcgal can be
installed like any other program. It's still possible to launch
from the sources directly. stcgal.py has been converted into a
simple launcher.
v2: fix imports
The protocol originally named "stc15" is only used for two early STC15
series, i.e. STC15F104/STC15F204. All other STC15 series appear to
use a different protocol. So switch around names similary to "stc12"
vs "stc12a".
In conclusion:
- "stc15a" is used only for STC15xx04E(A)
- "stc15" is used for all other currently tested STC15 MCUs