Thank you so very much-this helped me get some key code uploaded to my Nano. As a newbie this would not have been possible without your help. I'm very grateful. Thank you.
Very nice video, really appreciate your work. I think this method only works when the controller is unlocked via are fuses, once controller is lock (hardware lock) we may be able to read fuse value but reading hex and reprogramming the controller again will not be possible. Be careful while locking the controller 😉
I'm not sure the above is true. I have read that once locked via the fuses, if it is attempted to read the device it will be erased first and then you can reprogram the device. So the device can be updated and used again. I'm no expert and I don't know the veracity of this statement but I recall reading this somewhere at sometime.
You can disable Reset pin to turn it into another IO. That will lock you out of ISP programing mode cause reset is needed for that. Then you can only program the AVR with a special HV programmer or re enable reset with such a HV programmer. But if locked out of ISP i guess you can still use the arduino serial bootloader for programming if it is already on the chip... erasing the chip to reset read protection is possible
Andrei, I really appreciate this video. It is very useful information to know. I'm a member of many Facebook microcontroller groups. In one of the more popular groups Arduino for Beginners I see the question come up all the time about extracting code from an Arduino. I've never heavily researched the topic myself because I've never had the need. But it is useful and helpful to see how it is done. Thank you for taking the time to create and share this :) Now I have a specific tutorial I can refer those who ask that question.
Probably not worth your time. Hex is converted to assembly. Then you have to match the assembly with C++ libraries. And then convert it to the program observed in the IDE. There are probably some reverse engineering tools available which would make it easier but i imagine it's still a challenge. There is a fuse that can be set to inhibit reading of the chip. If there is anything worth protecting and the developer is reasonably good, this fuse will be set.
@@Shocker99 You are right, I did look into it after posting that, and yes, this is exactly what I found. It would be cool, but not really worth the effort.
@@FridayHouseXYZ That's what a c++ compiler does. Translates to (architecture dependend) machine code. For your PC it will be X86_64 opcode. A program for the Pico RP2040 will be translated to ARMv6-M Thumb instruction set.
@@ELECTRONOOBS Program And Data Memory Lock Bits The Atmel® ATmega328P provides six lock bits BLB12 BLB11 BLB02 BLB01 LB2 LB1 Boot Lock Bits and Lock Bits respectively. What are the functionality of this bits What if i only read protect my code or full lock so microcontroller can not be programmed afterwards.
well that is partially correct, for something like STM32 chips you can lock the flash that way no one can read the chips code but still there are some attacks to even get past that but thats just too tedious
Could you use this to essentially clone the current Arduino uno to a brand new unused unit? We have a fixture at my work that uses an arduino uno and the person who made it no longer works there and didn't save the files for future use.
Nice explained 👍. Now Can you plz make a next vedio opposite to ☝️this vedio that how could we safe our written code from being copied.🤔 I think as I m reading comments most of have asked same like me😅☝️
Great video, nice to see these videos. I use the avr PROGISP software which allows all that, and is compatible with multiple AVR Microcontrollers, it allows the user to lock the bootloader, look to which fuses are being configured, etc...
Thank you for the detailed video; very informative. Can I extract the flash from ATmega328P and then upload it into a different ATmega chip model, like ATmega2560?
All your videos are great! Arduino is a learning starting point - your videos are completing that! Hope you will find a way to use arduino as a working base for programs loaded on a SD mem card, witch are uploaded with a push of a button
Good work! But, there is a solution to not being able to copy the sketch from inside any microcontroller. Because I had the opportunity to be asked to make a sketch and the person in question dared to ask me if he could copy the code. I didn't answer him for two days. During this time I looked for ways to copy. And finally I managed to make a sketch with protection. How? Well, if the ISP is used for copying, I blocked a pin from the ISP in the sketch. That pin is activated with 3 passwords. When trying to copy, the respective pin being necessary for copying, will lead to damage to the sketch.
Hi, can you show me how to calculate phase transition time or correct phase transition in your source, i have watched many times but still don't understand this part, by the way can i ask for some advice on phase transition after detecting zero point is 3 opame. thank you
Buenas Estoy recreando el circuito que hiciste con el attiny85 y el módulo de 433 MHz. Pero el programa del receptor da problemas. Podrías probarlo tu para ver que es lo que no funciona? Un saludo
@@ELECTRONOOBS you can reverse it. especially if they are stored as strings in memory this is trivial. run `strings` on the unpacked intel hex file (what you got is not properly the devices memory but a packed format - called intel hex - that when unpacked will give you the binary.)
can be done but would require quiet a bit of effort, but you can just lock the flash for most microcontroller in order to protect your code that's what most commercial products do
This video is good.. But How can we protect our code so that anyone cannot steal our code.. Please make a video on this if possible or give some resources from where we can learn.
Why dont use the 6pins on the back on each Arduino? They are ment for doing exactly this i think... I have only one Problem, i used the Arduino ide and set the clock accidently from the internal to an external oscillator on an attiny13, and dont know how to set it back to Default. Is it possible to reprogramm it without any clock signal by just overwrite all stuff in its memory or does this overwrite need the clock?
Fubarino does have a PIC controller. No thanks. I want something with a free gcc compiler. So something with ARM like stm32 or RP2040 and for IOT/Wifi: ESP32 and ESP8266
they will even do it without this video, you cant stop hardware hackers every hardware hacker likes extracting code they do it in a blink of a eye you cant stop it, this comment is sort of dumb people will always find ways to extract code and other firmwares
@@309electronics5 Depends on the device and the programmer. Most exploits you see hack the code by bypassing the debug mode check at boot up. Something that companies/programmers leave in the code and just turn off when they ship the product. The debug mode essentially gives the hacker god mode on the device. The debug mode is in the user space, not the root hardware space, which makes it easier to bypass - even if it's days/weeks on constant attempts.
I have 2 questions please First question: is it possible to convert the hex code back to C language? Second question: is it possible to protect the code from being copied? Thank you in advance
@@justchill4886 if they are 100% compatible you should be successful. But it depends on what is the issue with your UNO. Typically HV-Programmers can fix wrongly set fuse bits.
Hey bro, i love your videos. I cant afford to help you on patreon but i can help you with your translations. Dont get me wrong, you speak great english.... in fact better than most, but i feel if you had someone that you could run your scripts by prior to uploading your videos, it would help you out. I dont mind helping you out with this. LMK if you are interested and ill send you my info. Sorry, i dont want to just post my info directly onto the comments for privacy reasons, hope you can understand why.
It's not a problem when you have plenty of memory. It's the needed libraries that cause 'bloat'. Assembly is good if you have a tiny memory and only want to do counters and bit shifting, but as soon as you want to do some maths, you'll be glad for a higher level language.
@@threeMetreJim watch the c64 demos of 95 and take a guess what’s possible if people take more care about code efficiency… we are at a point where you need psychology to interpret code and where maschineschrieb do the coding…
@@soerenraudonis I started on 6502 years ago hacking games for 8 bit computers and done some PIC micro (all in assembler). I wrote a 6502 assembler in 6502 years ago too (assembled via a BASIC program until it could assemble itself, the speed increase was impressive). I've managed to squeeze a fair bit into 8k of instruction space on a PIC (one project only 512 words) and only used integer multiplication and division. Assembly is great if you need exact timing or want to do really low level hardware stuff, but for anything more complicated.... Just look at the complexity of floating point maths in assembler. All you end up doing is writing your own routines that do the same as a library in the end. I can only imagine the difficulty (and time taken) to code something like a web server in assembly (on an ESP - is the instruction set and hardware manual even available?)
Join my Arduino Course (Spanish): bit.ly/2JY8icE
My Tools: bit.ly/3uv8bc3
Help me on Patreon: www.patreon.com/ELECTRONOOBS
Hi, what about 3d printed planes? Would it fly some day?
This is most helpful video for me because I wanted to know this in my college time, at that time I didn't found any video with in proper way.
Something that should be mentioned is there are fuses to prevent the reading of the code so no one can copy your work if needed.
finally there is also a discussion on how to extract HEX files. this is very helpful, where I sometimes forget to save the uploaded INO project file
Perfect timing. I’m just starting to learn to program directly to chips.
Thank you so very much-this helped me get some key code uploaded to my Nano. As a newbie this would not have been possible without your help. I'm very grateful. Thank you.
Very nice video, really appreciate your work. I think this method only works when the controller is unlocked via are fuses, once controller is lock (hardware lock) we may be able to read fuse value but reading hex and reprogramming the controller again will not be possible. Be careful while locking the controller 😉
I'm not sure the above is true. I have read that once locked via the fuses, if it is attempted to read the device it will be erased first and then you can reprogram the device. So the device can be updated and used again. I'm no expert and I don't know the veracity of this statement but I recall reading this somewhere at sometime.
You can disable Reset pin to turn it into another IO. That will lock you out of ISP programing mode cause reset is needed for that. Then you can only program the AVR with a special HV programmer or re enable reset with such a HV programmer.
But if locked out of ISP i guess you can still use the arduino serial bootloader for programming if it is already on the chip...
erasing the chip to reset read protection is possible
wow very nice tutorial! Thanks! definitely need to check out extracting the EEPROM
talk about fuse lock byte and how to avoid cloning your code :) the opposit way so
Andrei,
I really appreciate this video. It is very useful information to know. I'm a member of many Facebook microcontroller groups. In one of the more popular groups Arduino for Beginners I see the question come up all the time about extracting code from an Arduino. I've never heavily researched the topic myself because I've never had the need. But it is useful and helpful to see how it is done. Thank you for taking the time to create and share this :) Now I have a specific tutorial I can refer those who ask that question.
Glad I was able to help :))))
Very useful information. Thank you. But please teach us how to prevent our code from copying. It will be halpful. Thank you once again.
Code wants to be free. That's why we won't tell you.
there is a way to reverse engineer hex files, using ghydra it would be posible for example
Could you please share the fuse bit settings that will stop copying the hex file
Such a great tutorial!! Thanks so much!! It was the first time I could achieve the cloning of a 328P! :)
This is what i want to know how to extract from microcontroller many years now when i start learn about Arduino now you start make that video
Neat! I will have to try this on a few boards. Makes me want to look for a way to convert the HEX into code again.
Probably not worth your time. Hex is converted to assembly. Then you have to match the assembly with C++ libraries. And then convert it to the program observed in the IDE.
There are probably some reverse engineering tools available which would make it easier but i imagine it's still a challenge.
There is a fuse that can be set to inhibit reading of the chip. If there is anything worth protecting and the developer is reasonably good, this fuse will be set.
@@Shocker99 You are right, I did look into it after posting that, and yes, this is exactly what I found. It would be cool, but not really worth the effort.
@@FridayHouseXYZ
That's what a c++ compiler does. Translates to (architecture dependend) machine code. For your PC it will be X86_64 opcode.
A program for the Pico RP2040 will be translated to ARMv6-M Thumb instruction set.
How can we lock/protect our atmega328p. There a 4 lock bits , what are the functions of these bits. Explain.........
You could protect your code so nobody could copy it...
Datasheets for microcontrollers outline how to protect your code from being extracted. There is a protection fuse/register that needs to be set.
@@ELECTRONOOBS Program And Data Memory Lock Bits
The Atmel® ATmega328P provides six lock bits
BLB12
BLB11
BLB02
BLB01
LB2
LB1
Boot Lock Bits and Lock Bits respectively.
What are the functionality of this bits
What if i only read protect my code or full lock so microcontroller can not be programmed afterwards.
Brilliant, all other sites say that you can not do this, I now know that you can.
Well you can't get the code for Arduino. Just the hex code so you couldn't edit the code in Arduino IDE
well that is partially correct, for something like STM32 chips you can lock the flash that way no one can read the chips code but still there are some attacks to even get past that but thats just too tedious
also on Microchip pic's you can lock it.
Amazing...you're best engineer ever..regards from guatemala
Oh my this is i looking for from long time..thank you so much for your effort
Thankyou for everything you uploaded very helpful for me to understand really love you brother from India ❤
This could save me in a lot of situations, Thanks bro!
GREAT VIDEO, CAN YOU SHOW US HOW TO PROTECT OUR ARDUINO CODES FROM BEEN COPIED?
You rock. I hope one day you will do an in depth video of the ESP-32's.
I'm on it! Soon, since I still learning about them!
Me too! @@ELECTRONOOBS
Could you use this to essentially clone the current Arduino uno to a brand new unused unit? We have a fixture at my work that uses an arduino uno and the person who made it no longer works there and didn't save the files for future use.
Nice explained 👍.
Now Can you plz make a next vedio opposite to ☝️this vedio that how could we safe our written code from being copied.🤔
I think as I m reading comments most of have asked same like me😅☝️
Great video, nice to see these videos.
I use the avr PROGISP software which allows all that, and is compatible with multiple AVR Microcontrollers, it allows the user to lock the bootloader, look to which fuses are being configured, etc...
Thank you for the detailed video; very informative.
Can I extract the flash from ATmega328P and then upload it into a different ATmega chip model, like ATmega2560?
All your videos are great! Arduino is a learning starting point - your videos are completing that!
Hope you will find a way to use arduino as a working base for programs loaded on a SD mem card, witch are uploaded with a push of a button
Is it possible to extract FW from new Arduino MKR NB 1500 boards??
Love your videos ❤️ 😍
Hey, is it possible to extract the hex, eeprom and fuses of non-arduino bootloaded controllers?
Good work!
But, there is a solution to not being able to copy the sketch from inside any microcontroller. Because I had the opportunity to be asked to make a sketch and the person in question dared to ask me if he could copy the code. I didn't answer him for two days. During this time I looked for ways to copy. And finally I managed to make a sketch with protection. How? Well, if the ISP is used for copying, I blocked a pin from the ISP in the sketch. That pin is activated with 3 passwords. When trying to copy, the respective pin being necessary for copying, will lead to damage to the sketch.
Very good explanation. Thank you!
Hi, can you show me how to calculate phase transition time or correct phase transition in your source, i have watched many times but still don't understand this part, by the way can i ask for some advice on phase transition after detecting zero point is 3 opame. thank you
will it work if I do the same as you, but use a clean, never used atmega328p? Will I have to upload the bootloader first? or don't I have to?
Ok this is first like in ,2023 ,loved the video 🙌
How to edit hex code or convert to c or any other language
Buenas
Estoy recreando el circuito que hiciste con el attiny85 y el módulo de 433 MHz. Pero el programa del receptor da problemas. Podrías probarlo tu para ver que es lo que no funciona?
Un saludo
Is this a way that someone could find out our WIFI SSID and passwords if they had access to one of our Arduino or ESP boards?
Nope. Yo can never see the real code in text format. Only 1s and 0s
@@ELECTRONOOBS you can reverse it. especially if they are stored as strings in memory this is trivial. run `strings` on the unpacked intel hex file (what you got is not properly the devices memory but a packed format - called intel hex - that when unpacked will give you the binary.)
can be done but would require quiet a bit of effort, but you can just lock the flash for most microcontroller in order to protect your code that's what most commercial products do
Amazing ❤
Jabraad be bhaiwa!
Excellent, now we need a decompiller.
Getting "WARNING: Unable to detect MCU" Any suggestions?
This video is good..
But How can we protect our code so that anyone cannot steal our code..
Please make a video on this if possible or give some resources from where we can learn.
How is the extracted code edited to change the time ? Is it upload into Arduino IDE in anyway. Did not see that part in the video.
hex is not 1's and 0's
Sure, 4 bits, 1 nibble
... If you're too lazy to do the calculations.
Why dont use the 6pins on the back on each Arduino? They are ment for doing exactly this i think...
I have only one Problem, i used the Arduino ide and set the clock accidently from the internal to an external oscillator on an attiny13, and dont know how to set it back to Default. Is it possible to reprogramm it without any clock signal by just overwrite all stuff in its memory or does this overwrite need the clock?
yes it's the 6 pin ISP, In-System Programming avr connector. avr ISP programmers often have 10 pin but there is an adapter
How to extract the code from NodeMcu module ?
Great video!
Electronoobs can you make pure sine wave vfd three phase with uno
Also has lcd for displaying frequency
Please help with the link to buy these arduino parts
Hello my friend, how are you? I have a hex file. Can it be restored to the original C language?
Anyone having trouble extracting HEX code with CP2102 USB to UART converter?
Where can i download avrdudess??
Can i use esp32 as master?
I was told many times in many forums that this was impossible!
Is it possible to hack the controller and get the code if it is protected
Did ya check out the Fubarino?
a much better thing compatible with the IDE.
Fubarino does have a PIC controller. No thanks. I want something with a free gcc compiler. So something with ARM like stm32 or RP2040 and for IOT/Wifi: ESP32 and ESP8266
How to extract hex arduino to lock
Great!!
Thanks!
如果有中文就更好了😂这样我能更好的学习
Super cool
Electroboobs rulez ))
Can i get one 328p?
لابأس جميل متفوق
So can I upload code to arduino nano using arduino nano......
Yes...I have done that.
@@btomas225 Ok Sir plz explain it.... How did u do it.....
Thanks for teaching everyone how they can copy others hard-worked projects.
they will even do it without this video, you cant stop hardware hackers every hardware hacker likes extracting code they do it in a blink of a eye you cant stop it, this comment is sort of dumb people will always find ways to extract code and other firmwares
@@309electronics5 Yeah this is like saying that thiefs will anyway rob banks but it is okay if someone is teaching robbery upfront right?
@@309electronics5 Depends on the device and the programmer. Most exploits you see hack the code by bypassing the debug mode check at boot up. Something that companies/programmers leave in the code and just turn off when they ship the product. The debug mode essentially gives the hacker god mode on the device. The debug mode is in the user space, not the root hardware space, which makes it easier to bypass - even if it's days/weeks on constant attempts.
Don't bother him, everyone does the same...
It's a factory option, if you have to hide your code, May be you need to use another microcontroller
thanks👍
16 != 2
I heard mcu can be locked so you can extract data ,is it ?
yes that us true but again there are methodes like power cycle attacks to even bypass that
@@ShahZahid it is Possible?
@@ShahZahid yeah i have seen some extracting code while boot
I have 2 questions please
First question: is it possible to convert the hex code back to C language?
Second question: is it possible to protect the code from being copied?
Thank you in advance
easy very easy for this😊😂
Something new...( Never used an Arduino )
can i fix my broken uno with this method? i tried literally everything but dead
You can use a HV-programmer to fix your chip
@@Golkun1 does it work with chinise atmel chip
@@Golkun1 thank you so much i will search detailly
@@justchill4886 if they are 100% compatible you should be successful. But it depends on what is the issue with your UNO. Typically HV-Programmers can fix wrongly set fuse bits.
@@Golkun1 i will try to do this tomorrow
I think we can also convert the hex code into c code why don't you give it a try
Or can i get one if ur products for free?
Hey bro, i love your videos. I cant afford to help you on patreon but i can help you with your translations. Dont get me wrong, you speak great english.... in fact better than most, but i feel if you had someone that you could run your scripts by prior to uploading your videos, it would help you out. I dont mind helping you out with this. LMK if you are interested and ill send you my info. Sorry, i dont want to just post my info directly onto the comments for privacy reasons, hope you can understand why.
Thanks a lot :) But I think I will continue like this
Hi.... From Spain.... Por favor... Haz este tema en español..... Un abrazo.
🌟🌟🌷🌷🌟🌟
It’s a shame to see how compiler bloat up simple Code who is also realiseble with simple Prozessor Codes
I use micro python to make you assembly fetishists even more depressive XD
@@Henry-sv3wv Never my problem what other people think to need to do…
It's not a problem when you have plenty of memory. It's the needed libraries that cause 'bloat'. Assembly is good if you have a tiny memory and only want to do counters and bit shifting, but as soon as you want to do some maths, you'll be glad for a higher level language.
@@threeMetreJim watch the c64 demos of 95 and take a guess what’s possible if people take more care about code efficiency… we are at a point where you need psychology to interpret code and where maschineschrieb do the coding…
@@soerenraudonis I started on 6502 years ago hacking games for 8 bit computers and done some PIC micro (all in assembler). I wrote a 6502 assembler in 6502 years ago too (assembled via a BASIC program until it could assemble itself, the speed increase was impressive). I've managed to squeeze a fair bit into 8k of instruction space on a PIC (one project only 512 words) and only used integer multiplication and division. Assembly is great if you need exact timing or want to do really low level hardware stuff, but for anything more complicated.... Just look at the complexity of floating point maths in assembler. All you end up doing is writing your own routines that do the same as a library in the end. I can only imagine the difficulty (and time taken) to code something like a web server in assembly (on an ESP - is the instruction set and hardware manual even available?)
Hexadecimal is not binary hence you are wrong when you say ones and zeros.
I thought is was basivally impossible to extract the code from the arduino ahh you cant its just the hex data and hex is not 1`s and o's
Someone turn this into a flipper zero app
Getting "WARNING: Unable to detect MCU" Any suggestions?
Great video!!!