1
\$\begingroup\$

I am planning to implement a remote firmware update for my MCU and seek recommendations on the necessary features for the MCU. Specifically, I would like to understand the requirements regarding memory type and size to facilitate remote updates effectively. should there be a minimum memory size?

Based on these requirements, I intend to select the most suitable MCU.

  • My current C program is using (Flash/FRAM usage is 35821 bytes. RAM usage is 3418 bytes).

  • This is my MCU: MSP430FR6047, it has 8 (kByte) RAM , Nonvolatile memory 256 (kByte). enter image description here

Regards,

\$\endgroup\$
2
  • 4
    \$\begingroup\$ This can't be answered as we have no clue what your firmware or the MCU needs to do to be able to update itself via some interface and how complex your interface is. \$\endgroup\$
    – Justme
    Commented Jul 16 at 12:03
  • \$\begingroup\$ @Justme I added the details to the post. \$\endgroup\$
    – Andromeda
    Commented Jul 16 at 12:32

1 Answer 1

4
\$\begingroup\$

First, the MCU must be capable of writing to its own firmware memory. This is generally true for most modern MCUs, but not for some very early and/or low-end devices.

Second, the memory must be large enough to hold two copies of the firmware: The copy that you're running now, and the copy that you're receiving. You can only switch to the new copy once you have confirmed that it has been received correctly; otherwise, you run the risk of "bricking" your device.

There are many things that might go wrong during an update, including communication errors and power interruptions. You need to make sure that in every possible scenario, the system can recover to a known-good version of the firmware and either resume or restart the update.

And beware of attempts to hack your device -- you'll need some way to authenticate the new firmware before you run it. Either you know the communication channel is secure, or you cryptographically sign the firmware itself.


It has been suggested that external memory can be used to buffer the new image if it's too large to fit in firmware memory. But that works only if you're sure that the power can't be interrupted during the process of transferring from external memory to internal memory, which is something that can take a significant amount of time (or energy, if you're battery powered). If you don't have room for two copies, it's generally a good idea to make the loader separate from the application code, so that even if you've killed the application, you can still get into the loader.

\$\endgroup\$
5
  • 4
    \$\begingroup\$ The MCU doesn't need to store 2 copies of the firmware; you can use an external serial memory device (EEPROM or Flash ROM) to house the new image as it is being downloaded, then after suitable error-checking, launch some code in RAM that erases & re-programs the MCU flash using the downloaded image. This method works with any MCU that can program its own memory. \$\endgroup\$
    – jayben
    Commented Jul 16 at 12:26
  • \$\begingroup\$ @Dave Tweed thank very much for the nice and useful explanation. I appreciate it. My current C program is using (Flash/FRAM usage is 35821 bytes. RAM usage is 3418 bytes). This is my MCU: MSP430FR6047. it has 8 (kByte) RAM , Nonvolatile memory 256 (kByte). My program still can be larger during our development, but considering this a based line of C program, would would you please let me know if this is a good choice for remote update firmware? \$\endgroup\$
    – Andromeda
    Commented Jul 16 at 12:28
  • \$\begingroup\$ @jayben thank you for your comment, I added more detail to the post regarding my MCU and C program Size. \$\endgroup\$
    – Andromeda
    Commented Jul 16 at 12:33
  • 6
    \$\begingroup\$ @jayben: That works only if your sure that the power can't be interrupted during the process of transferring from external memory to internal memory, which is something that can take a significant amount of time (or energy, if you're battery powered). If you don't have room for two copies, it's generally a good idea to make the loader separate from the application code, so that even if you've killed the application, you can still get into the loader. \$\endgroup\$
    – Dave Tweed
    Commented Jul 16 at 12:34
  • \$\begingroup\$ @Dave Tweed my application is battery-based and ultra low power, so preferably not having a external memory would be a better choice I think? \$\endgroup\$
    – Andromeda
    Commented Jul 16 at 12:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.