|
|
View previous topic :: View next topic |
Author |
Message |
Guest
|
18F452 with CCS Bootloader Problem (Yes I Have searched!) |
Posted: Tue Oct 23, 2007 6:39 pm |
|
|
I have a question which seems to come up often. I have searched through the forum and I believe I am running into a memory mapping problem. I am using the default CCS bootloader that is included. I then try to load the file testprogram.c using Siow and I run into a Timeout Error when i select Download Software and attempt to send the hex file. I read through other posts that the problem could be where the application is being written and it may be being overwritten. I did not understand the exact problem and was hoping someone could explain it to me in a non-technical standpoint. I would appreciate it greatly!
I have used the test program, without the bootloader and it works great. I am also able to send/receive information over the RS-232 link.
I am using the standard bootloader.h and loader.c, unchanged.
Thanks in advance for the help, as always!
Here is the bootloader.c I am using (Same as CCS'):
Code: |
///////////////////////////////////////////////////////////////////////////
//// EX_BOOTLOADER.C ////
//// ////
//// This program is an example stand alone bootloader. ////
//// ////
//// This program must be loaded into a target chip using a device ////
//// programmer. Afterwards this program may be used to load new ////
//// versions of the application program. ////
//// ////
//// This bootloader is designed to detect pin B5 low on reset. It ////
//// will then use the RS232 link to download a new program. ////
//// Otherwise the application program is started. ////
//// ////
//// Use an RS232 link and the SIOW.EXE program to load a new HEX ////
//// file into the target chip. ////
//// ////
//// This example will work with the PCM and PCH compilers. The ////
//// following conditional compilation lines are used to include a ////
//// valid device for each compiler. Change the device, clock and ////
//// RS232 pins for your hardware if needed. ////
///////////////////////////////////////////////////////////////////////////
//// (C) Copyright 1996,2004 Custom Computer Services ////
//// This source code may only be used by licensed users of the CCS ////
//// C compiler. This source code may only be distributed to other ////
//// licensed users of the CCS C compiler. No other use, ////
//// reproduction or distribution is permitted without written ////
//// permission. Derivative programs created using this software ////
//// in object code form are not restricted in any way. ////
///////////////////////////////////////////////////////////////////////////
#include <18F452.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7) // Jumpers: 8 to 11, 7 to 12
#define _bootloader
#include <bootloader.h>
#include <loader.c>
#org LOADER_END+2,LOADER_END+20
void application(void) {
while(TRUE);
}
#org 0x40,0x7F
void main(void) {
if(!input(PIN_B5))
{
load_program();
}
application();
}
#ORG default
#int_global
void isr(void) {
jump_to_isr(LOADER_END+5*(getenv("BITS_PER_INSTRUCTION")/8));
}
|
I am using the standard bootloader.h and loader.c, unchanged.
Here is my testprogram.c:
Code: |
#include <18F452.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=4000000)
#use rs232(baud=9600, parity=N, xmit=PIN_C6, rcv=PIN_C7, bits=8)
#include <bootloader.h>
void main(void) {
int i=0;
for(i=0;i<5;i++) {
output_high(PIN_B0);
delay_ms(500);
output_low(PIN_B0);
delay_ms(500);
}
i = 0;
printf("\r\n-------------------------------- \r\n");
printf("\r\n- Serial Communications Test - \r\n");
printf("\r\n-------------------------------- \r\n");
while(TRUE) {
printf("%u \r\n",++i);
delay_ms(1000);
}
}
|
|
|
|
scaven92
Joined: 06 Oct 2006 Posts: 44
|
|
|
|
|
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
|