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

Change Function during Runtime

Hi, I'm new here and I use nRF52832 (pca10040), I was wondering if it is possible to change a function in C / C ++ language during the runtime, that is, my idea is whenever I have a new function, I delete the old one and send via RTT or bluetooth, and save the new function in flash memory. I'm thinking of putting the function in a dynamic library to change, but I do not know if it works on nRF52.

Best regards.
  • As already stated you can't change the nRF code without performing a firmware update of some sort. This would involve you downloading new firmware for the entire chip or directly writing compiled code into program memory which isn't a prospect that I would look forward to as you risk bricking your device if it goes wrong.

    You can change the nRF code behaviour if it has been written to use configurable values instead of hard coded ones.

    For example you may wish to change the sampling frequency or scaling of the sensor value. These values could be saved into flash and read back from flash either on start-up or at any point during normal running.

    If you are wanting to perform complex logic on the sensor readings such as statistical analysis then I would suggest that this is performed away from the Nordic device and on your computer.

    In either case it is best to transfer the data from the nRF52 in binary form, without conversion to any other format e.g. text string, HTML or XML, instead perform this either within your phone app or back end computer (which I would recommend).

    It is normally best to ensure that your devices are agnostic to each others domain, so your nRF52 captures the data, the phone app acquires it from the nRF52 and passes it to the computer (over wifi or GSM) and the computer manipulates the data.

Related