Hot!PIC24FJ data sheet or header file flash description contradiction.

Author
markQ
Junior Member
  • Total Posts : 78
  • Reward points : 0
  • Joined: 2013/09/24 07:53:59
  • Location: 0
  • Status: offline
2017/07/17 01:47:31 (permalink)
0

PIC24FJ data sheet or header file flash description contradiction.

Observation
PIC24FJ1024GA610/GB610 FAMILY (DS30010074C) data sheet page 54 states..
"Note 2: 1 Write Block = 128 Instruction Words; 1 Erase Block = 1024 Instruction Words"
 
libpic30.h starting line 301
"#elif defined(__PIC24F__)
....
#define _FLASH_PAGE   512
...
#define _FLASH_ROW     64
..."
 
Question
Why are these documents different? Or which of the two documents is right?
#1

6 Replies Related Threads

    CinziaG
    rome burns :D
    • Total Posts : 2699
    • Reward points : 0
    • Joined: 2016/12/07 14:20:36
    • Location: Wien
    • Status: online
    Re: PIC24FJ data sheet or header file flash description contradiction. 2017/07/17 01:57:37 (permalink)
    3 (1)
    I just found a similar issue in the DEE emulation library, where a PIC "E" was going to use the wrong settings. In my experience, most PIC "F" share the 1024 size, but of course there could be mistakes...
    #2
    markQ
    Junior Member
    • Total Posts : 78
    • Reward points : 0
    • Joined: 2013/09/24 07:53:59
    • Location: 0
    • Status: offline
    Re: PIC24FJ data sheet or header file flash description contradiction. 2017/07/17 02:28:49 (permalink)
    3 (1)
    I have used 1024 and 128 before successfully in my boot-loader so the Data Sheet must be correct. I am now using the flash for EEPROM emulation that is why I noticed the doc. differences. I am assuming the header file is wrong and making my own defines as, I just realized, I did in the boot-loader. Doing anything with RTSP on these chips is confusing because of the phantom byte, it does not help though when the header files are misleading.
    post edited by markq - 2017/07/17 02:52:07
    #3
    NorthGuy
    Super Member
    • Total Posts : 4331
    • Reward points : 0
    • Joined: 2014/02/23 14:23:23
    • Location: Northern Canada
    • Status: offline
    Re: PIC24FJ data sheet or header file flash description contradiction. 2017/07/17 07:25:52 (permalink)
    3.5 (2)
    PIC24FJs are different, so the libpic definition cannot be correct. Your PIC has sizes of 1024 and 128 instructions.
    #4
    markQ
    Junior Member
    • Total Posts : 78
    • Reward points : 0
    • Joined: 2013/09/24 07:53:59
    • Location: 0
    • Status: offline
    Re: PIC24FJ data sheet or header file flash description contradiction. 2017/07/17 07:35:48 (permalink)
    0
    Is there a more up to date header file or am I referencing it wrongly?
    #5
    rodims
    Super Member
    • Total Posts : 816
    • Reward points : 0
    • Joined: 2009/02/10 11:08:59
    • Location: 51.9627, 7.6262
    • Status: online
    Re: PIC24FJ data sheet or header file flash description contradiction. 2017/07/17 08:43:41 (permalink)
    3.5 (2)
    I just had a look at the most recent libpic30.h from the xc16 include directories
     
    Copyright 2007-2016 Microchip Technology, all rights reserved
     
    #elif defined(__PIC24F__)
    #define _FLASH_ERASE_CODE      0x4042
    #define _FLASH_WRITE_ROW_CODE  0x4001
    #define _FLASH_WRITE_WORD_CODE 0x4003

    #ifndef _FLASH_PAGE
    #define _FLASH_PAGE   512
    #endif

    #ifndef _FLASH_ROW
    #define _FLASH_ROW     64
    #endif

     
    While the header file contains a copyright from 2016, these definitions did not change since 8 years (which is not bad in itself).
    But e.g. the Flash Programming manual for the GB6 (DS30010057F) clearly states that
    4003h  erases a page of program or executive memory.
    This is correct,  I'm using NVM functions for GB1, GB4 and GB6 families
     
    The meaning for 4003h for GB1 and GB6 family is definitely different, but the libpic30.h does not reflect that.
    So my assumption is the include file is simply wrong and it does not just reveal a single mistake, but was never updated to reflect the newer members of the PIC24 family
     
     
    post edited by rodims - 2017/07/17 08:55:44
    #6
    RISC
    Super Member
    • Total Posts : 4229
    • Reward points : 0
    • Status: offline
    Re: PIC24FJ data sheet or header file flash description contradiction. 2017/07/17 09:28:51 (permalink)
    4.75 (4)
    Hi,
     
    I think the issue lies in the specific device header file itself :
    in the p24FJ1024GA610.h  (and other header file from the family) you can see :
     
    /*
    * Flash Programming Information
    */
    #undef _FLASH_PAGE
    #define _FLASH_PAGE 0x400
    #undef _FLASH_ROW
    #define _FLASH_ROW 0x40

     
    Page size is OK but the ROW size is incorrect...it should be 0x80.
    UNDEF will ignore generic definition from libpic30.h  and use the specific device definition from p24FJ1024GA610.h
    I guess if you correct the header file it should be fine ;=)
     
    Regards
     
    #7
    Jump to:
    © 2017 APG vNext Commercial Version 4.5