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

Bootloader + RS232 (HyperTerminal ?)

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



Joined: 12 Dec 2005
Posts: 50
Location: Curitiba - Brazil

View user's profile Send private message Send e-mail

Bootloader + RS232 (HyperTerminal ?)
PostPosted: Wed Mar 22, 2006 6:32 am     Reply with quote

Hi all,

What program can I use to download .hex file with bootloader.c and loader.c ? Is it possible to use Hyperterminal from Windows ?
RS232 must be used.

I want to download a long file to EXTERNAL FLASH PROGRAM memory. But I cannot download the file straightforward because I think bootloader cannot handle that big amount of data to be programmed. So bootloader must ask for furhter data when it is ready, but can Hyperterminal work like this ?

I am using PIC18F8680 external flash program memory AM29F800B MPLAB7.31 and CCS 3.241.
I plan to use the Extended Microcontroller Mode (EMCU).

Thanks in advance for any help.
Pasini
jma_1



Joined: 08 Feb 2005
Posts: 147
Location: Wisconsin

View user's profile Send private message

PostPosted: Wed Mar 22, 2006 7:41 am     Reply with quote

Greetings,

I believe HyperTerminal will work to download a hex file (Transfer->Send Text File).

HyperTerminal does not have any kind of programming interface. Trying to include a protocol into it, without user interaction does not seem possible.

How about sending a command from the embedded code signalling loading of external flash memory? (then user selects additional code to download).

Another option would be to create your own loader application which controls a serial port. I remember seeing a post with VB code which could be a template for your application.

Cheers,
JMA
pasini



Joined: 12 Dec 2005
Posts: 50
Location: Curitiba - Brazil

View user's profile Send private message Send e-mail

PostPosted: Wed Mar 22, 2006 8:35 am     Reply with quote

What do you mean by
Quote:
command from the embedded code signalling loading of external flash memory
?
If bootloader asks for more data then I cannot use the bootload.c and loader.c, alright ?

I think I will create my own Windows app to download the file. I have some apps almost ready for use.

Thanks
Pasini
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Wed Mar 22, 2006 8:47 am     Reply with quote

Do anyone ever read the comments (or code) in the files?!!

Code:

////  This program uses the loader driver to show how you can        ////
////  read and write to an internal program memory.                  ////
////                                                                 ////
////  The LOADER.C will take an Intel 8-bit Hex file over RS232      ////
////  and modify the flash program memory with the new code.         ////
////                                                                 ////
////  After each good line, the loader sends an ACK character.  The  ////
////  driver uses XON/XOFF flow control.  Also, any buffer on the PC ////
////  UART must be turned off, or to its lowest setting, otherwise it////
////  will miss data.                                                ////
////                                                                 ////
////  A program such as Hyper-Term may be used to simply transmit the////
////  .HEX file output from the compiler.                            ////
////                                                                 ////


Obivously the loader.c file is intended to write to the internal program memory so you will have to modify it to write to your external flash. Don't expect to find an example that will work for you. You are going to have to do some code writing to get what you want. The loader.c would be a good start since it handles the RS232 and hex files.
pasini



Joined: 12 Dec 2005
Posts: 50
Location: Curitiba - Brazil

View user's profile Send private message Send e-mail

PostPosted: Wed Mar 22, 2006 2:30 pm     Reply with quote

Yes, I got it. RTFDS (read the [censored] data sheet !!!!!!!)
Hyperterminal will transmit the .hex as I want.

But now the problem is with the code I want to write in the external memory, which begins at 0x10000.
Why the following code does not compile, since it is intended to be entirely in the external memory ?
In the internal memory I have the bootloader and in the external memory I want my application, which begins at 0x10000.
The error is INVALID ORG RANGE. Why is that if I have 512kwords memory ?


Code:

#include "18f8680.h"
#device *=16 ADC=10
//#fuses HS,NOWDT,NOPROTECT,NOLVP
#fuses HS,NOWDT,NOPUT,NOPROTECT,BROWNOUT,NOLVP,NOCPD,NOWRT,EMCU//,WAIT //,NODEBUG
#use delay(clock=20000000)
#use rs232(stream=RS232,baud=9600,xmit=PIN_C6,rcv=PIN_C7,parity=N,bits=8)
//#use FAST_IO (C)
#case


#define BASE 0x010000
#define BUZZER            PIN_C2
#define LigaBuzzer()      output_high(BUZZER)
#define DesligaBuzzer()      output_low(BUZZER)

void main(void)
{
}

#org 0x10000
void retorno_isr(void)
{
/*   #asm
      MOVFF  0F,00
      MOVFF  10,01
      MOVFF  11,02
      MOVFF  12,03
      MOVFF  13,04
      MOVFF  0D,FE9
      MOVFF  08,FEA
      MOVFF  09,FE1
      MOVFF  0A,FE2
      MOVFF  0B,FD9
      MOVFF  0C,FDA
      MOVFF  14,FF3
      MOVFF  15,FF4
      MOVFF  16,FFA
      MOVFF  05,FE8
      MOVFF  07,FE0
      MOVFF  06,FD8
      RETFIE 0
   #endasm
*/   
}

#org 0x10100, 0x101FE
void TIMER0_isr(void)
{

   #asm
      goto 0x10000
   #endasm   
}

#org 0x10200, 0x102FE
void TIMER2_isr(void)
{
   
   
   #asm
      goto 0x10000
   #endasm
}

#org 0x10300, 0x103FE
void main2(void)
{
   while(1)
   {
      LigaBuzzer();
      delay_ms(25);
      DesligaBuzzer();
      delay_ms(25);
   }
}
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