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

Modify DEVICE_NAME

Hello.

I use nrf51822 chip.

I want modify Device_name as below.

1EA product "CoCoNut - 001"

other 1EA product "CoCoNut - 002"

other 1EA product "CoCoNut - 003" .....

So, 001,002,003 numbering is storage from flash memory.

I want modify only one source code.

but, I don't know add device_name.

How can I modify source code?

please confirm it.

Parents
  • You could use a script to modify your binary for each device you upload to.

    e.g. In your code define a constant array with the text "CoCoNut - 001"

    In the binary there were be a the text "CoCoNut - 001", so you just need to get your script to change this to "CoCoNut - 002" etc before you upload

    You'd need to keep track of the index number somehow, e.g. some sort of database (or even just a text file)

  • @alex

    Yes. You could write into some other memory page and get the code to load that.

    In that case you could write a small binary file to be flashed into one of the code pages, which would be easier than modifying the whole binary.

    The other option is to have a service to set the name, which is only advertised until the name is set.

    You could then connect with an app, (e.g. LightBlue) set the number, and the app code could write the name into flash and then remove the name setting service.

    OTA should not be a problem, as it wouldnt erase all flash pages would it ?

    And the OP doesn't seem to be using OTA

Reply
  • @alex

    Yes. You could write into some other memory page and get the code to load that.

    In that case you could write a small binary file to be flashed into one of the code pages, which would be easier than modifying the whole binary.

    The other option is to have a service to set the name, which is only advertised until the name is set.

    You could then connect with an app, (e.g. LightBlue) set the number, and the app code could write the name into flash and then remove the name setting service.

    OTA should not be a problem, as it wouldnt erase all flash pages would it ?

    And the OP doesn't seem to be using OTA

Children
No Data
Related