Skip to main content

Maintain pairing information

6 years ago

Maintain pairing information

Posted bytomrouse0 points 3 replies
0 upvotes

Hi,

Is there some way to maintain pairing information over a device HW reset?

Our device is operating as a peripheral. We would like to be able to allow a previously paired / encrypted connection to be resumed when the server attempts to re-connect after a full device reset. This needs to include any IRK that may have been received.

We are using a secondary bootloader, so this currently obliterates the retention RAM when re-booting.

Thanks,
Tom

6 years ago

TR_Dialog 0 points

嗨,汤姆,

In order to maintain pairing information, information such as LTK needs to be saved in some memory. Flash Memory or EEPROM will allow you to retain this information thru power cycles. If you are not concerned about power cycle, but just HW reset you may consider the following approach. The full retention RAM is initialized to zero on power up intialization sequence. You may carve out a section of this memory for storage of these pairing information. Once this memory is separated and prevented from init sequence, you will have to add some cookie/signature and/or CRC check on this block to determine the validity of data contained in this block.

Thanks,

TR_DIALOG

3年前

fozhao 0 points

Hello TR_Dialog

I am facing a similar situation here. I am using DA14580 without external flash or EEPROM. I want the paring state to be stored in the device so that, in case the chip is reset by the watchdog, the device will still retain the paring state rather than resetting everything. Could you please clarify on how to carve out a section of memory to story paring information even if the chip is reset by itself. Some lines of code would be nice. Thanks in advance.

Hongyi

3年前

MT_dialog -30 points

Hi fozhao,

The app_sec_env is the struct variable that stores that data of the bonding procedure, this variable is allready part of the retained variables in the SDK, the catch is that different parts of the memory are considered as retained when the device is in extended sleep and deep sleep, for example part of the retained memory area in extended sleep mode (according to the scatter file) is considered the sysram over the 0x20008000 (since the sysram in extended sleep in kept powered) while retained in deep sleep is considered only the actual retention ram of the 580. Regarding your request, there isn't some particular code that will allow you to keep the bonding data retained after an NMI occurs, as long as you have the with the retained attribute (retention_mem_area0) it means that the data are retained. So what actually is wiping out the data when a reset occurs is the actual scatter file (depending on how the regions are declared in the scatter file zero init or UNINIT as you might guess if zero initialized the device will wipe out the memory with zeros and UNINIT will leave the memory as is) and a small for loop in the SDK that is wipes out the data in the actual retention memory (this wipe out of the retention memory should occur in the SystemInit). So in order to save data in the retention memory area and still have them after a reset you should allocate a space in the scatter file where you will keep the bonding data (where exactly will that space be depends on the sleep mode that you are going to use the corresponding memory configuration), and characterize that space with the UNINIT identifier so that the scatterfile wont wipe it out with zeros as soon as there is a reset. Also if the place that you have selected is the actual retention RAM you must remove the selected part from getting initialized from the for loop in the SystemInit() function.

Thanks MT_dialog