• AVR Freaks

Hot!PIC 24FJ128GA202 - bootloader , program from external flash memory.

Author
ice_man
Starting Member
  • Total Posts : 69
  • Reward points : 0
  • Joined: 2013/01/15 07:51:29
  • Location: 0
  • Status: offline
2020/03/31 11:32:42 (permalink)
0

PIC 24FJ128GA202 - bootloader , program from external flash memory.

Hi ,
 
I need make posiblity to receive new program for my PIC 24FJ128GA202 from other mcu by uart.
I know that I can use bootloader with uart and do that. For secure, I want write all new program on for example external flash memory -( SST26VF064 ) first (this memory is connect to my mcu 24FJ128GA202 ), and then program my 24FJ128GA202  mcu. 
 
Could You help me - maybe that is wrong way? Thanks for all help :).
#1

6 Replies Related Threads

    crosland
    Super Member
    • Total Posts : 1942
    • Reward points : 0
    • Joined: 2005/05/10 10:55:05
    • Location: Warks, UK
    • Status: online
    Re: PIC 24FJ128GA202 - bootloader , program from external flash memory. 2020/03/31 11:58:01 (permalink)
    0
    Doesn't seem too difficult.
     
    Start with a working bootloader.
     
    Modify it to write to the external FLASH instead of the PIC program FLASH. Maybe just save the date received from the UART as a "file".
     
    Then create a second modified bootloader that reads from the external FLASH (instead of receiving from a UART) and writes to the PICs program FLASH.
    #2
    ice_man
    Starting Member
    • Total Posts : 69
    • Reward points : 0
    • Joined: 2013/01/15 07:51:29
    • Location: 0
    • Status: offline
    Re: PIC 24FJ128GA202 - bootloader , program from external flash memory. 2020/03/31 12:26:44 (permalink)
    0
    crosland
    Doesn't seem too difficult.
     
    Start with a working bootloader.
     
    Modify it to write to the external FLASH instead of the PIC program FLASH. Maybe just save the date received from the UART as a "file".
     
    Then create a second modified bootloader that reads from the external FLASH (instead of receiving from a UART) and writes to the PICs program FLASH.


     
    What You mean write " a file " ? 
     
    The same uart port is used to communicate with mcu which send new program to send other data.
     
    Flash used SPI .
    post edited by ice_man - 2020/03/31 12:32:40
    #3
    MBedder
    Circuit breaker
    • Total Posts : 6876
    • Reward points : 0
    • Joined: 2008/05/30 11:24:01
    • Location: Zelenograd, Russia
    • Status: offline
    Re: PIC 24FJ128GA202 - bootloader , program from external flash memory. 2020/03/31 13:54:30 (permalink)
    5 (1)
    croslandMaybe just save the date received from the UART as a "file"
    Surely you meant "data". Forgive my Russian LoL


    post edited by MBedder - 2020/03/31 13:56:26
    #4
    _fragment_
    Super Member
    • Total Posts : 416
    • Reward points : 0
    • Joined: 2008/10/08 09:17:55
    • Location: Idaho
    • Status: offline
    Re: PIC 24FJ128GA202 - bootloader , program from external flash memory. 2020/03/31 15:01:38 (permalink)
    0
    I did exactly this with my first PIC24 project over 10 years ago. We still sell the product today. And I did start with the example serial bootloader project from Microchip that was available then and modified it heavily to suit my needs.
     
    Dave
    #5
    crosland
    Super Member
    • Total Posts : 1942
    • Reward points : 0
    • Joined: 2005/05/10 10:55:05
    • Location: Warks, UK
    • Status: online
    Re: PIC 24FJ128GA202 - bootloader , program from external flash memory. 2020/04/01 02:06:22 (permalink)
    0
    ice_man
    The same uart port is used to communicate with mcu which send new program to send other data.

    So you need a protocol to switch the MCU to bootloader operation, or to tell it to accept new programming data to be written to the SPI Flash.
     

    Flash used SPI .

    And? It's just another serial protocol. You can read bytes from the UART and write them to the SPI. You need to buffer the data into whatever block size the SPI Flash supports and add the correct command sequences.
     
    Have you used SPI before?
     
    Have you used a bootloader before?
    #6
    ice_man
    Starting Member
    • Total Posts : 69
    • Reward points : 0
    • Joined: 2013/01/15 07:51:29
    • Location: 0
    • Status: offline
    Re: PIC 24FJ128GA202 - bootloader , program from external flash memory. 2020/04/01 05:37:46 (permalink)
    0
    crosland
    ice_man
    The same uart port is used to communicate with mcu which send new program to send other data.

    So you need a protocol to switch the MCU to bootloader operation, or to tell it to accept new programming data to be written to the SPI Flash.
     

    Flash used SPI .

    And? It's just another serial protocol. You can read bytes from the UART and write them to the SPI. You need to buffer the data into whatever block size the SPI Flash supports and add the correct command sequences.
     
    Have you used SPI before?
     
    Have you used a bootloader before?




    1. SPI 
     
    Yes, I use SPI (4 wire), there is no problem with receive by uart and wrote to flash by SPI. As You suggest, I need make buffer - I reveive in part all data from uart, after I reveive 1 part, I write it to flash by SPI, after that I do the same with 2 part of data etc. as I write to flash all data.
     
    2. I've never used bootloader - I needn't do that, but I know that is basicly skill :)
    I read AN1157 "A Serial Bootloader for PIC24F Devices"
     
    3. uart in my mcu need to be used in two cases:
     
    a) other mcu send request for data from some sensors - > send for example control byte 0x05 , then my mcu send data from sensors.
     
    There is mo problem with that.
     
    b) other mcu send control byte for example 0x03 to inform my mcu - new program can be send.
    After that my mcu need to receive new program, send it to flash by SPI. After that program from flash need to be write to my mcu.
     
    I have problem with all that operation:
     
    - my mcu is 16-bit mcu, what format new program need to be send by uart from other mcu ? 
    - where I could download or how I can make own bootloader (maybe try to make own bootloader doesnt make sense? ) which can be used in my device ?
    - after I write all program to flash by SPI, what I need to do next with that ?
     
    I've never used bootloader in mcu ,could You help me ? Thanks :).
    #7
    Jump to:
    © 2020 APG vNext Commercial Version 4.5