PIC self reprogramming


+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    May 2009
    Location
    Saint-Quentin-en-Yvelines, FRANCE
    Posts
    71

    Default PIC self reprogramming

    First of all, happy new year to everybody.

    I start 2022 with an interesting project but I do not want to reinvent the wheel so I ask you your kind advice about the following.

    I have a mother PCB, called the BASE which is equiped with a PIC 18F26K22 and uses some peripherals (USB bridge, PWM, I/O, etc…). Quite classical.
    Some daughter PCBs called the EXTENSIONS can be connected to the BASE. They support additional functions and communicate with a PIC via an I2C bus. Several kinds of EXTENSION exist and each requires a different application program to be executed by the PIC. All the application programs are too large to simultaneously stay in the PIC program memory. So, each EXTENSION has an embedded EEPROM with its own application program. At powering, the PIC reads a code from the connected EXTENSION and verifies if it fits with any application program it may already have in its program memory. If this is the case it launches this application program. If not it reprograms itself with the application program stored in the connected EXTENSION EEPROM and then launches the application.

    I hope my description is quite clear. Before I start, does anybody have some experience or knowledge about this kind of problem and/or see any traps or difficulties ?

    Thank you for your advices and for your help.

    Best regards
    MikeBZH

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,105


    Did you find this post helpful? Yes | No

    Default Re: PIC self reprogramming

    each requires a different application program to be executed by the ̶P̶I̶C̶ Base ?


    so each ext has an eprom to reprogram the base or the ext or both ?

    if the recoding is always done in the same mem block the flash wear will be uneven which will limit chip lifetime

    there are 128k pic18's 18f47k40 etc

    ps that's how my ICD3 used to work, one little mishap reprgming its self now its a bench ornament
    Last edited by richard; - 3rd January 2022 at 11:42.
    Warning I'm not a teacher

  3. #3
    Join Date
    May 2009
    Location
    Saint-Quentin-en-Yvelines, FRANCE
    Posts
    71


    Did you find this post helpful? Yes | No

    Default Re: PIC self reprogramming

    Thank you Richard for your kind answer.

    Yes, the application programs are very different so a new program must be loaded each time a different extension is connected. The application program is permanently stored in the extension EEPROM and copied into the PIC program space when necessary. However, changing the extensions is not so frequent so I don't thing that the durability of the flash EPROM could be affected. Do you have any data about the number of reprogrammations which are accepted for this kind of memory ?

    Changing the PIC model is no more possible at this level of the development and even 128K would not be large enough to contain all the possible extension programs.
    Moreover, from an evaluation I have done 3 or 4 years ago I remember that the K40 and K42 are not correctly supported by PBP + MPLAB 8. You have to go to MPLAB X with some ennoying issues regarding the debugging at the source level. My current development environment is MPLAB 8 + PBP + PicKit 2 and 3. I also own a Real Ice.

    Thank you for your help

    MikeBZH

  4. #4
    Join Date
    Apr 2014
    Location
    Northeast
    Posts
    491


    Did you find this post helpful? Yes | No

    Default Re: PIC self reprogramming

    According to 27.9 in Electrical Specifications, Parameter D178 states it's good for 10k writes.

  5. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    2,105


    Did you find this post helpful? Yes | No

    Default Re: PIC self reprogramming

    Do you have any data about the number of reprogrammations which are accepted for this kind of memory ?
    18f26k22 has a flash cell write endurance of 10k, i assume a row erase row write is two of those cycles. data sheet is never clear on
    what a write cycle actually is.


    I'm using mplabx v5.30 with pk2/3/4 for pbp3 with no issues, pbp debugging at the source level is a long
    forgotten luxury, now just use DEBUG and logic analyzer and a led or two

  6. #6
    Join Date
    May 2009
    Location
    Saint-Quentin-en-Yvelines, FRANCE
    Posts
    71


    Did you find this post helpful? Yes | No

    Default Re: PIC self reprogramming

    Mpgmike, Richard, thank you for your answers.

    10k cycles is much more that what I need (may be a few hundreds cycles?) so there should not be critical issues there.
    According to the complexity of my algorithms my choice is clear : I need to debug at the source level so this stucks me with MPLAB 8, Unfortunately.

    MikeBZH

Similar Threads

  1. pass pic basic pro pic from pic 16f877a to pic 16f887
    By joseluisatmega8 in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 12th February 2020, 16:17
  2. Replies: 1
    Last Post: - 9th February 2009, 22:40
  3. High Speed Serial Comm PC - PIC and PIC - PIC
    By manumenzella in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 16th January 2007, 21:55
  4. reprogramming 16f676
    By scorpion in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 11th May 2005, 11:39

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts