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 CCS Technical Support

Fuse Question

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



Joined: 09 Sep 2011
Posts: 6

View user's profile Send private message AIM Address

Fuse Question
PostPosted: Mon Sep 12, 2011 8:50 am     Reply with quote

I am trying to get a BootLoader to run on a 16F87. It looks like the jump to the BL code gets trashed when I download a program to the PIC

I have used #ORG 0x0F00,0x0FFF {} to protect the BL code.

Is their a way to prevent CCS C from setting the fuses ???

.................... #Fuses HS,NOWDT,PUT,MCLR,
.................... #Fuses NOBROWNOUT,NOLVP,NOCPD,NOWRT,NODEBUG
.................... #Fuses NOPROTECT,INTRC_IO
.................... #Fuses NOFCMEN,NOIESO

Configuration Fuses:
Word 1: 3F30 NOWDT PUT MCLR NOBROWNOUT NOLVP NOCPD NOWRT NODEBUG CCPB0 NOPROTECT INTRC_IO
Word 2: 3FFC NOFCMEN NOIESO

with #FUSES Commented out the .lst file has this ?????????????????????

Configuration Fuses:
Word 1: 3F73 NOWDT PUT MCLR BROWNOUT NOLVP NOCPD NOWRT NODEBUG CCPB0 NOPROTECT RC
Word 2: 3FFF FCMEN IESO
Ttelmah



Joined: 11 Mar 2010
Posts: 19499

View user's profile Send private message

PostPosted: Mon Sep 12, 2011 9:04 am     Reply with quote

What you are describing, has nothing to do with the fuses. It sounds as if you have a high memory bootloader (the #ORG says this). You still need to offset the CCS code above the small block at the bottom of memory containing the jump to the bootloader, and (if interrupts are used) the relocation for the interrupt vector, with the #build instruction in the CCS code. The build origin woud need to be the one your bootloader jumps to after it has finished.
On the fuses, normally the bootloader would be written to not change the fuses, so whatever the CCS code puts won't matter.

Best Wsihes
Kilobravo



Joined: 09 Sep 2011
Posts: 6

View user's profile Send private message AIM Address

PostPosted: Mon Sep 12, 2011 10:39 am     Reply with quote

I do have
#build(reset=0x1, interrupt=0x5) in the CCS code

The BL starts at 0xF00

Read of the chip with just the BL

:200000008A15002FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FAE

Then after the BL downloads the CCS program the chip is unresponsonsive
:20000000FF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3FFF3F00

The jump to the BL is gone ?


I will ask the Developer of the DS30 loader if the BL write the fuses or not. I am trying to eliminate the variables that may be causing this.

Thanks !
Ttelmah



Joined: 11 Mar 2010
Posts: 19499

View user's profile Send private message

PostPosted: Mon Sep 12, 2011 2:53 pm     Reply with quote

Can your bootloader correctly handle partial page updates?.
Remember that when programming the program memory, you have to erase an entire 'page' at a time. You haven't said your chip, but unless the page size is one byte. The bootloader will have to erase address 0, to write address 1. Hence it is normal to start the CCS code one page 'up' in memory, or the bootloader needs to understand partial page writes, and read the whole page, and just change the required bytes....

Best Wishes
Kilobravo



Joined: 09 Sep 2011
Posts: 6

View user's profile Send private message AIM Address

PostPosted: Mon Sep 12, 2011 3:05 pm     Reply with quote

PIC16F87

OK, I got it working somewhat.
from the DS30 compile

0000 158A 00237 PAGESEL blstart
0001 2F00 00238 goto blstart
00239
00240
00241 ;------------------------------------------------------------------------------
00242 ; GOTO user application
00243 ;------------------------------------------------------------------------------
0EFD 00244 org STARTADDR - 3 ;space to deposit goto to user application
0EFD 00245 loadusr
0EFD 0000 00246 nop ;page select, replaced by gui
0EFE 0000 00247 nop ;page select, replaced by gui
0EFF 0000 00248 nop ;goto, replaced by gui
00249
00250
00251 ;------------------------------------------------------------------------------
MPASM 5.42 DS30LOADER.ASM 9-12-2011 14:34:26 PAGE 18


LOC OBJECT CODE LINE SOURCE TEXT
VALUE

00252 ; Start of bootloader code
00253 ;------------------------------------------------------------------------------
0F00 00254 org STARTADDR

This is from my CCS C program.
#build(reset=0x0EFC)
which causes this
*
0EFC: MOVLW 00
0EFD: MOVWF 0A
0EFE: GOTO 0C4
0EFF: NOP

Then on the gui I select custom BL 8 pages from then end and 8 pages long

I also checked "Don't write GOTO to the user app"

The BL stays on the chip and will download a small blinky led "hello world" test program. The led flashing works the "hello world" does not. Based on the flashing led rate I think the timing for rs232 is off.

I will keep working on it as time permits.
Ttelmah



Joined: 11 Mar 2010
Posts: 19499

View user's profile Send private message

PostPosted: Tue Sep 13, 2011 3:05 am     Reply with quote

Notice, that in the assembler, your jump to the bootloader, is not at address 0. It is at address 1, which is where you were putting the CCS jump. No wonder it was getting overwritten.... The instruction at address 0, is the page select before the jump is performed.

Best Wishes
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