![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
faizanbrohi
Joined: 20 Sep 2006 Posts: 19
|
Bootloader timeout error , please help!!!! |
Posted: Sat Apr 14, 2007 8:37 am |
|
|
Hello ,
i have just started using a bootloader in my program . i have used the ex_bootloader.c example file . i have done everything right . when i try to load the aapplication program using siow.exe , it says time out error ,
I have used only the load_program() function in the main function to test it and it does not load any thing , it just says timeout . i am using RS485
The code is ,
Bootloader_test.c
Code: | #include <18F2520.h>
#fuses NOWDT,NOLVP,MCLR, NOPBADEN, NOFCMEN, INTRC_IO, NOPROTECT, WRTD
// 87654321
#use delay (clock=32000000)
#use rs232 (baud=9.6k, rcv=PIN_C7, xmit=PIN_C6, enable=PIN_B1)
#define _bootloader
#include <bootloader.h>
#include <loader.c>
//#if defined(__PCM__)
// #org LOADER_END+1,LOADER_END+10
//#elif defined(__PCH__)
// #org LOADER_END+2,LOADER_END+20
//#endif
void application(void) {
printf(" Appliction Program Started " );
}
//#if defined(__PCH__)
//#org 0x40,0x7F
//#else
//#org 0x20,0x3F
//#endif
void main(void) {
// if(!input(PIN_B5))
// {
printf("Loading Program .....");
load_program();
printf (" Program Loaded Success !");
// }
application();
}
//#ORG default
//#int_global
//void isr(void) {
// jump_to_isr(LOADER_END+5*(getenv("BITS_PER_INSTRUCTION")/8));
//}
|
Bootload_test.c
Code: | #include <18F2520.h>
#fuses NOWDT,NOLVP,MCLR, NOPBADEN, NOFCMEN, INTRC_IO, NOPROTECT, WRTD
// 87654321
#use delay (clock=32000000)
#use rs232 (baud=9.6k, rcv=PIN_C7, xmit=PIN_C6, enable=PIN_B1)
//#define _bootloader
#include <bootloader.h>
//#if defined(__PCM__)
// #org LOADER_END+1,LOADER_END+10
//#elif defined(__PCH__)
// #org LOADER_END+2,LOADER_END+20
//#endif
//#if defined(__PCH__)
//#org 0x40,0x7F
//#else
//#org 0x20,0x3F
//#endif
void main(void) {
// if(!input(PIN_B5))
// {
printf(" Appliction Program Loaded v1.0 " );
}
//#ORG default
//#int_global
//void isr(void) {
// jump_to_isr(LOADER_END+5*(getenv("BITS_PER_INSTRUCTION")/8));
//}
|
Please help , i am really confused . |
|
![](templates/subSilver/images/spacer.gif) |
faizanbrohi
Joined: 20 Sep 2006 Posts: 19
|
|
Posted: Sun Apr 15, 2007 11:50 am |
|
|
Please Help anyone !!!!! ![Sad](images/smiles/icon_sad.gif) |
|
![](templates/subSilver/images/spacer.gif) |
jma_1
Joined: 08 Feb 2005 Posts: 147 Location: Wisconsin
|
|
Posted: Mon Apr 16, 2007 12:14 pm |
|
|
Greetings,
I am not sure the baud rate will accept your notation. I would change 9.6k to 9600. I have not verified this, but it is worth trying.
Both of your files are named the same thing. This is confusing. If you comment everything out, remove all the commented out lines and repost the code.
Have you gotten the example bootloader application to work which ships with the compiler? Why have you removed all the asm statements from your software (remaps interrupt vectors; specifies where to place code).
Does RS485 communication work from within the application normally (verification communication setup)? |
|
![](templates/subSilver/images/spacer.gif) |
mskala
Joined: 06 Mar 2007 Posts: 100 Location: Massachusetts, USA
|
|
Posted: Mon Apr 16, 2007 1:18 pm |
|
|
I don't know anything about RS485 so I didn't comment on this before, but I did compare compiling version with 9600 vs 9.6k and they produced the same result. So that isn't the problem.
Can you try doing this with RS232 as the files were designed for, then move forward from there?
Mark s |
|
![](templates/subSilver/images/spacer.gif) |
faizanbrohi
Joined: 20 Sep 2006 Posts: 19
|
|
Posted: Mon Apr 16, 2007 4:14 pm |
|
|
Hello and Thanks for the reply , i have used the org statements now , but the problem is that there is a error in the statements . it doest not compile , it does compile when i remove the statements of printf . what seems to be the problem with the org statements. and i have tested with them also , still timeout error occurs . And the RS485 communication also works fine. |
|
![](templates/subSilver/images/spacer.gif) |
Foppie
Joined: 16 Sep 2005 Posts: 138 Location: The Netherlands
|
|
Posted: Tue Apr 17, 2007 2:01 am |
|
|
faizanbrohi wrote: | Hello and Thanks for the reply , i have used the org statements now , but the problem is that there is a error in the statements . it doest not compile , it does compile when i remove the statements of printf . what seems to be the problem with the org statements. |
I think the problem is that the printf statement take to much codespace.
As you can see your org statement says that main() should be allocated between adress 0x40 and 0x7F, but this might not be enough space.
Maybe someone with more experience with bootloaders give some more advice in changing these values.
Hope this helps, Jos |
|
![](templates/subSilver/images/spacer.gif) |
faizanbrohi
Joined: 20 Sep 2006 Posts: 19
|
|
Posted: Tue Apr 17, 2007 11:41 am |
|
|
Here is the updated code , please note that the Interface is RS485 and the IC is PIC18F2520 , so is there any changing needed for this IC .
Bootloader_test.c
(this is the Bootloader program to be inserted to the PIC18F2520 the first time using device programmer .
Code: | #include <18F2520.h>
#fuses NOWDT,NOLVP,MCLR, NOPBADEN, NOFCMEN, INTRC_IO, NOPROTECT, WRTD
// 87654321
#use delay (clock=32000000)
#use rs232 (baud=9.6k, rcv=PIN_C7, xmit=PIN_C6, enable=PIN_B1)
#define _bootloader
#include <bootloader.h>
#include <loader.c>
#if defined(__PCM__)
#org LOADER_END+1,LOADER_END+10
#elif defined(__PCH__)
#org LOADER_END+2,LOADER_END+20
#endif
void application(void) {
// printf(" Appliction Program Started " );
}
#if defined(__PCH__)
#org 0x40,0x7F
#else
#org 0x20,0x3F
#endif
void main(void) {
// if(!input(PIN_B5))
// {
// printf("Loading Program .....");
load_program();
// printf (" Program Loaded Success !");
// }
application();
}
#ORG default
#int_global
void isr(void) {
jump_to_isr(LOADER_END+5*(getenv("BITS_PER_INSTRUCTION")/8));
}
|
Bootload_test.c
This the Application test program that is loaded.
Code: | #include <18F2520.h>
#fuses NOWDT,NOLVP,MCLR, NOPBADEN, NOFCMEN, INTRC_IO, NOPROTECT, WRTD
#use delay (clock=32000000)
#use rs232 (baud=9.6k, rcv=PIN_C7, xmit=PIN_C6, enable=PIN_B1)
#include <bootloader.h>
void main(void) {
printf(" Appliction Program Loaded v1.0 " );
}
|
|
|
![](templates/subSilver/images/spacer.gif) |
jma_1
Joined: 08 Feb 2005 Posts: 147 Location: Wisconsin
|
|
Posted: Tue Apr 17, 2007 11:54 am |
|
|
Greetings,
Has the problem been solved? What happens when you removed the printf(s)?
Assuming still a problem:
Do you get a time out error?
Try modifying the loader.c file to transit a char for debugging (putc()). I'm going from memory here, but the loader.c protocol uses XON / XOFF.
The Siow.exe application has the ability to capture data to a log file. This might be tedious, but using the putc() function to insert debugging statements to determine where the break down is might be the quickest solution.
Cheers,
JMA |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Apr 17, 2007 11:59 am |
|
|
Quote: |
When I try to load the application program using siow.exe,
it says time out error. |
You said you're getting a "Timeout error". Does this message come
from the SIOW.exe program ? I don't have that program. It comes
with the CCS IDE (PCWH), and I only buy the command line compilers.
Does the SIOW.exe program have a manual or a help file that explains
what the "timeout error" message means ?
Presumably it's waiting for some status to go True, and it never does.
To help on your problem, I need to know more about SIOW.exe.
Is it just a dumb serial terminal program ? |
|
![](templates/subSilver/images/spacer.gif) |
faizanbrohi
Joined: 20 Sep 2006 Posts: 19
|
|
Posted: Tue Apr 17, 2007 12:34 pm |
|
|
SIOW.exe ships with the PCW Compiler , i can give it to you i have it , it is a terminal program that is used to download a program into the PIC using serial port . the load_program function which is under loader.c waits until a valid hex file is sent by siow.exe and then the programming begins , the program is stuck at load_program and when i download the application program it says timout. i have checked the baudrate , everything . PCM Programmer can you give me some bootloader program that i can use with the PIC18F2520 which you have tested. That would be really helpful . |
|
![](templates/subSilver/images/spacer.gif) |
jma_1
Joined: 08 Feb 2005 Posts: 147 Location: Wisconsin
|
|
Posted: Tue Apr 17, 2007 1:00 pm |
|
|
How about adding putc() debug statements?
This would ensure:
1) application is entering bootmode
2) record packet is received by PIC
3) PIC transmits record reception correctness (ACK/NAK) each packet
Perhaps there is a time delay with the SIOW application and the RS485 device you are using to transmit from the PC. |
|
![](templates/subSilver/images/spacer.gif) |
faizanbrohi
Joined: 20 Sep 2006 Posts: 19
|
|
Posted: Thu Apr 19, 2007 7:14 am |
|
|
The Problem was with the memory mapping , it is solved now. |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|