Menu

PIC18F97J60 datasheet header file mismatch

Help
2017-12-30
2018-01-03
  • Szőgyényi Gábor

    In the datasheet of PIC18F97J60 the config words located at:

    300000h    CONFIG1L
    300001h    CONFIG1H
    300002h    CONFIG2L
    300003h    CONFIG2H
    300004h    CONFIG3L
    300005h    CONFIG3H
    3FFFFEh   DEVID1
    3FFFFFh   DEVID2
    

    but in the header files defined :

    #define __CONFIG1L     0x01FFF8
    #define __CONFIG1H     0x01FFF9
    #define __CONFIG2L     0x01FFFA
    #define __CONFIG2H     0x01FFFB
    #define __CONFIG3L     0x01FFFC
    #define __CONFIG3H     0x01FFFD
    

    Which is relevant?
    Can someone give me a really working CONFIG setting for PIC18F97J60?
    The -mpic14 style CONFIG definitions are not working on -mpic16, because the header files has differencies.

     
  • Diego Herranz

    Diego Herranz - 2017-12-31

    Hi,

    Have you tried using the new (although a few years old) pragma style?

    Example taken from section 4.6.17 on the SDCC manual. It will most surely need changes for your PIC:

    #pragma config CP0=OFF,OSCS=ON,OSC=LP,BOR=ON,BORV=25,WDT=ON,WDTPS=128,CCP2MUX=ON
    #pragma config STVR=ON
    

    That information is passed to GPUTILS, which knows about all those options (see https://sourceforge.net/p/gputils/code/HEAD/tree/trunk/gputils/header/p18f97j60.inc#l2281), so it should work even if the SDCC header is wrong (we should fix it by the way).

    Cheers,
    Diego

     
  • Szőgyényi Gábor

    Thanks.

    When I am using this "#pragma config" style configuration, the PICkit 2 programmer gives error at flashing the output HEX file.

    PICkit 2 Program Report
    31-12-2017, 19:06:44
    Device Type: PIC18F97J60

    Program Memory Errors

    Address Good Bad
    01FFFE 00FFFF 00F000

    Maybe the compiler places the config word to a bad memory address?

     

    Last edit: Szőgyényi Gábor 2017-12-31
  • Raphael Neider

    Raphael Neider - 2017-12-31

    Somewhere in the (non-free) include/pic16 directory, there should be a file pic16devices.txt which lists (among other things) the addresses of the configuration words... Or was that for pic14?
    If such a file exists, you can try fixing the addresses in there for the relevant (family) record.
    If I can manage, I'll try and post more useful instructions.

     
  • Szőgyényi Gábor

    Yes, the file exists and there is information for the PIC18F97J60.

    name        18f97j60
    using       18f67j10
    ramsize     4096
    configword  0x01FFFC 0xF8 0xF8
    configword  0x01FFFD 0x07 0xF7
    

    But I don't know it is correct or not.

     
  • Maarten Brock

    Maarten Brock - 2018-01-03

    Is this header file generated or hand written? I believe most headers are generated from .INC files from microchip and in that case the problem should be fixed upstream.

     
  • Szőgyényi Gábor

    I don't know is this file generated or not. I think we need to open an issue to check and fix all the devices in this pic16devices.txt file.

     

Log in to post a comment.