View previous topic :: View next topic |
Author |
Message |
jecottrell
Joined: 16 Jan 2005 Posts: 559 Location: Tucson, AZ
|
TinyPIC (.......again) |
Posted: Thu Jan 12, 2006 2:55 pm |
|
|
Hello All,
I apologize in advance for the rehash of this topic. I have seen that it generates quite a bit of frustration in the experts. But I couldn't find the asnwer to my question.... so, I'll take one more swat at the dead horse...
I've spent some time trying to get a bootloader working and have had limited success. (I tried CCS' and gave up....)
My current issue is with Tiny PIC Bootloader. I can make the changes required for the 18F452 and compile the ASM in MPASM. I can program the part. I can load my application HEX via the terminal application provided w/ Tiny PIC. It runs normally after cycling power to the PIC. HOWEVER, I can't reprogram via bootloader after the first time.
I originally thought it was a problem w/ the goto MAIN requirement but happened upon a thread that clarified that question just as I was ready to post... So now it comes down to trying to understand what would cause successful initial programming followed by failure. Apparently it must be something in my code that prevents it...
Sorry for the run on, but I keep on trying things as I write...
I paired down my code and even disabled the int_rda... still no luck. Any ideas why I may not be able to communicate with the PIC after initial programming?
Thanks,
John |
|
|
Jerry I
Joined: 14 Sep 2003 Posts: 96 Location: Toronto, Ontario, Canada
|
TinyBoot Loader |
Posted: Thu Jan 12, 2006 4:29 pm |
|
|
I just added the frequency of tha crystal I am using to assemble tinybootldr
and never had a problem.
I am using 9.8304Mhz for most of my projects.
What Crystal are you using
Are you using H4 in your config for CCS?. |
|
|
jecottrell
Joined: 16 Jan 2005 Posts: 559 Location: Tucson, AZ
|
|
Posted: Thu Jan 12, 2006 5:38 pm |
|
|
I'm using 20MHz crystal and HS setting.
My problems with the CCS loader.c attempt at getting a bootloader working seems to be a serial com problem. I've tried SIOW, HT, TeraTerm... I can't figure out how to fix the PC UART buffer problem as outlined in the comments of loader.c....
Jerry,
Are you using interrupts in your code (not bootloader)?
Thanks,
John |
|
|
Jerry I
Joined: 14 Sep 2003 Posts: 96 Location: Toronto, Ontario, Canada
|
|
Posted: Thu Jan 12, 2006 6:53 pm |
|
|
Iam confused are you using Tiny BootLoader from this site.
http://www.etc.ugal.ro/cchiculita/software/picbootloader.htm
Here you talk about CCS loader.c ?????
jecottrell wrote: | I'm using 20MHz crystal and HS setting.
My problems with the CCS loader.c attempt at getting a bootloader working seems to be a serial com problem. I've tried SIOW, HT, TeraTerm... I can't figure out how to fix the PC UART buffer problem as outlined in the comments of loader.c....
Jerry,
Are you using interrupts in your code (not bootloader)?
Thanks,
John |
|
|
|
jecottrell
Joined: 16 Jan 2005 Posts: 559 Location: Tucson, AZ
|
|
Posted: Thu Jan 12, 2006 9:22 pm |
|
|
Sorry for the confusion. Getting a little punchy after working graveyard shifts then beating my head against the bootloader wall all day.
I've been attempting to get either one working.
I didn't clarify I was providing my issues with the CCS loader.c in the latter post.
Recap:
Tiny PIC problems:
Compile: OK
Install: OK
Program w/ first application: OK
Second program: BAD, com times out.
CCS loader.c problems:
Add loader.c to minimal project: OK
Compiles: OK
Install: OK
Program w/ first application: BAD, com times out (SIOW, HT, Flasher, TeraTerm)
Argggghhhhh. |
|
|
specialk
Joined: 12 Nov 2005 Posts: 27
|
|
Posted: Fri Jan 13, 2006 9:43 am |
|
|
I have been using the Tiny Bootloader with a number of different PICs with no problem whatsoever. I have used a PIC16F88, PIC18F252, and a PIC18F2550 and they have all worked perfectly. You may want to add the following code to the begining of your code listing:
Code: | #build(reset=0x1, interrupt=0x5) // Necessary for Bootloader
#ORG 0x0F00,0x0FFF {} // Necessary for Bootloader |
Also, a very important question is: Do you restart your PIC when the Tiny Bootloader Windows frontend is trying to connect to it? The bootloader will only send the start sequence when it is reset after programming. Try restarting your PIC when tinybldwin is searching for it and tell us what happens.
-special [k] |
|
|
jecottrell
Joined: 16 Jan 2005 Posts: 559 Location: Tucson, AZ
|
|
Posted: Fri Jan 13, 2006 1:28 pm |
|
|
SpecialK,
Thanks. I missed:
Quote: | On reset, waits 1 second (adjustable) for a message from the PC, if not received, launch user application; |
In the Tiny PIC documentation. Arggghhhhh. (I want my 2 days that I spent on this back.... maybe I'll learn to read instructions better.)
I was successful without the #org code, but I did try it. I received a "Invalid ORG range" error on compilation. I saw that other people were having similar problems w/ 3.326? I figured it shouldn't be a problem on the 452? Any ideas.
A sincere thank-you for spoon feeding me the instructions. Now I'll have to think a little more about how I'm going to incorporate this into projects... the reset requirement that is.
John |
|
|
specialk
Joined: 12 Nov 2005 Posts: 27
|
|
Posted: Fri Jan 13, 2006 6:04 pm |
|
|
I actually add the following serial interrupt code to all of my applications:
Code: | #INT_RDA
void serial_isr() // Serial Interrupt
{
int8 uReceive;
disable_interrupts(INT_RDA); // Disable Serial Recieve Interrupt
disable_interrupts(GLOBAL); // Disable Global Interrupts
uReceive = fgetc(PC);
switch (uReceive) {
case 0x12: {
if (fgetc(PC) == 0x34 & fgetc(PC) == 0x56 & fgetc(PC) == 0x78 & fgetc(PC) == 0x90) #asm reset #endasm
}
break;
default: printf("Unknown command (type ? for available commands)");
break;
}
enable_interrupts(INT_RDA); // Enable Serial Recieve Interrupt
enable_interrupts(GLOBAL); // Enable Global Interrupts
} | and setup tinybldwin to send "12h 34h 56h 78h 90h" before attempting to connect (see the "Options" tab). This means I hardly ever have to reset the PIC by hand.
-special [k] |
|
|
jecottrell
Joined: 16 Jan 2005 Posts: 559 Location: Tucson, AZ
|
|
Posted: Sat Jan 14, 2006 11:11 am |
|
|
Thanks for the help and the tip. I will give that a try when I get a chance. It will eventually come in handy when I attempt flashing via radio. I will probably use the standard serial interrupt ring buffer and move the switch statement out into the main code to shorten up the ISR. At this point I don't see why that wouldn't work. Have you had any negative experience that led you to put that code in the ISR?
Thanks again,
John |
|
|
|