Pic32 to Pic32 firmware upgrade?

Author
MantasP
New Member
  • Total Posts : 6
  • Reward points : 0
  • Joined: 2019/02/20 03:31:39
  • Location: 0
  • Status: offline
2019/04/09 02:15:15 (permalink)
0

Pic32 to Pic32 firmware upgrade?

Hi all,
I have a board with 2 Pic32mx470's. One of these has a UDP bootloader and communicates with a host PC over TCP during normal use. The second pic is an SPI slave and performs data gathering.
I'm looking for a way I could perform the firmware update on both devices over TCP/UDP without use of headers or jumpers.
Can the slave devices firmware be stored in unused flash or non volatile memory like fram and then pushed to the slave pic device?

Does anyone have experience doing this?
I can use USART/SPI/I2C for pic - pic comms
#1

6 Replies Related Threads

    NorthGuy
    Super Member
    • Total Posts : 5310
    • Reward points : 0
    • Joined: 2014/02/23 14:23:23
    • Location: Northern Canada
    • Status: online
    Re: Pic32 to Pic32 firmware upgrade? 2019/04/09 09:09:04 (permalink)
    0
    So, you have PIC A which receives firmware for PIC B  and then has to program PIC B. I would use UART communications between them and put a small resident program on PIC B (bootloader if you wish) which would do self-programming using data received from PIC A. This is probably the easiest.
    #2
    MantasP
    New Member
    • Total Posts : 6
    • Reward points : 0
    • Joined: 2019/02/20 03:31:39
    • Location: 0
    • Status: offline
    Re: Pic32 to Pic32 firmware upgrade? 2019/04/09 09:17:09 (permalink)
    0
    NorthGuy,
    I have very little experience writing custom bootloaders and need some pointers. Would UART bootloader in harmony  be a good starting point? Place it on Pic B?

    Then recreate the protocol used by unified bootloader pc app and add it to PIC A?
    Thanks
    #3
    NorthGuy
    Super Member
    • Total Posts : 5310
    • Reward points : 0
    • Joined: 2014/02/23 14:23:23
    • Location: Northern Canada
    • Status: online
    Re: Pic32 to Pic32 firmware upgrade? 2019/04/09 10:13:20 (permalink)
    5 (1)
    MantasP
    NorthGuy,
    I have very little experience writing custom bootloaders and need some pointers. Would UART bootloader in harmony  be a good starting point? Place it on Pic B?

    Then recreate the protocol used by unified bootloader pc app and add it to PIC A?



    Yes, that would work.
     
    If you're programming from PC, then there's no need to recreate the application on PIC A. If you put a stock UART bootloader on PIC B, then PIC A can simply get data from the PC through the Internet and pass it to PIC B through UART. I'm not an expert in Harmony, but this should be easy to do.
    #4
    NKurzman
    A Guy on the Net
    • Total Posts : 17148
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: Pic32 to Pic32 firmware upgrade? 2019/04/09 11:58:49 (permalink)
    5 (1)
    The Slave PIC could also be Sent its data via SPI.  The UART bootloader can be changed to use SPI.
     
    The Master PIC can send the Data to the Slave one transaction at a time.  I would recommend it do this via it main program, Not from it's bootloader.
    #5
    MantasP
    New Member
    • Total Posts : 6
    • Reward points : 0
    • Joined: 2019/02/20 03:31:39
    • Location: 0
    • Status: offline
    Re: Pic32 to Pic32 firmware upgrade? 2019/04/15 09:57:21 (permalink)
    0
    Hi Guys, I have modified the bootloader from harmony and am now able to send and receive commands over SPI. I'm not sure how to manage data of varied length. I will probably need to have a data ready signal from slave to master. Otherwise I am not sure how the master will know if the returning data on SPI line is valid. 

    I am not too familiar with the SPI Slave implementation.
    I am not sure how to manage incoming data on SPI bus of variable length. With harmony  API DRV_SPI_BufferAddRead2
    I can specify the number of bytes I want to receive from master. If I specify 4 bytes but master sends 8 I will get a buffer event complete and access to these 4 bytes but the rest will be lost.
    In other case where the master sends smaller packet the buffer complete might never occur and master will have to time out if no ACK was received.
     
    Is there a way to check how many bytes master has sent while CS pin was low. E.g. CS= LOW  - Mastter sends X number of bytes - CS HIGH, how can I get X?
     
    I want to replicate the UDP data flow where the api allows to check how many bytes are in the  rx buffer.
     
    if (TCPIP_UDP_GetIsReady(udpsocket))
        {
            avlBytes = TCPIP_UDP_GetIsReady(udpsocket);
           
            avlBytes = TCPIP_UDP_ArrayGet(udpsocket, &bootloaderData.data->buffers.buff1[0], avlBytes);
            //TCPIP_UDP_Discard(appData.socket);
            currDir = IDLE;
            handler(DATASTREAM_BUFFER_EVENT_COMPLETE, (DATASTREAM_BUFFER_HANDLE)_bufferHandle, avlBytes);
        }
    #6
    NKurzman
    A Guy on the Net
    • Total Posts : 17148
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: Pic32 to Pic32 firmware upgrade? 2019/04/15 16:51:20 (permalink)
    0
    Do you have and SPI Slave implementation in your code? Use that.
    Your description sounds like Harmony is not Using SPI correctly. A deselect ends the Transaction.
    But You do not need to use Harmonies Drivers.
    If you do, then always send a fixed length.  Just include the Number of Data Bytes as an entry.
    #7
    Jump to:
    © 2019 APG vNext Commercial Version 4.5