Closed sjborley closed 8 months ago
Tested this PR with STM8L151K4 and worked as expected.
Thanks
Tested with STM8L151G6 and unlock is working. Thank You. I was trying earlier and did not accomplish this. Why do You put 0x01 into buf[10]? This seems to be BROWNOUT Reset ON. With Off (0x00) it is also working.
I have made a pull of the changes by @sjborley , but cant get my STM8L052C6, unlocked Does anyone else have a hint of what I can do to get the unlocking to work ?
@B4Me show the command You use and error You get
@lkord Here are my commands: sudo ./stm8flash -c stlinkv2 -p stm8l052c6 -u
Determine OPT area Due to its file extension (or lack thereof), "Workaround" is considered as RAW BINARY format! Unlocked device. Option bytes reset to default state. Bytes written: 13
sudo ./stm8flash -c stlinkv2 -p stm8l052c6 -s flash -w calib.ihx
Determine FLASH area Due to its file extension (or lack thereof), "calib.ihx" is considered as INTEL HEX format! 20628 bytes at 0x8000... Tries exceeded
@B4Me after first operation. Can You read OPT Bytes?:
sudo ./stm8flash -c stlinkv2 -p stm8l052c6 -s opt -r OB.hex -b 13
See in datasheet what should appear on first byte? 0xAA or 0x00?
Workaround for unlock can be (but not tested on this part):
I have never seen .ihx files before. Did You mean .hex?
Hi @lkord Sorry for the delay, had an accident, so first had time now. After running unlock, and reading out opt bytes I get: AA 00 00 00 00 00 00
But I still cant write to the device after a reset of the power. The issue as I see it, are in the syntax, flash AA, read EOP, flash AA, read EOP I dont think the code is correct yet But I dont know what to change yet.
I have to be able to do it through linux, sadly, so using STVP, isnt an option, as its for a production rig, where everything needs to run from a single box, running on raspberry pi
@B4Me
stlinkv2.c
but in sborley branch for STM8L,.hex
file just once and then use it as an input file, no need for Windows and STVP,4. Last question: I have never seen *.ihx files before. Did You mean *.hex?
These are just alternative file endings for the same Intel Hex type of file, like .jpg and .jpeg for JPEG.
I think we now have working STM8L unlock support in master? If yes, can this pull request be closed or is there still something left here that we want in master?
Closing, out of date.
This aims to fix unlocking the STM8L. I've tested it on STM8L052R8 but it ought for other STM8L devices. Only fixed this for the stlinkv2. I've trying to fix for stlink too but without success, so have omitted those changes.
Also noted, that the EEPROM read and write appears to be working for this device, although I'm not aware I did anything that would have affected this. I just tested it.