
Originally Posted by
malc-c
The PICpgm appliaction doesn't have any options to change, so I assume it takes the fuse settings etc from the code / inc / dev files.
In theory ... yes
Reading the code back into WinPIC, gives the following info in the log
''''
'
'
'
'
I Then loaded the same HEX file that gets compiled from your code that I previously loaded with PICpgm into Winpic and it reported the following under device config
Config word #1 = F0E7 (hex)
Config word #2 = 1F3F (hex)
One is good ... where the other 'I think' don't make sense at all
Let's say i just compile the config fuses bellow
Code:
ASM
__CONFIG _CONFIG1L, _CPUDIV_OSC1_PLL2_1L
__CONFIG _CONFIG1H, _FOSC_XT_XT_1H
__CONFIG _CONFIG3H, _PBADEN_OFF_3H
__CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
ENDASM
now, if i open the .LST file, i found
Code:
00097
00098 __CONFIG _CONFIG1L, _CPUDIV_OSC1_PLL2_1L
300000 F0E7 00099 __CONFIG _CONFIG1H, _FOSC_XT_XT_1H
300004 FDFF 00100 __CONFIG _CONFIG3H, _PBADEN_OFF_3H
300006 FFBB 00101 __CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
Where those numer comes from. Open the p18F2550.INC in the MPASM foler, scroll to the bottom and you'll discover
Code:
_CONFIG1L EQU H'300000'
_CONFIG1H EQU H'300001'
_CONFIG2L EQU H'300002'
_CONFIG2H EQU H'300003'
_CONFIG3H EQU H'300005'
_CONFIG4L EQU H'300006'
let's see CONFIG1L and CONFIG1H options
Code:
;----- CONFIG1L Options --------------------------------------------------
_PLLDIV_1_1L EQU H'F8' ; No prescale (4 MHz oscillator input drives PLL directly)
_PLLDIV_2_1L EQU H'F9' ; Divide by 2 (8 MHz oscillator input)
_PLLDIV_3_1L EQU H'FA' ; Divide by 3 (12 MHz oscillator input)
_PLLDIV_4_1L EQU H'FB' ; Divide by 4 (16 MHz oscillator input)
_PLLDIV_5_1L EQU H'FC' ; Divide by 5 (20 MHz oscillator input)
_PLLDIV_6_1L EQU H'FD' ; Divide by 6 (24 MHz oscillator input)
_PLLDIV_10_1L EQU H'FE' ; Divide by 10 (40 MHz oscillator input)
_PLLDIV_12_1L EQU H'FF' ; Divide by 12 (48 MHz oscillator input)
_CPUDIV_OSC1_PLL2_1L EQU H'E7' ; [OSC1/OSC2 Src: /1][96 MHz PLL Src: /2]
_CPUDIV_OSC2_PLL3_1L EQU H'EF' ; [OSC1/OSC2 Src: /2][96 MHz PLL Src: /3]
_CPUDIV_OSC3_PLL4_1L EQU H'F7' ; [OSC1/OSC2 Src: /3][96 MHz PLL Src: /4]
_CPUDIV_OSC4_PLL6_1L EQU H'FF' ; [OSC1/OSC2 Src: /4][96 MHz PLL Src: /6]
_USBDIV_1_1L EQU H'DF' ; USB clock source comes directly from the primary oscillator block with no postscale
_USBDIV_2_1L EQU H'FF' ; USB clock source comes from the 96 MHz PLL divided by 2
;----- CONFIG1H Options --------------------------------------------------
_FOSC_XT_XT_1H EQU H'F0' ; XT oscillator, XT used by USB
_FOSC_XTPLL_XT_1H EQU H'F2' ; XT oscillator, PLL enabled, XT used by USB
_FOSC_ECIO_EC_1H EQU H'F4' ; External clock, port function on RA6, EC used by USB
_FOSC_EC_EC_1H EQU H'F5' ; External clock, CLKOUT on RA6, EC used by USB
_FOSC_ECPLLIO_EC_1H EQU H'F6' ; External clock, PLL enabled, port function on RA6, EC used by USB
_FOSC_ECPLL_EC_1H EQU H'F7' ; External clock, PLL enabled, CLKOUT on RA6, EC used by USB
_FOSC_INTOSCIO_EC_1H EQU H'F8' ; Internal oscillator, port function on RA6, EC used by USB
_FOSC_INTOSC_EC_1H EQU H'F9' ; Internal oscillator, CLKOUT on RA6, EC used by USB
_FOSC_INTOSC_XT_1H EQU H'FA' ; Internal oscillator, XT used by USB
_FOSC_INTOSC_HS_1H EQU H'FB' ; Internal oscillator, HS used by USB
_FOSC_HS_1H EQU H'FC' ; HS oscillator, HS used by USB
_FOSC_HSPLL_HS_1H EQU H'FE' ; HS oscillator, PLL enabled, HS used by USB
_FCMEN_OFF_1H EQU H'BF' ; Fail-Safe Clock Monitor disabled
_FCMEN_ON_1H EQU H'FF' ; Fail-Safe Clock Monitor enabled
_IESO_OFF_1H EQU H'7F' ; Oscillator Switchover mode disabled
_IESO_ON_1H EQU H'FF' ; Oscillator Switchover mode enabled
using our settings, we keep
Code:
_CONFIG1L EQU H'300000'
_CONFIG1H EQU H'300001'
_CPUDIV_OSC1_PLL2_1L EQU H'E7'
_FOSC_XT_XT_1H EQU H'F0'
combining both L and H we have F0E7... same for all other Config stuff.
It doesn't explain your config2 stuff... If it's a config fuse, it's not valid, well i don't see how we can have 1F... it could be a device programmer behaviour... i think
let's try to set ALL available config fuses BUT NOT the code protect stuff. And while we're at it, let's try a simple program too.
Code:
ASM
__CONFIG _CONFIG1L, _PLLDIV_1_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_1_1L
__CONFIG _CONFIG1H, _FOSC_XT_XT_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
__CONFIG _CONFIG2L, _PWRT_ON_2L & _BOR_ON_2L & _BORV_1_2L & _VREGEN_OFF_2L
__CONFIG _CONFIG2H, _WDT_OFF_2H
__CONFIG _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_OFF_3H
__CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L
ENDASM
ADCON1=$0F
TRISB=%00000000 'set PORTB as all output
PORTB=0
ByteA var byte
main:
for bytea=0 to 7
PORTB=DCD BYTEA
PAUSE 250
NEXT
PORTB=255
PAUSE 250
goto main
now it give us those config values
Code:
00102 __CONFIG _CONFIG1L, _PLLDIV_1_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_1_1L
300000 30C0 00103 __CONFIG _CONFIG1H, _FOSC_XT_XT_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
00104 __CONFIG _CONFIG2L, _PWRT_ON_2L & _BOR_ON_2L & _BORV_1_2L & _VREGEN_OFF_2L
300002 FECE 00105 __CONFIG _CONFIG2H, _WDT_OFF_2H
300004 F8FF 00106 __CONFIG _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_OFF_3H
300006 FFBB 00107 __CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L
00108
and it's still working here. here's the .HEX dump
Code:
:020000040000FA
:100000003EEF00F0010E09B0E84609B2E84609B239
:10001000E84609B4E83A1200046A036EFF0E0326AC
:10002000D8A00426D8A03BEF00F0030E026EDF0E2E
:1000300002D8F4D7026AE80F016E021EFC0ED8A0A7
:1000400003D00126D8B0FDD701260400023EF9D71F
:1000500001B000D001A202D0000000D01200096E51
:1000600002EC00F0016A026A09A6016E09B6026E8E
:1000700001503BEF00F00001040012000F0EC16EB2
:10008000936A816A1C6A0400080E1C5CD8B051EFA8
:1000900000F01C50E4DF816EFA0EBEDF1C2AD8A4EB
:0C00A000F2D7FF0E816EFA0EB7DFECD72E
:020000040030CA
:08000000C030CEFEFFF8BBFF8B
:00000001FF
compare with yours.
In both cases nothing is else is listed listed (see images attached) If I try programming having loaded this file it errors
Wich adapter you're using JDM?
ICSP or not?
When you program your PIC, pull the PGM pin to GND, erase the chip firstm then retry and post your results.
I can't comment on JDM or else programmer like that, if you want a nice one and cheap, i buyed few months ago a Microchip PICKit 2 for some on-the road service job. For a <40$ and USB PIC programmer it's really nice.
I'm really out of my depth here as I have no idea what all these numbers are - I opted for the PICpgm program because it auto detected the PIC and had less setting to change - it also seemed to work as it reported no errors
Yeah it's kind of hard to know where the problem come from... The most strange thing... only one a single pin... and you tried on another board...
Don't give up!
Bookmarks