This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Programming nrf52840 via SPI

Hi,

I have to program the application on an nrf52840 chip that is connected to another MCU via the SPI interface. Since I have to send the image from the MCU to program the Nordic chip, I have the following questions.

1. I should send a .hex file (used by the nRF programmer) or a .bin file (used my mcumgr)

2. I know the .hex file has the address, but I don't know if the MCU software has to read the .hex file and create SPI frames with the proper address or any other way it has to be done.

3. If I have to use a .bin file, how to get the address from a .bin file? 

Looking forward to your reply to move forward with my application updates.

Thanks,

Ram

Parents
  • Hi,

    Which SDK are you using?

    You can reference the examples found in the blog post Getting started with Nordic's Secure DFU bootloader, a step by step guide. The section 6. DFU Master code contains C example projects for both SPI DFU master and SPIS bootloader.

    Best regards,
    Jørgen

  • Hi Jorgen,

    Please see my setup and other details in my previous reply.

    I looked at the SPI DFU Master code in the link provided by you. It looks straight forward and simple.

    -Will it work for a hex file, if we needed to send the hex file to update the firmware?

    -Will it work to send a binary signed application if we needed to send the binary file?

    On slave:

    The example code in link has functions to receive SPI packets and send reply. There is nothing beyond that. Please correct me is I am missing anything.

    Presently, MCUboot in ncs supports upgrades through serial interface (see main.c),

    BOOT_LOG_INFO("Enter the serial recovery mode");
    rc = boot_console_init();
    _ASSERT(rc == 0, "Error initializing boot console.\n");
    boot_serial_start(&boot_funcs);

    My plan was to replace the two functions above with spi_init() and boot_spi_start() to initialize and read data over SPI and write to flash location identified by the type in the first SPI packet. 

    Is this the right way to do, especially with the signed binary file? Please suggest.

    Thanks,

    Ram

Reply
  • Hi Jorgen,

    Please see my setup and other details in my previous reply.

    I looked at the SPI DFU Master code in the link provided by you. It looks straight forward and simple.

    -Will it work for a hex file, if we needed to send the hex file to update the firmware?

    -Will it work to send a binary signed application if we needed to send the binary file?

    On slave:

    The example code in link has functions to receive SPI packets and send reply. There is nothing beyond that. Please correct me is I am missing anything.

    Presently, MCUboot in ncs supports upgrades through serial interface (see main.c),

    BOOT_LOG_INFO("Enter the serial recovery mode");
    rc = boot_console_init();
    _ASSERT(rc == 0, "Error initializing boot console.\n");
    boot_serial_start(&boot_funcs);

    My plan was to replace the two functions above with spi_init() and boot_spi_start() to initialize and read data over SPI and write to flash location identified by the type in the first SPI packet. 

    Is this the right way to do, especially with the signed binary file? Please suggest.

    Thanks,

    Ram

Children
No Data
Related