CYBT-353027 NVRAM read error

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
MaDu_3290941
Level 2
Level 2
First like received

Hi Cypress,

I'm trying to use the NVRAM to store the pairing keys on a CYBT-353027 Eval board using Hello Client project but it doesn't work.

I have added APP_PATCHES_AND_LIBS += FM25Q04_sflash.a in the makefile of my project as requested in the installation process.

It seems that the write NVRAM command works but if I try to read it again the Read NVRAM function returns 4 which is not documented.

-----> My assumption would be that the write NVRAM doesn't work.

I found in the forum that on Wiced smart, there was an api to handle the write protection, is there something similar for Wiced Studio?

Here are the logs:

hello_client_app_init

wiced_bt_gatt_register status 0

wiced_bt_gatt_db_init 0

hello_client_management_cback: 17

Advertisement State Change: 3

wiced_bt_start_advertisements 0

1

2

3

4

5

6

7

8

9

10

hello_client_gatt_callback event 0

hclient_connection_up Conn Id:1 Num conn:1,Addr:<7f 22 c6 9f 4c 50 > role:1

hello_client_management_cback: 17

Advertisement State Change: 0

hello_client_gatt_callback event 4

hello_sensor_gatts_req_cb. conn 1, type 5

peer mtu:185

hello_client_gatt_callback event 4

hello_sensor_gatts_req_cb. conn 1, type 1

read_hndlr conn 1 hdl 42

hello_client_gatt_callback event 4

hello_sensor_gatts_req_cb. conn 1, type 1

read_hndlr conn 1 hdl 44

11

hello_client_gatt_callback event 4

hello_sensor_gatts_req_cb. conn 1, type 1

read_hndlr conn 1 hdl 46

hello_client_gatt_callback event 4

hello_sensor_gatts_req_cb. conn 1, type 1

read_hndlr conn 1 hdl 62

hello_client_management_cback: d

hello_client_management_cback: a

hello_client_management_cback: 12

--------------------------------------------------------FIRST PAIRING---------------------------------------------------

Read NVRAM at:1 bytes:0 result:4              // Can't read NVRAM, return 4 which is not documented

writing to id:1

Saved 138 bytes at id:1 0                            // Seemed to have saved the pairing key

hello_client_management_cback: b

Pairing Complete: 8

--------------------------------------------------------------------------------------------------------------------------------

12

hello_client_gatt_callback event 4

hello_sensor_gatts_req_cb. conn 1, type 1

read_hndlr conn 1 hdl 16

13

hello_client_gatt_callback event 4

hello_sensor_gatts_req_cb. conn 1, type 1

read_hndlr conn 1 hdl 16

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

hello_client_gatt_callback event 0

hello_client_connection_down 1 <7f 22 c6 9f 4c 50 >

hello_client_management_cback: 17

Advertisement State Change: 3

wiced_bt_start_advertisements: 0

29

30

31

32

33

34

35

-----------------------------------------------------------------RESET DEV BOARD--------------------------------------------------

áhello_client_management_cback: 15

hello_client_management_cback: 14

hello_client_management_cback: 14

hello_client_management_cback: 0

hello_client_app_init

wiced_bt_gatt_register status 0

wiced_bt_gatt_db_init 0

hello_client_management_cback: 17

Advertisement State Change: 3

wiced_bt_start_advertisements 0

1

2

3

hello_client_gatt_callback event 0

hclient_connection_up Conn Id:1 Num conn:1,Addr:<7f 22 c6 9f 4c 50 > role:1

hello_client_management_cback: 17

Advertisement State Change: 0

hello_client_gatt_callback event 4

hello_sensor_gatts_req_cb. conn 1, type 5

peer mtu:185

hello_client_gatt_callback event 4

hello_sensor_gatts_req_cb. conn 1, type 1

read_hndlr conn 1 hdl 42

hello_client_gatt_callback event 4

hello_sensor_gatts_req_cb. conn 1, type 1

read_hndlr conn 1 hdl 44

hello_client_gatt_callback event 4

hello_sensor_gatts_req_cb. conn 1, type 1

read_hndlr conn 1 hdl 46

hello_client_gatt_callback event 4

hello_sensor_gatts_req_cb. conn 1, type 1

read_hndlr conn 1 hdl 62

hello_client_management_cback: d

hello_client_management_cback: a

4

5

6

7

hello_client_management_cback: c

--------------------------------------------------------TRY TO RECONNECT ---------------------------------------------------

encryption status: bd ( 7f 22 c6 9f 4c 50  ) res 0

hello_client_encryption_changed 0hello_client_management_cback: 12

Read NVRAM at:1 bytes:0 result:4                      // Can't read the NVRAM at he exact same id as it was supposed to be saved in the previous connection

Delete id:1 Result:8109

writing to id:1

Saved 138 bytes at id:1 0                                    // Write the pairing key at the first Id as done during the previous connection

hello_client_management_cback: b

Pairing Complete: 0

-----------------------------------------------------------------------------------------------------------------------------------------

hello_client_gatt_callback event 4

hello_sensor_gatts_req_cb. conn 1, type 1

read_hndlr conn 1 hdl 2b

8

hello_client_gatt_callback event 4

hello_sensor_gatts_req_cb. conn 1, type 1

read_hndlr conn 1 hdl 16

9

10

hello_client_gatt_callback event 4

hello_sensor_gatts_req_cb. conn 1, type 1

read_hndlr conn 1 hdl 16

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.

I tested the NVRAM write with WICED 6.1 on CYBT353027. I add some log to print the bonded device in the BTM_ENABLED_EVT. After bonded two device, the bonded device address can be read successfully after reset of the module. Below is the trace log:

[18:35:1:989] Z

[18:35:2:4] 穁簵

[18:35:2:139] hello_client_management_cback: 15

hello_client_management_cback: 0

hello_client_app_init

wiced_bt_gatt_register status 0

wiced_bt_gatt_db_init 0

hello_client_management_cback: 17

Advertisement State Change: 3

wiced_bt_start_advertisements 0

[18:35:5:539] hello_client_gatt_callback event 0

hclient_connection_up Conn Id:1 Num conn:1,Addr:<bc 20 10 12 09 6d > role:1

hello_client_management_cback: 17

Advertisement State Change: 0

hello_client_management_cback: d

hello_client_management_cback: a

[18:35:6:338] hello_client_management_cback: c

encry

[18:35:6:360] ption status: bd ( bc 20 10 12 09 6d ) res 0

hello_client_encryption_changed 0

[18:35:6:632] hello_client_management_cback: 12

R

[18:35:6:647] ead NVRAM at:1 bytes:0 result:4                  // First device bonded

writing to id:1

[18:35:6:663] Saved 138 bytes at id:1 4

hello_client_management_cback:

[18:35:6:680] b

Pairing Complete: 0

hello_client_management_cback: 1f

[18:35:13:910] hello_client_management_cback: 1f

[18:35:14:437] hello_client_gatt_callback event 0

[18:35:14:464] hello_client_connection_down 1 <bc 20 10 12 09 6d >

hello_client_management_cback: 17

Advertisement State Change: 3

wiced_bt_start_advertisements: 0

[18:35:19:24] hello_client_gatt_callback event 0

hclient_connection

[18:35:19:56] _up Conn Id:1 Num conn:1,Addr:<18 59 36 ff ea 1e > role:1

hello_client_management_cback: 17

Advertisement State Change: 0

hello_client_management_cback: d

hello_client_management_cback: a

[18:35:19:312] hello

[18:35:19:328] _client_management_cback: 1f

[18:35:19:918] hello_client_management_cback: c

encryption status: bd ( 18 59 36 ff ea 1e ) res 0

hello_client_encryption_changed 0

[18:35:20:213] hello_client_management_cback: 12

Read NVRAM at:1 bytes:138 result:0                       // second device bonded

Read NVRAM at:2 bytes:0 result:4

writing to id:2

[18:35:20:228] Saved 138 bytes at id:2 4

hello_client

[18:35:20:249] _management_cback: b

Pairing Complete: 0

hello_client_management_cback: 1f

[18:35:27:464]

// module reset

[18:35:27:842] Z簵

[18:35:27:938] h

[18:35:27:991] ello_client_management_cback: 15

hello_client_management_cback: 0

hello_client_app_init

wiced_bt_gatt_register status 0

wiced_bt_gatt_db_init 0

Updated Addr Resolution DB:0

Updated Addr Resolution DB:0

hello_client_management_cback: 17

Advertisement State Change: 3

wiced_bt_start_advertisements 0

bonded device address is: bc 20 10 12 09 6d  //read the bonded devices infromation

bonded device address is: 18 59 36 ff ea 1e

I also attached the project I used for your reference.

View solution in original post

3 Replies
AnjanaM_61
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 5 questions asked

Hi,

Could you please let us know Which version of the SDK you are using?

Regards,

Anjana

0 Likes

anpm

I'm using SDK 6.1.

I tried to move to 6.2 but the installation failed on my Ubuntu machine. No solution yet in the forum:

https://community.cypress.com/message/176629?et=watches.email.thread#176629

0 Likes
lock attach
Attachments are accessible only for community members.

I tested the NVRAM write with WICED 6.1 on CYBT353027. I add some log to print the bonded device in the BTM_ENABLED_EVT. After bonded two device, the bonded device address can be read successfully after reset of the module. Below is the trace log:

[18:35:1:989] Z

[18:35:2:4] 穁簵

[18:35:2:139] hello_client_management_cback: 15

hello_client_management_cback: 0

hello_client_app_init

wiced_bt_gatt_register status 0

wiced_bt_gatt_db_init 0

hello_client_management_cback: 17

Advertisement State Change: 3

wiced_bt_start_advertisements 0

[18:35:5:539] hello_client_gatt_callback event 0

hclient_connection_up Conn Id:1 Num conn:1,Addr:<bc 20 10 12 09 6d > role:1

hello_client_management_cback: 17

Advertisement State Change: 0

hello_client_management_cback: d

hello_client_management_cback: a

[18:35:6:338] hello_client_management_cback: c

encry

[18:35:6:360] ption status: bd ( bc 20 10 12 09 6d ) res 0

hello_client_encryption_changed 0

[18:35:6:632] hello_client_management_cback: 12

R

[18:35:6:647] ead NVRAM at:1 bytes:0 result:4                  // First device bonded

writing to id:1

[18:35:6:663] Saved 138 bytes at id:1 4

hello_client_management_cback:

[18:35:6:680] b

Pairing Complete: 0

hello_client_management_cback: 1f

[18:35:13:910] hello_client_management_cback: 1f

[18:35:14:437] hello_client_gatt_callback event 0

[18:35:14:464] hello_client_connection_down 1 <bc 20 10 12 09 6d >

hello_client_management_cback: 17

Advertisement State Change: 3

wiced_bt_start_advertisements: 0

[18:35:19:24] hello_client_gatt_callback event 0

hclient_connection

[18:35:19:56] _up Conn Id:1 Num conn:1,Addr:<18 59 36 ff ea 1e > role:1

hello_client_management_cback: 17

Advertisement State Change: 0

hello_client_management_cback: d

hello_client_management_cback: a

[18:35:19:312] hello

[18:35:19:328] _client_management_cback: 1f

[18:35:19:918] hello_client_management_cback: c

encryption status: bd ( 18 59 36 ff ea 1e ) res 0

hello_client_encryption_changed 0

[18:35:20:213] hello_client_management_cback: 12

Read NVRAM at:1 bytes:138 result:0                       // second device bonded

Read NVRAM at:2 bytes:0 result:4

writing to id:2

[18:35:20:228] Saved 138 bytes at id:2 4

hello_client

[18:35:20:249] _management_cback: b

Pairing Complete: 0

hello_client_management_cback: 1f

[18:35:27:464]

// module reset

[18:35:27:842] Z簵

[18:35:27:938] h

[18:35:27:991] ello_client_management_cback: 15

hello_client_management_cback: 0

hello_client_app_init

wiced_bt_gatt_register status 0

wiced_bt_gatt_db_init 0

Updated Addr Resolution DB:0

Updated Addr Resolution DB:0

hello_client_management_cback: 17

Advertisement State Change: 3

wiced_bt_start_advertisements 0

bonded device address is: bc 20 10 12 09 6d  //read the bonded devices infromation

bonded device address is: 18 59 36 ff ea 1e

I also attached the project I used for your reference.