View previous topic :: View next topic |
Author |
Message |
tonkostz
Joined: 07 May 2011 Posts: 40 Location: Bulgaria
|
PIC18F4431 ccs bootloader problem (ex_bootloader.c) |
Posted: Wed Mar 05, 2014 1:34 am |
|
|
I am trying to make this bootloader work for this MCU with no success at all.
I use FT232RL chip and Tera Term program to transfer a small test program but it never works. I read PCM programmer post on how to use Tera Term and i made all needed changes in the connection settings (xon/xoff) and i read all posts about bootloader problems but still have no idea hot to make it work.
My compiler version is 4.120 PCH. ex_bootloader.c compiles with no errors but 2 warnings:
>>> Warning 224 "C:\Users\Homet\Desktop\ccs rs232 bootloader\bootloader.h" Line 28(12,23): #warning 64
>>> Warning 202 "ex_bootloader.c" Line 36(5,8): Variable never used: rs232_errors
Do i need to change bootloader size and addresses? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19498
|
|
Posted: Wed Mar 05, 2014 2:00 am |
|
|
Warnings, are _warnings_, not errors.
Search here about the RS232_ERRORS one.
The warning 64, may be a problem, but we can't tell, since you have obviously changed something. Line 28 of bootloader.h, is a comment line in the original file. It may well be a compiler warning, because of the spaces in the pathname (beware of these). |
|
|
tonkostz
Joined: 07 May 2011 Posts: 40 Location: Bulgaria
|
|
Posted: Wed Mar 05, 2014 2:56 am |
|
|
I tried the ccs example bootloader.c without changes except for the the device and fuses my application still don't work. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19498
|
|
Posted: Wed Mar 05, 2014 4:05 am |
|
|
It'll automatically be increasing the loader size to align to the page boundary.
The warning 64, is just a warning from the code to say 'think about the memory size'. Doesn't mean anything is wrong. In your case it'll make LOADER_END 0x4FF, since the erase size is 64 bytes.
1) Fuses in the bootloader, must match those in the application.
2) Have you tested a simple 'serial' program (loaded without the bootloader), with the same fuses, and verified the RS232 is working?.
3) Have you verified the pin to operate the bootloader is being seen etc.?.
4) You are following the 'bootload.c' example, and compiling the application to be loaded by the bootloader?.
5) What program are you using to do the 'load'?. |
|
|
tonkostz
Joined: 07 May 2011 Posts: 40 Location: Bulgaria
|
|
Posted: Wed Mar 05, 2014 4:18 am |
|
|
Thank you Ttelmah.
1. My fuses are exactly the same in the bootloader and in my application.
2. I have not tried the RS232 operation yet.
3. I think the bootloader pin is working correctly.
4. I use my own application program:
Code: | #include <18F4431.h>
#fuses H4,MCLR,NOWDT,NOPROTECT,NOLVP
#use delay(clock=40000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
#include <bootloader.h>
void main()
{
while(true)
{
output_high(PIN_B0);
delay_ms(500);
output_low(PIN_B0);
delay_ms(500);
}
} |
5. I first tried SIOW and it starts transfering the program and immediately stops with a timeout error.
Then i tried Tera Term with the correct settings for baud, flow control etc.
I successfully transferred my program to the pic but it does not work. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19498
|
|
Posted: Wed Mar 05, 2014 4:37 am |
|
|
I'd suspect the problem is with the B5 pin.
On the 4431, this is PWM4, and typically wakes up set as a PWM pin. Add the fuse NOPWMPIN to your settings. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Wed Mar 05, 2014 6:58 am |
|
|
You haven't added 'errors' to the use rs232(..options...).
program WILL hang without it
hth
jay |
|
|
tonkostz
Joined: 07 May 2011 Posts: 40 Location: Bulgaria
|
|
Posted: Wed Mar 05, 2014 1:13 pm |
|
|
I tried to add errors to the rs 232 options but then this warning appears.
>>> Warning 202 "ex_bootloader.c" Line 36(5,8): Variable never used: rs232_errors
Do i have to do something else with the errors option? |
|
|
newguy
Joined: 24 Jun 2004 Posts: 1907
|
|
Posted: Wed Mar 05, 2014 1:17 pm |
|
|
That's a problem with some versions of the compiler. I have that issue with 4.099 but 4.141 doesn't complain about that same code. Even with the warning, the compiler is actually handling RS 232 errors for you - just don't get too caught up with the warning. |
|
|
tonkostz
Joined: 07 May 2011 Posts: 40 Location: Bulgaria
|
|
Posted: Thu Mar 06, 2014 1:08 am |
|
|
I added the NOPWMPIN fuse and errors option in rs232.
I loaded the above program (with Tera Term) for blinking LED and after the transfer LED is not blinking, it is constantly in on state. I think that the program crashes somewhere but i don't know the reason.
If i try to load the program with Siow it starts loading and immediately shows the timeout error. |
|
|
tonkostz
Joined: 07 May 2011 Posts: 40 Location: Bulgaria
|
|
Posted: Fri Mar 07, 2014 9:03 am |
|
|
Is anyone tested the ccs bootloader on the 2331/2431/4331/4431 family mcu's?
I tried everything i could think of but after the upload the program is not working. |
|
|
|