This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SensorTag firmware corruption?

Hi,

I made a small modification to the SensorTag firmware using IAR, following the instructions in the OAD documentation (I just changed the manufacturer name in the device information service). I built a bin file as image A and successfully loaded it over the air using Device Monitor. I could see the device advertising, connect to it, find the Device Information service and see my modified manufacturer name.

I then changed the manufacturer name again, rebuilt this time as image B and tried to load it. Device Monitor crashed and Windows closed it. 

My SensorTag is no longer advertising and I suspect the firmware has been corrupted by the failed attempt to load new firmware.

Could someone advise on how I might be able to rescue my SensorTag please?

Thanks

  • Hi Martin,

    this was strange indeed as the SensorTag should not switch to a new image unless the CRC check is ok. Hence it should start up again using the old image.

    This might be a stupid question, but have you tested to do a hard reset by removing the battery?

    best regards,

    delete

  • Hi, thanks for the quick response. Good point regarding CRC.

    I did do a hard reset and still not see any advertising. However... I just did it again and what I saw was advertising for a very short amount of time and then it stopped advertising and I cannot connect to it. So it sounds like maybe my code now has a bug in it perhaps? I'll put my code back to the original state and see if that resolves the issue and then try to figure out what happened :-)

    I'll post again when I've tried this.

    Regards

    Martin

  • There's a small flaw in my plan :-)

    Since the device advertises for such a short period of time, I cannot connect to it and therefore cannot load replacement firmware over the air.

    Any ideas?

  • Hi Martin,

    If you discover the device in device monitor, hit connect button after sensortag device enters error state.

    The USB Dongle will now be in a listen mode until sensor tag starts to advertise again (or connection establish timeout happen).

    On a side note. Are you writing application code without debugging?

    Best Regards

    Joakim

  • Hi, I just get "Connection timed out" when I do that.

    I'm not really writing code. I just wanted to learn how I could put my own code on the SensorTag and was trying out the process to create a bin and load it, with a very tiny change from the default code. That said I'm not sure I understand your question.

  • Hi Martin,

    do you have an iOS device?

    If so try to download the SensorTag app and see if you are able to connect to the SensorTag form the app - it might be easier to connect fast using the app. Custom FW can be uploaded to the SensorTag using the app.

    Also try using a fresh battery in case the observations are based on a low capacity battery.

    best regards,

    Espen

  • Hi Martin,

    one more thing you could try in Device Monitor.

    When you try to connect to the SensorTag it will try for 10 sec. if you re-start advertising during these 10 sec. device monitor should auto connect to the SensorTag.

    This should be the fastest way to connect.

    best regards,

    delete

  • Thanks, that sounds a good idea.

    My battery seems OK (checked with a multimeter) but I'll obtain a new one as well I think.

    Appreciate the support

    Martin

  • With a fresh battery I get the same behaviour. If I try to connect with Device Monitor after the initial time out, after resetting and relying on auto-connect, I get connected for split second and then get disconnected.

    The LED flashes initially (advertising) but then in a second stays on without blinking. I think this means it's "hung".

    Have I killed my little SensorTag? Is there no way to bring it back from the abyss?

  • Guess what? I did it again. I now have another sensortag device in exactly the same state. I was able to flash it using Device Monitor and OAD using the standard CC2541DK-Sensor-OAD-ImgA and CC2541DK-Sensor-OAD-ImgB configurations. It worked OK but I did get "Attribute Validation Failed" a few times when trying to connect. I then changed the manufacturer string (just as a test) to a new value with exactly the same number of characters as the default value of Texas Instruments, rebuilt, programmed OAD with the new image and now I have a steady LED indicating "Hung".

    I'm new to this so maybe I'm missing something that others would find obvious?

    Any ideas as to what could be going wrong? Could someone from T.I. maybe try to recreate the problem please?

    Thanks

  • Hi Martian,

    There may be no good way out of this if the device isn't connectable, apart from using a CC Debugger to directly flash the device.

    Long story short, I'm not sure what's wrong in your case here, and it could be interesting to see if you get the same issue when OAD-ing the .bin files that are included with device manager.

    For development I have to recommend a debugger, unfortunately.

    https://estore.ti.com/CC-DEBUGGER-Debugger-and-Programmer-for-RF-System-on-Chips-P1627.aspx

    BR,
    Aslak

  • Hi Aslak, I have a debugger now and was able to load the file CC2541DK_BIM_SensorTagOadImgA_v1_5.hex from the official firmware download. My device functions correctly again.

    But if I build my own hex file from the downloaded source code, with no changes at all to the source code and load the resultant hex file I get back into the same state. I made two changes to the IAR config; first I set the number of virtual registers setting to 8 instead of 16 (I read somewhere this was necessary) and finally, I edited the cc254x_f256_imgA file to change a linker property to avoid a known issue so that now I have:

     

    // Previous value

    // -Z(DATA)VREG+_NR_OF_VIRTUAL_REGISTERS=_IDATA_BEG-7F

     

    // My value

    -Z(DATA)VREG+0=08-7F

     I can build OK and this produces bin, d51, hex and sim files. But if I flash the hex file, the SensorTag no longer works… if I press the button, the LED does not light at all and I cannot see it advertising.

     So it seems either the build process/configuration is causing a problem or the source code I got from the BLE stack download is a problem. I suspect the first option.

    Could you please try to go through these steps yourself and compare the results with my description? I'm sure this would be an effective way to get to the bottom of this problem.

    Thank you

  • Hi,

    It appears that you are using IAR 8.30, whereas the hex files in the SDK have been made with 8.20.x. This can cause some issues. Which ones, I don't know, but as you point out, number of virtual registers and that kind of business has changed between releases.

    If you were to generate your own BIM hex and concatenate this with your own ImgA hex both made via 8.30 this may work better.

    Officially we recommend using 8.20 since this is what the libraries are compiled with.

    BR,
    Aslak

  • Aslak, you're a star :-)

    I downgraded to IAR version 8.2 and all is now well. I was able to change one of the values exposed by the device information service, rebuild and flash and hey presto, I see my modified value as it should be!

    It would make sense for instructions for users of 8.3 to be provided at some point but I'm more than happy to work at 8.2.

    Thanks again

    Martin