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

16F690 BootLoader ?H E L P

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







16F690 BootLoader ?H E L P
PostPosted: Thu Dec 13, 2007 12:58 am     Reply with quote

Good Day all,

I'm using CCS 4.033.
I have difficulties making a bootloader for 16f690.
I tried to modify the Tiny BL's code.. however it comes out a lot of errors.
Any1 have any idea how to make 1?

Below is a quote from other forum to modify the file.. i followed it, but however..... problems occured in STEP 2.

Quote:

1. I need to modify the file tinybld16f.asm.

original file:
radix DEC
LIST P=16F876A, F=INHX8M ; change also: Configure->SelectDevice from Mplab
xtal EQU 20000000 ; you may also want to change: _HS_OSC _XT_OSC
baud EQU 115200 ; standard TinyBld baud rates: 115200 or 19200
; The above 3 lines can be changed and buid a bootloader for the desired frequency and PIC type
_______________________________

my modified file:
radix DEC
LIST P=16F690, F=INHX8M ; (enter 16F877, not 16F877A)
_HS_OSC EQU 18432000
baud EQU 9600


1a.
Modify tiny PIC bootloader's file

in line 26 to 30
replace
___________________________________

IFDEF __16F873A
#include "p16f873A.inc"
IdTypePIC = 0x32
#define max_flash 0x1000
ENDIF
___________________________________


with

___________________________________

IFDEF __16F690
#include "p16f690.inc"
IdTypePIC = 0x32
#define max_flash 0x1000
ENDIF___________________________________


2. Next step would be to open MPLAB, change the target to PIC16F877 (not: 877A!), open your modified tinybld16f.asm and project/quickbuild tinybld16f.asm. Then enable your Picstart plus programmer, stick the 16F877 in and press the build button.

3. Now the big step: Using C2C compiler, you need to add the 4 lines to your main file (let's call it MAIN) in order to keep the bootloader working:
#pragma RESERVE_ADDR_0 clrf 0x3
#pragma RESERVE_ADDR_1 movlw 0x00
#pragma RESERVE_ADDR_2 movwf 0xA
#pragma RESERVE_ADDR_3 goto start__code

This code goes right before the following lines:
#include "system.h"
#pragma CLOCK_FREQ 20000000

4. Compile, debug using C2C compiler. Result: MAIN.asm
Then build MAIN.ASM in MPLAB, result will be MAIN.hex

5. Re-insert the PIC, connect the serial cable via Max323 level converter chip to my PC and the PIC, then start tinybldWin.exe on your PC.

6. Browse for "MAIN.hex" and press the Writeflash button

7. Next, as long as TinyPICbootloader is searching for the PIC, quickly connect power to the PIC or reset it. If the settings are OK (Baudrate, COM port), tinybldWin.exe will detect the PIC. It says something like: "PIC16F873A/4A found", although it's an 877.

7a. After downloading, the PIC resets itself and starts with the new program.

8. That's it! After the next change of MAIN, you can loop directly to 4.


It WORKS and I can recommend using this bootloader to everybody. It takes away a lot of hassle from PIC programming.


During Step 2..
I get this ERRORS from my MP LAB:

Quote:


Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F690 "tinybld16F.asm" /l"tinybld16F.lst" /e"tinybld16F.err"
Error[115] C:\PROGRAM FILES\MICROCHIP\MPASM SUITE\P16F690.INC 596 : Duplicate label ("_HS_OSC" or redefining symbol that cannot be redefined)
Error[113] D:\TINYBL\TINYBLD195\PICSOURCE\16F\../SPBRGSELECT.INC 3 : Symbol not previously defined (xtal)
Error[113] D:\TINYBL\TINYBLD195\PICSOURCE\16F\../SPBRGSELECT.INC 4 : Symbol not previously defined (xtal)
Error[113] D:\TINYBL\TINYBLD195\PICSOURCE\16F\../SPBRGSELECT.INC 5 : Symbol not previously defined (xtal)
Error[113] D:\TINYBL\TINYBLD195\PICSOURCE\16F\../SPBRGSELECT.INC 3 : Symbol not previously defined (xtal)
Error[114] D:\TINYBL\TINYBLD195\PICSOURCE\16F\../SPBRGSELECT.INC 3 : Divide by zero
Error[113] D:\TINYBL\TINYBLD195\PICSOURCE\16F\../SPBRGSELECT.INC 4 : Symbol not previously defined (xtal)
Error[113] D:\TINYBL\TINYBLD195\PICSOURCE\16F\../SPBRGSELECT.INC 5 : Symbol not previously defined (xtal)
Error[101] D:\TINYBL\TINYBLD195\PICSOURCE\16F\../SPBRGSELECT.INC 29 : ERROR: (big error in baudrate: 99%)
Message[301] D:\TINYBL\TINYBLD195\PICSOURCE\16F\../SPBRGSELECT.INC 32 : MESSAGE: (baudrate not exact: 99%)
Error[113] D:\TINYBL\TINYBLD195\PICSOURCE\16F\TINYBLD16F.ASM 18 : Symbol not previously defined (_BODEN_ON)
Error[113] D:\TINYBL\TINYBLD195\PICSOURCE\16F\TINYBLD16F.ASM 18 : Symbol not previously defined (_LVP_OFF)
Error[113] D:\TINYBL\TINYBLD195\PICSOURCE\16F\TINYBLD16F.ASM 18 : Symbol not previously defined (_DEBUG_OFF)
Error[113] D:\TINYBL\TINYBLD195\PICSOURCE\16F\TINYBLD16F.ASM 153 : Symbol not previously defined (xtal)
Halting build on first failure as requested.
BUILD FAILED: Thu Dec 13 14:39:45 2007



:(
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Dec 13, 2007 1:43 am     Reply with quote

Here's the 16F690 data sheet:
http://ww1.microchip.com/downloads/en/DeviceDoc/41262D.pdf

In this section, it says that Program Memory can be read.
It doesn't say you can write to it.
Quote:

10.0 DATA EEPROM AND FLASH
PROGRAM MEMORY CONTROL
Data EEPROM memory is readable and writable and
the Flash program memory (PIC16F685/PIC16F689/
PIC16F690 only) is readable during normal operation
(full VDD range).



In this section, it says that if you try to write to Program Memory,
it will not perform the operation.
Quote:

REGISTER 10-5: EECON1: EEPROM CONTROL REGISTER
bit 7 EEPGD: Program/Data EEPROM Select bit (1)
1 = Accesses program memory
0 = Accesses data memory

Note:
2: If the WR bit is set when EEPGD = 1, it
will be immediately reset to ‘0’ and no
operation will take place
.


For a bootloader, the PIC must have the ability to write to its own
program memory. But the 16F690 can't do this.
F690
Guest







PostPosted: Thu Dec 13, 2007 2:55 am     Reply with quote

Does this mean that there is absolutely no way to implement a bootloader in PIC16F690?
Ttelmah
Guest







PostPosted: Thu Dec 13, 2007 3:54 am     Reply with quote

I'm afraid so. A limitation of this chip.

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