CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Program bootloader without erasing the EEPROM

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Gelio



Joined: 25 Aug 2014
Posts: 12

View user's profile Send private message

Program bootloader without erasing the EEPROM
PostPosted: Sat Aug 30, 2014 2:48 pm     Reply with quote

Hi all, encountered the situation where the program bootloader block in PIC18F2455 cannot be performed without erasing the eeprom.

I made sequence of commands as described in specification 39622l.
Bulk erase of chip performed ok,
then i program all the blocks on chip and set all CPx to 0(Enabled).

The problem is when CPD and WRTD bits is set to Enabled i cannot program the bootblock 0x000-0x7FF.
To program bootblock I'm using the BULK erase of bootblock.
Code:

MOVLW 3Ch
MOVWF TBLPTRU
MOVLW 00h
MOVWF TBLPTRH
MOVLW 05h
MOVWF TBLPTRL
Write 0000h to 3C0005h
MOVLW 3Ch
MOVWF TBLPTRU
MOVLW 00h
MOVWF TBLPTRH
MOVLW 04h
MOVWF TBLPTRL
Write 8181h TO 3C0004h //Erase Boot Block cmd from table 3-1 of 39622
NOP
NOP

so i cant erase and reprogram the bootblock when CPD and WRTD bits are enabled.
If i erasing the EEPROM, then bootblock erasing and programming works ok.

Any ideas about this situation? No any information about in datasheet found.
temtronic



Joined: 01 Jul 2010
Posts: 9142
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sat Aug 30, 2014 3:10 pm     Reply with quote

While I don't use that PIC, any chance the software you're using to actually program the PIC has changed the 'flags'? It could easily be MPLAB (or whatever you're using) is overriding your PIC program's settings.

This has happened to others... might be for you as well !

hth
jay
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Aug 30, 2014 3:56 pm     Reply with quote

Quote:
I made sequence of commands as described in specification 39622L.pdf.

http://ww1.microchip.com/downloads/en/DeviceDoc/39622L.pdf
I don't know why you're using this document. It's written for people who
want to make an ICD3, Pickit 3, ICD-U64, etc., programmer. Are you
trying to make your own ICD programmer ?

The 18F2455 data sheet has a section on writing/reading/erasing flash
memory under program control (ie., code written with CCS, etc).
http://ww1.microchip.com/downloads/en/DeviceDoc/39632e.pdf
It's in this section:
Quote:
6.0 FLASH PROGRAM MEMORY

CCS has functions to do all this, as listed in the CCS manual.
http://www.ccsinfo.com/downloads/ccs_c_manual.pdf
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group