Forum: Mikrocontroller und Digitale Elektronik AN1319 Bootloader für PIC18LF25K50


von Schläfer (Gast)


Lesenswert?

Hallo,

ich nutze einen AN1319 Bootloader für PIC18LF25K50 mit MPLAB v2.25 bzw. 
würde ihn gerne nutzen.

In devices.inc habe ich das folgende editiert :
1
#ifdef __18LF25K50
2
     #define DEVICEID                .741
3
     #define WRITE_FLASH_BLOCKSIZE   .64
4
     #define ERASE_FLASH_BLOCKSIZE   .64
5
     #define END_FLASH               0x8000
6
     #define END_GPR                 0x800
7
#endif

In der App Note steht, dass ich unter Configure -> Configuration Bits 
die Bits richtig setzten muss. Dies ist in MPLABX aber nicht möglich.

Ich habe diese also händisch eingegeben, bin aber nicht sicher ob dies 
so stimmt in der PIC18 Bootloader.asm
1
; CONFIG1L
2
  CONFIG  PLLSEL = PLL3X        ; PLL Selection (3x clock multiplier)
3
  CONFIG  CFGPLLEN = OFF        ; PLL Enable Configuration bit (PLL Disabled (firmware controlled))
4
  CONFIG  CPUDIV = NOCLKDIV     ; CPU System Clock Postscaler (CPU uses system clock (no divide))
5
  CONFIG  LS48MHZ = SYS48X8     ; Low Speed USB mode with 48 MHz system clock (System clock at 48 MHz, USB clock divider is set to 8)
6
7
; CONFIG1H
8
  CONFIG  FOSC = INTOSCIO       ; Oscillator Selection (Internal oscillator)
9
  CONFIG  PCLKEN = OFF          ; Primary Oscillator Shutdown (Primary oscillator shutdown firmware controlled)
10
  CONFIG  FCMEN = ON            ; Fail-Safe Clock Monitor (Fail-Safe Clock Monitor enabled)
11
  CONFIG  IESO = OFF            ; Internal/External Oscillator Switchover (Oscillator Switchover mode disabled)
12
13
; CONFIG2L
14
  CONFIG  nPWRTEN = OFF         ; Power-up Timer Enable (Power up timer disabled)
15
  CONFIG  BOREN = SBORDIS       ; Brown-out Reset Enable (BOR enabled in hardware (SBOREN is ignored))
16
  CONFIG  BORV = 190            ; Brown-out Reset Voltage (BOR set to 1.9V nominal)
17
  CONFIG  nLPBOR = ON           ; Low-Power Brown-out Reset (Low-Power Brown-out Reset enabled)
18
19
; CONFIG2H
20
  CONFIG  WDTEN = OFF           ; Watchdog Timer Enable bits (WDT disabled in hardware (SWDTEN ignored))
21
  CONFIG  WDTPS = 32768         ; Watchdog Timer Postscaler (1:32768)
22
23
; CONFIG3H
24
  CONFIG  CCP2MX = RC1          ; CCP2 MUX bit (CCP2 input/output is multiplexed with RC1)
25
  CONFIG  PBADEN = OFF          ; PORTB A/D Enable bit (PORTB<5:0> pins are configured as digital I/O on Reset)
26
  CONFIG  T3CMX = RC0           ; Timer3 Clock Input MUX bit (T3CKI function is on RC0)
27
  CONFIG  SDOMX = RC7           ; SDO Output MUX bit (SDO function is on RC7)
28
  CONFIG  MCLRE = ON            ; Master Clear Reset Pin Enable (MCLR pin enabled; RE3 input disabled)
29
30
; CONFIG4L
31
  CONFIG  STVREN = ON           ; Stack Full/Underflow Reset (Stack full/underflow will cause Reset)
32
  CONFIG  LVP = OFF             ; Single-Supply ICSP Enable bit (Single-Supply ICSP disabled)
33
  CONFIG  XINST = OFF           ; Extended Instruction Set Enable bit (Instruction set extension and Indexed Addressing mode disabled)
34
35
; CONFIG5L
36
  CONFIG  CP0 = OFF             ; Block 0 Code Protect (Block 0 is not code-protected)
37
  CONFIG  CP1 = OFF             ; Block 1 Code Protect (Block 1 is not code-protected)
38
  CONFIG  CP2 = OFF             ; Block 2 Code Protect (Block 2 is not code-protected)
39
  CONFIG  CP3 = OFF             ; Block 3 Code Protect (Block 3 is not code-protected)
40
41
; CONFIG5H
42
  CONFIG  CPB = OFF             ; Boot Block Code Protect (Boot block is not code-protected)
43
  CONFIG  CPD = OFF             ; Data EEPROM Code Protect (Data EEPROM is not code-protected)
44
45
; CONFIG6L
46
  CONFIG  WRT0 = OFF            ; Block 0 Write Protect (Block 0 (0800-1FFFh) is not write-protected)
47
  CONFIG  WRT1 = OFF            ; Block 1 Write Protect (Block 1 (2000-3FFFh) is not write-protected)
48
  CONFIG  WRT2 = OFF            ; Block 2 Write Protect (Block 2 (04000-5FFFh) is not write-protected)
49
  CONFIG  WRT3 = OFF            ; Block 3 Write Protect (Block 3 (06000-7FFFh) is not write-protected)
50
51
; CONFIG6H
52
  CONFIG  WRTC = OFF            ; Configuration Registers Write Protect (Configuration registers (300000-3000FFh) are not write-protected)
53
  CONFIG  WRTB = OFF            ; Boot Block Write Protect (Boot block (0000-7FFh) is not write-protected)
54
  CONFIG  WRTD = OFF            ; Data EEPROM Write Protect (Data EEPROM is not write-protected)
55
56
; CONFIG7L
57
  CONFIG  EBTR0 = OFF           ; Block 0 Table Read Protect (Block 0 is not protected from table reads executed in other blocks)
58
  CONFIG  EBTR1 = OFF           ; Block 1 Table Read Protect (Block 1 is not protected from table reads executed in other blocks)
59
  CONFIG  EBTR2 = OFF           ; Block 2 Table Read Protect (Block 2 is not protected from table reads executed in other blocks)
60
  CONFIG  EBTR3 = OFF           ; Block 3 Table Read Protect (Block 3 is not protected from table reads executed in other blocks)
61
62
; CONFIG7H
63
  CONFIG  EBTRB = OFF           ; Boot Block Table Read Protect (Boot block is not protected from table reads executed in other blocks)

Ich kompiliere und flashe den PIC neu. Funktioniert also.
Wenn ich jetzt das AN1310 v.105r Tool öffne (inkl. richtigen COM Port - 
TX RX und GND sind über Pegelwandler von PC zu PIC verbunden) und 
versuche mit dem PIC zu verbinden kommt immer die folgende 
Fehlermeldung:

Bootloader not found.

Kennt jemand den genannten Bootloader und hat eine Ahnung woran es 
liegen könnte?

Danke und Gruß

von Schläfer (Gast)


Lesenswert?

Noch niemand diesen Bootloader genutzt?

von Bad U. (bad_urban)


Lesenswert?

Nein, den kenne ich leider auch nicht.
Aber zu den Config Bits:
Die kannst Du im MPLABX einstellen. Aber die werden nicht ins Programm 
übernommen. Wenn Du auf Generate Source Code klickst wir dir der Code im 
Output-Fenster angezeigt. Den musst Du dann manuell ins Programm 
kopieren.

von Schläfer (Gast)


Lesenswert?

Bad U. schrieb:
> Nein, den kenne ich leider auch nicht.
> Aber zu den Config Bits:
> Die kannst Du im MPLABX einstellen. Aber die werden nicht ins Programm
> übernommen. Wenn Du auf Generate Source Code klickst wir dir der Code im
> Output-Fenster angezeigt. Den musst Du dann manuell ins Programm
> kopieren.

Danke sehr. Dies habe ich auch so gemacht. Code generiert und dann über 
Copy und Paste eingefügt.

Grundsätzliche Herangehensweise an DIESEN Bootloader würde mich 
interessieren.

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.