ds30 works 1st time fails second time 18f6723 [abandoned] - Liamb - 2011-06-03
Hi all,
As the title says i have managed to get the bootloader to work but after i load anything for the first time I cant load anything else onto it. the pic im using is an 18F6723 and im using uart2 for the bootloader.
the following is my settings file
Code: ;------------------------------------------------------------------------------
;
; Title: ds30 Loader for PIC18F
;
; File description: user settings and configuration bits
;
; Copyright: Copyright � 09-11, Mikael Gustafsson
;
; History: 3.0.0 first version of this file
;
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
; This file is part of ds30 Loader.
;
; ds30 Loader is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation.
;
; ds30 Loader is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with ds30 Loader. If not, see <http://www.gnu.org/licenses/>.
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
; Device
;------------------------------------------------------------------------------
processor 18F6723 ;xxx
;------------------------------------------------------------------------------
; Includes
;------------------------------------------------------------------------------
#include "devices.inc"
;------------------------------------------------------------------------------
; User preferences
;------------------------------------------------------------------------------
radix DEC
#define OSCF 32000000 ;xxx oscillator frequency
#define BLINIT 2000 ;xxx hello receive timeout [ms]
#define HELLOTRIES 2 ;xxx number of non hello characters received before branching to the user application
#define BLTIME 2000 ;xxx data receive timeout [ms]
;------------------------------------------------------------------------------
; UART settings
;------------------------------------------------------------------------------
;#define USE_UART1 1 ;xxx uncomment to use uart1
#define USE_UART2 1 ;xxx uncomment to use uart2
#define BAUDRATE 115200 ;xxx baudrate
;#define USE_ABAUD 1 ;xxx uncomment to use auto baud rate detection, READ ERRATA FIRST
#define USE_BRG16 1 ;xxx uncomment to use 16-bit brg
;#define USE_TXENABLE 1 ;xxx uncomment to use a tx enable pin
#ifdef USE_TXENABLE
#define TRISR_TXE TRISC ;xxx tris register containing tx enable
#define LATR_TXE LATC ;xxx port register containing tx enable
#define TRISB_TXE TRISC6 ;xxx tris bit for tx enable
#define LATB_TXE RC6 ;xxx port bit for tx enable
#endif
;------------------------------------------------------------------------------
; CAN settings, commercial version only www.ds30loader.com
;------------------------------------------------------------------------------
;------------------------------------------------------------------------------
; Security, commercial version only www.ds30loader.com
;------------------------------------------------------------------------------'
;------------------------------------------------------------------------------
; Advanced settings
;------------------------------------------------------------------------------
#define PROT_GOTO 1 ;xxx protect goto at 0x00
#define PROT_BL 1 ;xxx protect bootloader
ifdef IS_PIC18F
#define BLPLP 8 ;bootloader placement, pages from end
#define BLSIZEP 8 ;bootloader size [pages], used by bootloader protection
endif
ifdef IS_PIC18FJ
#define BLPLP 2 ;bootloader placement, pages from end
#define BLSIZEP 1 ;bootloader size [pages], used by bootloader protection
endif
;------------------------------------------------------------------------------
; Configuration bits, these macros can be found at the end of the inc-files located in
; C:\Program Files\Microchip\MPASM Suite\
;
; These can also be set in MPLAB IDE instead, they are found in Configure->Configuration bits...
;------------------------------------------------------------------------------
; xxx
; config PLLDIV = 4 ;PLL Prescaler Selection bits
; config CPUDIV = OSC1_PLL2 ;System Clock Postscaler Selection bits
; config USBDIV = 2 ;USB Clock Selection bit (used in Full-Speed USB mode only; UCFG:FSEN = 1)
; config FOSC = HSPLL_HS ;Oscillator Selection bits
; config FCMEN = OFF ;Fail-Safe Clock Monitor Enable bit
; config IESO = OFF ;Internal/External Oscillator Switchover bit
; config PWRT = ON ;Power-up Timer Enable bit
; config BOR = OFF ;Brown-out Reset Enable bits
; config BORV = 0 ;Brown-out Reset Voltage bits
; config VREGEN = OFF ;USB Voltage Regulator Enable bit
; config WDT = OFF ;Watchdog Timer Enable bit
; config WDTPS = 1 ;Watchdog Timer Postscale Select bits
; config CCP2MX = OFF ;CCP2 MUX bit
; config PBADEN = OFF ;PORTB A/D Enable bit
; config LPT1OSC = OFF ;Low-Power Timer 1 Oscillator Enable bit
; config MCLRE = ON ;MCLR Pin Enable bit
; config STVREN = ON ;Stack Full/Underflow Reset Enable bit
; config LVP = OFF ;Single-Supply ICSP Enable bit
; config XINST = OFF ;Extended Instruction Set Enable bit
; config DEBUG = OFF ;Background Debugger Enable bit
; config CP0 = OFF ;Code Protection bit
; config CP1 = OFF ;Code Protection bit
; config CP2 = OFF ;Code Protection bit
; config CP3 = OFF ;Code Protection bit
; config CPB = OFF ;Boot Block Code Protection bi
; config CPD = OFF ;Data EEPROM Code Protection bit
; config WRT0 = OFF ;Write Protection bit
; config WRT1 = OFF ;Write Protection bit
; config WRT2 = OFF ;Write Protection bit
; config WRT3 = OFF ;Write Protection bit
; config WRTC = OFF ;Configuration Register Write Protection bit
; config WRTB = OFF ;Boot Block Write Protection bit
; config WRTD = OFF ;Data EEPROM Write Protection bit
; config EBTR0 = OFF ;Table Read Protection bit
; config EBTR1 = OFF ;Table Read Protection bit
; config EBTR2 = OFF ;Table Read Protection bit
; config EBTR3 = OFF ;Table Read Protection bit
; config EBTRB = OFF ;Boot Block Table Read Protection bit
CONFIG OSC = HSPLL
CONFIG FCMEN = OFF
CONFIG IESO = OFF
CONFIG PWRT = ON
CONFIG BOREN = OFF
CONFIG BORV = 0
CONFIG WDT = OFF
CONFIG WDTPS = 1
CONFIG CCP2MX = PORTE
CONFIG LPT1OSC = OFF
CONFIG MCLRE = ON
CONFIG STVREN = OFF
CONFIG LVP = OFF
CONFIG BBSIZ = BB4K
CONFIG XINST = OFF
CONFIG DEBUG = OFF
CONFIG CP0 = OFF
CONFIG CP1 = OFF
CONFIG CP2 = OFF
CONFIG CP3 = OFF
CONFIG CP4 = OFF
CONFIG CP5 = OFF
CONFIG CP6 = OFF
CONFIG CP7 = OFF
CONFIG CPB = OFF
CONFIG CPD = OFF
CONFIG WRT0 = OFF
CONFIG WRT1 = OFF
CONFIG WRT2 = OFF
CONFIG WRT3 = OFF
CONFIG WRT4 = OFF
CONFIG WRT5 = OFF
CONFIG WRT6 = OFF
CONFIG WRT7 = OFF
CONFIG WRTC = OFF
CONFIG WRTB = OFF
CONFIG WRTD = OFF
CONFIG EBTR0 = OFF
CONFIG EBTR1 = OFF
CONFIG EBTR2 = OFF
CONFIG EBTR3 = OFF
CONFIG EBTR4 = OFF
CONFIG EBTR5 = OFF
CONFIG EBTR6 = OFF
CONFIG EBTR7 = OFF
CONFIG EBTRB = OFF
;------------------------------------------------------------------------------
; End of file
;------------------------------------------------------------------------------
The following is the test file I have been trying to load with the bootloader
Code: #include <18f6723.h>
#fuses none
void main()
{
int a = 1 , b = 0;
while(a)
{
b++;
}
}
Another thing, I tried changing the oscf to 8000000 and the osc to hc but when i did this i got the following error from the bl gui
Quote:Initiating write...
Searching for bl .
Found PIC18F6723 fw ver. 3.0.0
Waiting for bootloader to be ready...ok
Writing flash ... unknown response 0x00, 1 try
Writing flash ... The hardware detected a framing error.
Write failed
Tx 153 bytes / Rx 8 bytes/0.5s
Thanks in advance for your help
Liam
RE: ds30 works 1st time fails second time 18f6723 - Mikael Gustavsson - 2011-06-06
Hi,
Did you write configs? If you did, please try without doing that.
Mikael
RE: ds30 works 1st time fails second time 18f6723 - Liamb - 2011-06-07
Hi Mikael,
there are configs set in the ds30 loader program as you can see from the settings file. the program i used to test the bootloader is a very simple program containing a basic loop, this was programmed using the ccs PCH compiler and has the line "Fuses none" in it that makes there be no config bits set and when i load the program into the bootloader gui it says the following.
Quote:Parsing hex-file ...
File timestamp: 03/06/2011 12:03:58
Validating hex-file...ok
Hex-file successfully parsed
20 program words found in 2 rows
0 Eeprom words found
0 config words found
so there shouldnt be any configs set. also I have been using the ds30 loader in basic mode so I believe there is no way to set it to write configs anyway. would it be better if i had the same configs set in the program i write as the bootloader and allow them to be overwritten?
Thanks for your help
Liam
(2011-06-06, 22:43:33)Mikael Gustafsson Wrote: Hi,
Did you write configs? If you did, please try without doing that.
Mikael
RE: ds30 works 1st time fails second time 18f6723 - Mikael Gustavsson - 2011-06-09
After the first write. Do you reset the pic and press write within 2 seonds?
|