rumpeltux / hc12

5 stars 1 forks source link

Not working with fw version 2.6 #2

Open buttim opened 4 months ago

buttim commented 4 months ago

Unluckily seems like your code does not work anymore for modules with v2.6 firmware. Any chances of getting the STM8 source code that gets translated to the stub to upload? Any link for the docs on the update protocol? Also your code is missing import time

Here is the output with the error:


Flashing dumpcode...
Traceback (most recent call last):
  File "c:\Users\butti\Downloads\firmwaredump.py", line 73, in <module>
    hc = enterUpdateMode(args.device)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\butti\Downloads\firmwaredump.py", line 23, in enterUpdateMode
    assert x == b'\4', repr(x)
AssertionError: b'\xf8\xfe\xf8\x00\x00\x00\x00\x00\x00\x00\x00\x98\xe0`x\x00\xf8\x86\x06\x98`\x06`\x18x\x9e\xe6\x98~\x1e`\x9e\x06f\x9e\x1e\x9ef\x18\xfe~\x18~\x9e\x9ex\x98f\x86\xe0\xe0f\xe6\x06fx`\xfeff\x1e'
papadeltasierra commented 3 months ago

Given that \xEE is an undocumented command, the fact that the code only works for v2.4 doesn't surprise me. I have a board that claims v2.3 and I guess that won't work either.

I suspect that the solution for both of us would need to be something like the following:

Not sure how possible this is but going to look around. If you come up with a better idea, please respond to my Issue and let me know.

buttim commented 3 months ago

Thanks for your reply. Studying more deeply your solution I figured that indeed it cannot work with a different firmware version. Alas doing the glitching to dump the new firmware is a bit too much for me. Thanks anyway for your inspiring work. Should I come to some idea I will let you know for sure.

lalo-uy commented 3 months ago

Why not update 2.3 to 2.4?

El El dom, 17 mar. 2024 a la(s) 09:26, buttim @.***> escribió:

Thanks for your reply. Studying more deeply your solution I figured that indeed it cannot work with a different firmware version. Alas doing the glitching to dump the new firmware is a bit too much for me. Thanks anyway for your inspiring work. Should I come to some idea I will let you know for sure.

— Reply to this email directly, view it on GitHub https://github.com/rumpeltux/hc12/issues/2#issuecomment-2002440368, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACXBW4OEUMXYDVPM7AFJZJ3YYWDYRAVCNFSM6AAAAABDXQJVCOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBSGQ2DAMZWHA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

buttim commented 3 months ago

Why not update 2.3 to 2.4? El El dom, 17 mar. 2024 a la(s) 09:26, buttim @.***> escribió:

How exactly?

papadeltasierra commented 3 months ago

@lalo-uy To add to buttim's comment, although the HC-12 has an update command, there appears to be nowhere that provides either updated firmware or the HC-1X updater program that is mentioned in some of the earlier documentation.

FYI this, https://itooktheredpill.irgendwo.org/2020/stm8-readout-protection/, is a good starting point for "glitch attacks". As I understand it, on start-up the STM8 writes a specific byte that causes read-protection to be on. Glitch-attacks deliberately drop the voltage to the chip "enough to fail the write of this byte but not enough to reset the CPU, and only for the brief moment of this write attempt" meaning that the chip boots but that read protection is disabled. Sounds simple but of course it is not!

buttim commented 3 months ago

Yes, I eagerly read your blog post. I am tempted to give it a try, but not really confident in my skill/patience

lalo-uy commented 3 months ago

There is an update program for Windows, in chinise. I don’t have windows, but will upload the bundle and give the link.

El El dom, 17 mar. 2024 a la(s) 12:39, buttim @.***> escribió:

Yes, I eagerly read your blog post. I am tempted to give it a try, but not really confident in my skill/patience

— Reply to this email directly, view it on GitHub https://github.com/rumpeltux/hc12/issues/2#issuecomment-2002512661, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACXBW4OEL4Z3EHXN4MXLMMTYYW2MHAVCNFSM6AAAAABDXQJVCOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBSGUYTENRWGE . You are receiving this because you were mentioned.Message ID: @.***>

buttim commented 3 months ago

Thanks. Where did you find it? Does it come with the actual firmware binary?

rumpeltux commented 1 month ago

After analysis of the v2.6 firmware, it is apparent that it does not support the AT+UPDATE protocol anymore, that means that this tool cannot work for the v2.6 firmware version.

I have yet to test whether the v2.6 boards are working with custom firmware (https://github.com/rumpeltux/hc12fw).

buttim commented 1 month ago

Thanks for your analysis. Looking forward to the firmware compatibility test