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

Bootloader timeout error , please help!!!!

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



Joined: 20 Sep 2006
Posts: 19

View user's profile Send private message

Bootloader timeout error , please help!!!!
PostPosted: Sat Apr 14, 2007 8:37 am     Reply with quote

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 .
faizanbrohi



Joined: 20 Sep 2006
Posts: 19

View user's profile Send private message

PostPosted: Sun Apr 15, 2007 11:50 am     Reply with quote

Please Help anyone !!!!! Sad
jma_1



Joined: 08 Feb 2005
Posts: 147
Location: Wisconsin

View user's profile Send private message

PostPosted: Mon Apr 16, 2007 12:14 pm     Reply with quote

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)?
mskala



Joined: 06 Mar 2007
Posts: 100
Location: Massachusetts, USA

View user's profile Send private message

PostPosted: Mon Apr 16, 2007 1:18 pm     Reply with quote

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
faizanbrohi



Joined: 20 Sep 2006
Posts: 19

View user's profile Send private message

PostPosted: Mon Apr 16, 2007 4:14 pm     Reply with quote

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.
Foppie



Joined: 16 Sep 2005
Posts: 138
Location: The Netherlands

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Tue Apr 17, 2007 2:01 am     Reply with quote

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
faizanbrohi



Joined: 20 Sep 2006
Posts: 19

View user's profile Send private message

PostPosted: Tue Apr 17, 2007 11:41 am     Reply with quote

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 " );



}
jma_1



Joined: 08 Feb 2005
Posts: 147
Location: Wisconsin

View user's profile Send private message

PostPosted: Tue Apr 17, 2007 11:54 am     Reply with quote

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
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Apr 17, 2007 11:59 am     Reply with quote

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 ?
faizanbrohi



Joined: 20 Sep 2006
Posts: 19

View user's profile Send private message

PostPosted: Tue Apr 17, 2007 12:34 pm     Reply with quote

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 .
jma_1



Joined: 08 Feb 2005
Posts: 147
Location: Wisconsin

View user's profile Send private message

PostPosted: Tue Apr 17, 2007 1:00 pm     Reply with quote

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.
faizanbrohi



Joined: 20 Sep 2006
Posts: 19

View user's profile Send private message

PostPosted: Thu Apr 19, 2007 7:14 am     Reply with quote

The Problem was with the memory mapping , it is solved now.
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