mkkirchner
Joined: 30 Dec 2010 Posts: 3
|
TINY Bootloader at a 18F2585 |
Posted: Thu Dec 30, 2010 10:38 am |
|
|
Hi,
I use TINY Bootloader and the CCS compiler and I have the following problems with a 18F2585:
If I flash my Pic with a small test program directly, every works fine.
If I use the bootloader and flash the pic with my test program by the bootloader, the delay times (delay_ms(100)) are wrong, and the variables which I print out over the RS232 are also wrong (every time 0).
The Bootloader:
Code: |
radix DEC
LIST P=18F2585 ; change also: Configure->SelectDevice from Mplab
xtal EQU 20000000 ; you may want to change: _XT_OSC_1H _HS_OSC_1H _HSPLL_OSC_1H
baud EQU 115200 ; the desired baud rate
delaytime EQU 2000000 ; for 40MHz: 1000000 gets about 1sec, for 20MHZ: 2000000 gets about 1sec
; The above 4 lines can be changed and buid a bootloader for the desired frequency (and PIC type)
;********************************************************************
; Tiny Bootloader 18F series Size=100words
; claudiu.chiculita@ugal.ro
; http://www.etc.ugal.ro/cchiculita/software/picbootloader.htm
;********************************************************************
#include "../icdpictypes.inc" ;takes care of: #include "p18fxxx.inc", max_flash, IdTypePIC
#include "../spbrgselect.inc" ; RoundResult and baud_rate
#define first_address max_flash-200 ;100 words
;can we dump these ? winpic etc have the function of configuring all
__CONFIG _CONFIG1H, _OSC_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
; __CONFIG _CONFIG2L, _PWRT_OFF_2L & _BOREN_OFF_2L
; __CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_1_2H
; __CONFIG _CONFIG3H, _MCLRE_ON_3H & _PBADEN_OFF_3H ;& _CCP2MX_PORTBE_3H not in 4680
; __CONFIG _CONFIG4L, _DEBUG_OFF_4L & _LVP_OFF_4L & _STVREN_OFF_4L & _XINST_OFF_4L
; __CONFIG _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L
; __CONFIG _CONFIG5H, _CPB_OFF_5H
; __CONFIG _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L
; __CONFIG _CONFIG6H, _WRTB_OFF_6H & _WRTC_OFF_6H
; __CONFIG _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L & _EBTR2_OFF_7L
; __CONFIG _CONFIG7H, _EBTRB_OFF_7H & _DEVID1 & _IDLOC0
|
And the small test program:
Code: |
while(1)
{
i++;
U=4;
output_high(PIN_C4);
delay_ms(1000);
output_high(PIN_C5);
delay_ms(1000);
output_low(PIN_C5);
output_low(PIN_C4);
delay_ms(1000);
printf("SS I=%lu Xc=%c Xd%d Ud=%ld\r\n",i,x,x,u);
}
|
Can anybody help??
Thanks
martin |
|