QN9020 : What are the connection parameters stored in NVDS?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

QN9020 : What are the connection parameters stored in NVDS?

Jump to solution
2,132 Views
tonymakkiel
Contributor III

Hi,

            Can you please let me know what connection parameters are stored in the NVDS by the stack? From nvds.h file, I found an "enum NVDS_TAG" with values like "NVDS_TAG_BD_ADDRESS", NVDS_TAG_DEVICE_NAME  till value 0x13, Is there any other values which are not exposed by the header files, but used by the stack?

I am trying to debug a re-connection problem. In one occasion, I got my nvds corrupt and it also seems to behave similarly. That make me wonder whether I should concentrate more on the nvds data.

Many Thanks,

Tony

Labels (2)
Tags (1)
0 Kudos
1 Solution
1,847 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Tony,

Please see the Tag ID list that burned by default.

pastedImage_1.png

What is the reconnection problem that you have?

Regards,

Mario

View solution in original post

0 Kudos
19 Replies
1,848 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Tony,

Please see the Tag ID list that burned by default.

pastedImage_1.png

What is the reconnection problem that you have?

Regards,

Mario

0 Kudos
1,847 Views
tonymakkiel
Contributor III

Thank you Mario. What are the keys the LE stack will modify while running(or establishing connection)? I am guessing it will be TK, IRK, CSRK and LTK?  Was there any fixes related to nvds between 1.39 ->1.40?

QN9020 is the peripheral with a custom gatt application. The first pairing and connection is successful. But if I turnoff the master and turn it on, they both goes through the reconnect procedure. The master request start encryption to which slave sends response. Soon after that peripheral disconnects with error code 0x13 [Remote user disconnect request]. But there were no message from the master requesting a disconnect since the LL_ENC_REQ. I am starting to wonder whether the peripheral lost one of the keys, so that instead of sending encryption start it is sending LL_TERMINATE_IND

0 Kudos
1,847 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Tony,

What are the keys the LE stack will modify while running(or establishing connection)?

The keys will be saved depending on the security or privacy features that you enable.

Was there any fixes related to nvds between 1.39 ->1.40?

Please look at the Release notes document included in the SDK?

"C:\NXP\QN902x_SDK_1.4.0\Documents\QN902x SDK ReleaseNotes v1.4.0.pdf"

For the issue, that you are getting, Are you setting the Authentication flag in the characteristic? or How are you enable the security?

Regards,

Mario

0 Kudos
1,847 Views
tonymakkiel
Contributor III

Any idea what might be causing "nvds_get(NVDS_TAG_IRK_KEY, &length, app_env.irk);" to return 2[NVDS_TAG_NOT_DEFINED]? I was expecting it to be 6(NVDS_CORRUPT).

0 Kudos
1,847 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Tony,

Could you please try to read out the NVDS with the NVDS Configuration?

I am assuming the code is erasing this tag.

Regards,

Mario

0 Kudos
1,847 Views
tonymakkiel
Contributor III

Where are the NVDS tags stored?

[ If the answer is on the NVDS itself, what is the difference between errors NVDS_TAG_NOT_DEFINED and NVDS_CORRUPT ?] 

0 Kudos
1,847 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Tony,

The NVDS_TAG_NOT_DEFINED, a tag is not defined and you are trying to access it.

The NVDS_CORRUPT, some information inside the memory has been modified.

Is the issue continues after resetting the default values?

Regards,

Mario

0 Kudos
1,847 Views
tonymakkiel
Contributor III

Are there any known bugs related to Watchdog and nvds data? I seemed to have reproduce NVDS corruption triggering watchdog. I need to run it in a more controlled manner though. I will update once I know more. But just wanted to check whether there is some already known similar issues?

0 Kudos
1,847 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Tony,

What is the process that you are following?

Is it possible that you could share it? We do not have reported something like this.

Regards,

Mario

0 Kudos
1,847 Views
tonymakkiel
Contributor III

All I am doing is initalising hal and watchdog and then run in a continuous loop without feeding the watchdog. Let me see whether I can reproduce it using the standard development board.

Meanwhile can you please let me know where is the 'connected device' whitelist is stored? I am guessing they too are in the nvds? If so, is there a way to check whether that memory is corrupt/erased?

0 Kudos
1,847 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Tony,

You could read out the NVDS with the JLink commander, before and after start your code.

Is it possible that you could provide step by step the process that you are doing?

Also, what is the example that you took as a reference?

Regards,

Mario

0 Kudos
1,847 Views
tonymakkiel
Contributor III

Hi Mario,

      I can connect to the device over JLink commander. But not sure how to read the NVDS memory. Can you point me to any steps/documentation on how to do it please? On the Application developer guide I can see address for ROM, SRAM in 6.1.2 but not for NVDS.

I have been working on product device with a custom firmware[inherited] on it. So not sure what example code they have used for reference. I have made a purchase order for a QN9020 dev board. Once it arrives, will try to reproduce it on a example code and let you know the steps.

Many Thanks,

Tony

0 Kudos
1,847 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Tony,

mem32 40000098 1 //Power on flash: see register 40000098
w4 40000004 400000 //enable spi clock
w4 3ffffff8 0x1000 //set data length to be read
savebin c:\user_path\test.bin 30000000 0x1000‍‍‍‍ //Read and save data

Waiting for the steps that you are following.

Regards,

Mario

0 Kudos
1,847 Views
tonymakkiel
Contributor III

Sorry, I do not understand how to determine the address of data corresponding to NVDS tags. Is there a table/'method to calculate' addresses corresponding to NVDS tags? 

For example: what address should I read to get the BT address?

 nvds_get(NVDS_TAG_BD_ADDRESS

0 Kudos
1,848 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Tony,

You do not need the address for the BD address tag, in this case. You only need the number of the tag assigned to that specific value.

Are you trying to save some bd address value and in running time you want to change it.

Regards,

Mario

0 Kudos
1,848 Views
tonymakkiel
Contributor III

I am hoping to try read the NVDS data before and after as suggested on your post on "06-Dec-2019 09:44". According to the syntax of mem32 I need to pass an address as first argument.

mem32      Read 32-bit items. Syntax: mem32 [<Zone>:]<Addr>, <NumItems> (hex)

What is the <Addr> I should use to read nvds data?

0 Kudos
1,848 Views
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Tony,

The NVDS area occupies 4k bytes Flash space from address 0x0 to 0xfff, and NVDS backup area occupies 4k bytes Flash space from address 0x1f000 to 0x1ffff

If you enter the next commands you will read out all the NVDS memory

mem32 40000098 1 //Power on flash: see register 40000098
w4 40000004 400000 //enable spi clock
w4 3ffffff8 0x1000 //set data length to be read
savebin c:\user_path\test.bin 30000000 0x1000 //Read and save data‍‍‍‍ 
// flash start address 0x30000000

Regards,

Mario

0 Kudos
1,848 Views
tonymakkiel
Contributor III

Hi Mario,

        Sorry, it took a while. I got the MiniDK yesterday and got it working[Thanks again].  I couldn't reproduce the nvds corruption using QN9020 MIniDK board [except once]. So marking this ticket as answered. Thank you

The one time I managed to reproduce it following were the steps.

Modified wdt_example.c in "QN902x_SDK_1.4.0/Projects/Driver/wdt/src". The image was built using Keil and flash to the DK board. I leave the board running for 5 minutes and then connect using NVDS Configurator

diff --git a/wdt_example.c b/wdt_example.c
index a4a22eb..7cd6fc8 100755
--- a/wdt_example.c
+++ b/wdt_example.c
@@ -37,7 +37,7 @@ int main (void)
while (1) /* Loop forever */
{

- wdt_set(0x7F);
+ //wdt_set(0x7F);^M
delay(1000);

// test lock function

0 Kudos
1,848 Views
tonymakkiel
Contributor III

The NVDS Configuration tool, reported error stating it cant read the values and prompted to update it with default values [which I did].

0 Kudos