Author Topic: [SOLVED] Erase all data on chip 18F2550  (Read 1657 times)

0 Members and 1 Guest are viewing this topic.

Offline MAD MACROTopic starter

  • Regular Contributor
  • *
  • Posts: 56
  • Country: eg
[SOLVED] Erase all data on chip 18F2550
« on: September 19, 2017, 08:38:16 am »
Brain Fart: I set the code protection configuration ON instead of OFF by mistake.  :horse:

Don't do this at home..
Code: [Select]
#pragma config CPD = ON
Feels like i rekt an expensive chip, unless there is a way to erase all data and start over.  :-//

Please, Help meh  :scared: :scared: :scared:

PS: I don't use MPLABx, I use XC8 compiler in terminal, I write the makefile tho
« Last Edit: September 22, 2017, 03:42:06 am by MAD MACRO »
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12807
Re: Erase all data on chip [18F2550]
« Reply #1 on: September 19, 2017, 08:57:56 am »
Just do a normal chip erase with Vdd>4.5V and all protection bits in the CONFIG will be reset to their factory defaults.
 
The following users thanked this post: MAD MACRO

Offline MAD MACROTopic starter

  • Regular Contributor
  • *
  • Posts: 56
  • Country: eg
Re: Erase all data on chip [18F2550]
« Reply #2 on: September 19, 2017, 11:06:11 am »
unless there is a way to erase all data
a normal chip erase with Vdd>4.5V
plz elaborate, kind sir.

 

Online woody

  • Frequent Contributor
  • **
  • Posts: 290
  • Country: nl
Re: Erase all data on chip [18F2550]
« Reply #3 on: September 19, 2017, 01:42:51 pm »
The CPD bit (bit 7 in the CONFIG5H register) enables or disables Data EEPROM code protection. This protects the data in EEprom against external reads and writes. When this bit is a '1' the Data EEPROM is not protected, and when it is a '0' the Data EEPROM is protected. The datasheet has all the info:

https://www.google.nl/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwi08aq6r7HWAhWJKFAKHUqFDeYQFggmMAA&url=http%3A%2F%2Fww1.microchip.com%2Fdownloads%2Fen%2FDeviceDoc%2F39632b.pdf&usg=AFQjCNGsfrBCpu9EPzZIvmZjY28idVHwCA

You can reprogram the CPD bit over and over. It is not something like a 'final fuse' or a one-time programmable thing.  Just reset the fuse code (NOCPD or CPD=off or whatever it is in XC8 lingo) in your code, compile it, put the chip in a programmer or connect to it via ICSP and reprogram it.

Paul
 
The following users thanked this post: MAD MACRO

Offline JTR

  • Regular Contributor
  • *
  • Posts: 107
  • Country: au
Re: Erase all data on chip [18F2550]
« Reply #4 on: September 19, 2017, 05:42:53 pm »
If you tell us what programmer you are using then _maybe_ we can give more detailed info. As it is there is no need to believe you have bricked your chip. It just needs a chip erase done at Vdd >= 4.5V. You may be able to figure out how to do that by poking around your programmer software. The key point here is that Vdd must be >= 4.5V for the bulk erase to work.
 
The following users thanked this post: MAD MACRO

Offline MAD MACROTopic starter

  • Regular Contributor
  • *
  • Posts: 56
  • Country: eg
Re: Erase all data on chip [18F2550]
« Reply #5 on: September 22, 2017, 03:41:19 am »
WOW, this is so embarrassing, it's almost like im retarded, what i did which made it alot harder is that I removed the line completely, instead of replacing the ON with OFF...  |O

sry for the late reply btw, work and life took me away for a while.

Thanks for all the helpful replies  :-+
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf