Improved LarduinoISP #87
Replies: 15 comments 2 replies
-
This is awesome! We should link to your repo in the readme. |
Beta Was this translation helpful? Give feedback.
-
Do like you want. I wish I could have published a "push request" or a "patch" to brother-yan/LGTISP or to your repository, but I don't remember how to use git and I think I've made too much modifications at once. (I just copy pasted my code to Github) |
Beta Was this translation helpful? Give feedback.
-
I agree that it's open source and people can do what they want as long as
they comply with the license, but it's still polite to ask. ;) Especially
as a means of showing respect and appreciation for the work that you've
done. So, thank you!
…On Tue, Nov 3, 2020 at 12:43 PM SuperUserNameMan ***@***.***> wrote:
This is awesome! We should link to your repo in the readme.
Would it be ok for you to add your code to the examples of this one so it
comes built in? Then all the readmes & issues link back to your repo of
course,
Do like you want.
It's open-source like the rest of the original code anyway :-D
(about which i don't even know what license it was).
I wish I could have published a "push request" or a "patch" to
brother-yan/LGTISP or to your repository, but I don't remember how to use
git and I think I've made too much modifications at once. (I just copy
pasted my code to Github)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<https://github.com/dbuezas/lgt8fx-forum/issues/1#issuecomment-721279533>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACPEX7B46SLOTE7OIYBBTK3SOA6N3ANCNFSM4TI5GNVA>
.
|
Beta Was this translation helpful? Give feedback.
-
I've started implementing the code for the However, you can already see the content of the EEPROM with |
Beta Was this translation helpful? Give feedback.
-
I've just added the support for Note : the EEPROM is automatically erased each time we update the sketch using the Arduino IDE. |
Beta Was this translation helpful? Give feedback.
-
Does anyone know what this means in the datasheet?
I don't remember finding an explanation for how it works. |
Beta Was this translation helpful? Give feedback.
-
I think I figured out from Brother-yan and SuperUserNameMan comments what programming Encryption Algorithm mean. So programming Encryption Algorithm is when someone want to read progmem flash the LGT8Fx chip will erase its flash contents. |
Beta Was this translation helpful? Give feedback.
-
According to the google-translated comment of brother-yan into swd_lgt8fx8p.cpp, the trick is to erase the first 1KB of the flash. Then, the rest become readable. uint8_t crack() // 破解读保护(目前只能读出除了前1k以外的flash,前1k会被擦除) // Crack the read protection (currently only the flash except the first 1k can be read, the first 1k will be erased)
{
SWD_EEE_CSEQ(0x00, 1);
SWD_EEE_CSEQ(0x98, 1);
SWD_EEE_CSEQ(0x92, 1); // 会擦除flash的第一页(1024 bytes) // Will erase the first page of flash (1024 bytes)
delay(200);
SWD_EEE_CSEQ(0x9e, 1); // 解锁 // unlock
delay(200);
SWD_EEE_CSEQ(0x8a, 1);
delay(20);
SWD_EEE_CSEQ(0x88, 1);
SWD_EEE_CSEQ(0x00, 1);
} However, I'm not sure this crack was mandatory, because when I implemented the Maybe my memory is wrong ? maybe i did not notice because i did not powerdown the LGT each time ? maybe it becomes write protected if a secret bit is set ? I don't know ... |
Beta Was this translation helpful? Give feedback.
-
@LaZsolt : Ok, so I've just made several tests. Here is what I can confirm :
The flash is actually erased by LarduinoISP and LGTISP as part of their procedure to unlock the chip. The original LarduinoISP erased the whole content, but brother-yan/LGTISP found that only the first 1KB of flash could be erased to unlock the flash. So, if we want to debug/dump the whole content of the flash using AVRdude terminal, we must do that without powering down the LGT8Fx, just after programming it ... EDIT : also, if we connect the LGT8Fx to AVRDUDE terminal after a power down, we will lose the first 1KB of flash .... |
Beta Was this translation helpful? Give feedback.
-
Ok, I've just disabled the destructive unlock by default. Once powered down, the flash will be locked, and
The only way to inspect the first 1KB of flash is to keep the device powered between the programming and the I've updated the repo and the readme. Thanks again to @LaZsolt for pointing that out ! :-) |
Beta Was this translation helpful? Give feedback.
-
Your work are awesome again. |
Beta Was this translation helpful? Give feedback.
-
Because we're a good team ;-D |
Beta Was this translation helpful? Give feedback.
-
update :
Because the ISP pretend to be connected to an ATmega328p, AVRdude will only allow to dump 1024 bytes of EEPROM. To workaround this limitation, we can now use the command
Examples :
|
Beta Was this translation helpful? Give feedback.
-
At very first - thanx to @SuperUserNameMan for excellent work. I'm trying to port this to CH552 (to make ArduinoISP+LarduinoISP combo) and want to fugure out LGT's ISP protocol and programming sequence (not just copy-paste code). If I understand correctly - there is no any official docs about it. I found two sources - @Edragon (Toolchain/LarduinoISP-master) and @brother-yan / @SuperUserNameMan. Seems like Edragon's source either old or for the different chip version (maybe x8D?, at least Unlock1, SWD_EEE_Write are different, SWD_EEE_GetBusy is using etc). SuperUserNameMan did great work by code clean-up, removing destructive unlock from start_pmode, adding new useful features. So at first step I create the table to summarize ISP commands:
Thanks for any suggestions. BTW during experiments I added:
to the lgt8f328p part in avrdude.conf to implement 'read guid' in avrdude terminal mode (via universal -> ReadGUID, seems like 0x32 cmd is not used anyware). |
Beta Was this translation helpful? Give feedback.
-
Thanks SuperUserNameMan for the excellent work. |
Beta Was this translation helpful? Give feedback.
-
Hello,
As mentioned into pull request #50, when LarduinoISP/LGTISP is used to dump flash content using the AVRdude terminal, it will displays 0xFF everywhere.
This is because LarduinoISP/LGTISP only implements minimal required functionalities to upload/verify bootloaders and sketches using Arduino IDE.
So, today, I've managed to implement the missing functionality used by the
dump flash
command of AVRdude in terminal mode.Many more functionalities are missing though (erase, dump eeprom, write flash/eperom/fuzes, etc).
You can find my LGTISP fork and updated instructions here : https://github.com/SuperUserNameMan/LGTISP
Beta Was this translation helpful? Give feedback.
All reactions