![]() |
Forum Index : Microcontroller and PC projects : Read-protecting the MM chip...
Author | Message | ||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9586 |
Hi all. ![]() One thing I really did like about the PICAXE, was that you could program it as much as you wanted, but you could NOT read the device back with the likes of PK3 and IPE etc. I am guessing that the PICAXE firmware has one of the config bits set so that you can write to it, but not read from it. Can something like that be done with the MM series of chips? Probably hidden somewhere in the IPE or IDE... Smoke makes things work. When the smoke gets out, it stops! |
||||
G8JCF![]() Guru ![]() Joined: 15/05/2014 Location: United KingdomPosts: 676 |
G PIC32 chips have the Code Protect, "CP", bit which will prevent reading/modifying of the Flash using ICSP/JTAG. CP is a configuration bit, DEVCFG0: DEVICE CONFIGURATION WORD 0, bit 28, Page 226 of DS60001168F. Peter The only Konstant is Change |
||||
bigmik![]() Guru ![]() Joined: 20/06/2011 Location: AustraliaPosts: 2949 |
Hmm, That is interesting.. Can it be ERASED if CP is set? Mick Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<< |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3282 |
Yes, you can protect all memory from being read. jimbotron showed how it could be done in this thread: http://www.thebackshed.com/forum/forum_posts.asp?TID=7148 As far as I know, the flash can still be erased if protected but not read. Geoff Geoff Graham - http://geoffg.net |
||||
bigmik![]() Guru ![]() Joined: 20/06/2011 Location: AustraliaPosts: 2949 |
Thanks Geoff, I have a spare '150 sitting around somewhere.. I might give it a try.. Mick Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<< |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9586 |
Cool, thanks for those replies. ![]() I have a feeling that is the same bit that must be set with PICAXE chips, as you can re-program them, but you cannot read them back. This is not to say that someone who is very good at hacking etc, could not find a way to get into it somehow, but for the most part, it prevents all but the most intense people from being able to download your code from the chip. Smoke makes things work. When the smoke gets out, it stops! |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6266 |
Doesn't the PIN give enough security? Together with autorun on and break disabled will make it difficult to see the code. Put it through Hugh's crunch will make reverse engineering anything that can be seen by reading the flash rather like gobblygook. Jim Edit: Or do you want to prevent cloning? VK7JH MMedit |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9586 |
Hi Jim - Yes, you're on to it. I want to prevent anyone just reading the device - MMBASIC, code and all, into a HEX file saved locally, then cloning from that. I realize nothing is infallible, but you can at least make it as hard as possible for the blighters! ![]() Smoke makes things work. When the smoke gets out, it stops! |
||||
G8JCF![]() Guru ![]() Joined: 15/05/2014 Location: United KingdomPosts: 676 |
What I found while developing MMProg32RPC is that if CP is set, then MMProg32RPC can't get into Serial Execution Mode which is the required state for device programming - see Page 22 of DS60001145N - http://ww1.microchip.com/downloads/en/DeviceDoc/60001145N.pd f In MMProg32RPC, if CP is SET, then before one can program a new .hex file into a PIC32, MMProg32RPC puts up a message box informing the user that the target chip MUST be erased (using the h/w erase method rather than the Programming Executive method), and displays an Erase button which invokes the MCHP_ERASE ICSP/JTAG command. Peter The only Konstant is Change |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9586 |
So, am I correct in my understanding of that, that once CP is set, you can't read the code back or program the device, BUT - you can erase the device(which would wipe out anyone's code), and then reprogram it as a default device? Smoke makes things work. When the smoke gets out, it stops! |
||||
G8JCF![]() Guru ![]() Joined: 15/05/2014 Location: United KingdomPosts: 676 |
Yes indeed. I don't have PK3+IPE, but I would expect the IPE to provide the facility to set CP The only Konstant is Change |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4033 |
Same here - about all you can do apart from using a protected chip as intended is erase it. That clears everything, the CP bits as well, so you can reflash it. Oh, as I recall when protected you can at least identify what chip it is, with a view to erasing it :) John |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9586 |
Cool, thanks guys. I will hook up a PIC32 and run some tests along those lines. Smoke makes things work. When the smoke gets out, it stops! |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |