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

nRF8001 WriteDynamicData Internal Error

I am currently using version 'NRF D 8001 1429SH' as printed on the nrf8001 IC

I have already managed to successfully bond with an android phone and completed the ReadDynamicData cycle, with correct event status of ACI_STATUS_TRANSACTION_CONTINUE for sequence 1-7 and ACI_STATUS_TRANSACTION_COMPLETE where I read sequence 8. Sequences 1-7 have lengths of 27 and sequence 8 has a length of 12. I read the dynamic data and then save it on my embedded file system in a .txt file. Upon power cycle, I read from the .txt file the 8 sequences of dynamic data and attempt to start the WriteDynamicData cycle from standby mode to restore dynamic data. I can successfully call acil_encode_command_write_dynamic_data(writebuffer, 1, dyanmicdata1, 27) //seq# 1, len 27 and receive the expected CommandResponseEvent with correct Opcode for WriteDynamicData and correct Status of ACI_STATUS_TRANSACTION_CONTINUE. However, when I call acil_encode_command_write_dynamic_data(writebuffer, 2, dyanmicdata2, 27) //seq#2, len 27, I get a CommandResponseEvent with Correct Opcode for WriteDynamicData but Status of ACI_STATUS_ERROR_INTERNAL.

Why does it generate an internal error, any solutions?

Write Buffer - for data sent via SPI to nrf8001

Read Buffer - for data received via SPI from nrf8001

Here is the SPI data, debug, and the 8 dyanmic data sequenecs:

Read buffer: 04 81 03 00 02 00 00 00

BLEP Received ACI_EVT_DEVICE_STARTED event as expected

BLEP Entering standby mode

//dynamic data read from file in filesystem into which ReadDyanmicData was saved

Dyanmic Data Seq 1:04 02 03 00 08 11 00 03 06 4E 6F 50 61 69 6E 00 0A 04 00 00 00 00 00 0B 02 00 00

Dyanmic Data Seq 2:00 00 0E 01 0A 00 10 02 30 31 00 12 02 31 32 00 14 02 33 34 00 16 07 02 00 00 00

Dyanmic Data Seq 3:AA AA CC CC 00 19 00 00 1B 00 00 1C 02 00 00 00 1F 00 00 21 00 00 22 02 01 00 00

Dyanmic Data Seq 4:00 24 00 00 25 02 00 00 00 27 06 FF FF FF FF FF FF 0C 00 10 5A A4 20 38 A4 E8 00

Dyanmic Data Seq 5:E2 01 01 1D CC 5D 16 2C 4D B7 64 3D F0 10 9A 15 46 95 B6 71 0C 5B 8D 59 B1 0E 00

Dyanmic Data Seq 6:B4 F5 DC 64 00 F8 22 3E 54 3F 58 16 60 10 D9 17 86 BB 1E 23 1F C0 7E 20 1B 0D 00

Dyanmic Data Seq 7:F1 00 00 00 00 00 00 00 00 FA DD 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Dyanmic Data Seq 8:00 00 00 00 00 00 00 14 02 3A 36 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

// encoding frist WriteDyanmicData command

WriteDyanmicData sequence 1

First 27 bytes of write Buffer for Sequence1:1D 08 01 04 02 03 00 08 11 00 03 06 4E 6F 50 61 69 6E 00 0A 04 00 00 00 00 00 0B

Read buffer: 03 84 08 01 00 00 00 00

Event: ACI Event Command Response

Event Opcode: ACI_CMD WriteDyanmicData

Event Status: WriteDyanmicData Continue

// encoding second WriteDyanmicData command

WriteDyanmicData sequence 2

First 27 bytes of write Buffer for sequence 2:1D 08 02 00 00 0E 01 0A 00 10 02 30 31 00 12 02 31 32 00 14 02 33 34 00 16 07 02

Read buffer: 03 84 08 81 00 00 00 00

Event: ACI Event Command Response

Event Opcode: ACI_CMD WriteDyanmicData

Event Status: ACI_STATUS_ERROR_INTERNAL

  • UPDATE:

I have now tried to call writeDynamicData cycle with the data received directly after readDynamicData cycle completes. Without saving the data in a file or manipulating the data at all, I get the same error as above during write sequence 2.

Parents
  • This looks like a storage issue. The Read Dynamic Data is not matching with the Write Dynamic data from what I see.

    Read: Dyanmic Data Seq 1:04 02 03 00 08 11 00 03 06 4E 6F 50 61 69 6E 00 0A 04 00 00 00 00 00 0B 02 00 00

    Write: WriteDyanmicData sequence 1 First 27 bytes of write Buffer for Sequence1:1D 08 01 04 02 03 00 08 11 00 03 06 4E 6F 50 61 69 6E 00 0A 04 00 00 00 00 00 0B

    They seem to be quite different and points at a storage issue.

    Additionally I took a look at the code storing the Dynamic Data in the nRF8001 SDK for Arduino.

    That does not seem to be using the encode function, so I also suspect the storage/encode is the issue.

    Added I would encourage you to base new development on the the nRF8001 SDK for Arduino as that is the latest and has a lot of fixes and improvements. The nRF8001 SDK does not have a lot of fixes or enhancements. It also has support for multiple platforms like Renesas, STM etc. If you are an existing user of the nRF8001 SDK, I would urge you to upgrade.

  • The Read: is the dynamic data itself, while the Write: is the data encoded with the WriteDyanmicData command, to be sent via SPI to the nrf8001.

    Ignorng the first 3 Bytes from the encoded Write: command [1D ,08, 01] : 1D is length of 29, 27 from sequence and 2 from #define MSG_WRITE_DYNAMIC_DATA_BASE_LEN 2 in the acilib.h file from the sdk. 08 is the code for WriteDynamicData, and 01 is the sequence number. The rest of the data is acutally the Dynamic Data from the Read ignore-(1D 08 01) read- 04 02 03 00 08 11 ...

    I am not using an Arduino or the SDK for it. I am using the regular nrf8001 SDK, so using the encode command is my only option. From acilib.c :

    void acil_encode_cmd_write_dynamic_data(uint8_t buffer, uint8_t seq_no, uint8_t dynamic_data, uint8_t dynamic_data_size) { *(buffer + OFFSET_ACI_CMD_T_LEN) = MSG_WRITE_DYNAMIC_DATA_BASE_LEN + dynamic_data_size; *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_WRITE_DYNAMIC_DATA; *(buffer + OFFSET_ACI_CMD_T_WRITE_DYNAMIC_DATA + OFFSET_ACI_CMD_PARAMS_WRITE_DYNAMIC_DATA_T_SEQ_NO) = seq_no; memcpy((buffer + OFFSET_ACI_CMD_T_WRITE_DYNAMIC_DATA + OFFSET_ACI_CMD_PARAMS_WRITE_DYNAMIC_DATA_T_DYNAMIC_DATA), dynamic_data, dynamic_data_size); }

    Write: displays uint8_t buffer parameter value after calling acil_encode..(), and Read: displays uint8_t dynamic_data parameter value.

    Additionally I have tested the storgage issue, I have tried to call WriteDyanmicData cycle directly after ReadDynamicData cycle, storing the data in uint8_t arrays and sending them directly into the WriteDynamicData cycle as parameters - no saving into storage, no manipulating- and I get the same error at the same sequence, 2. So storage cannot be the issue?

Reply
  • The Read: is the dynamic data itself, while the Write: is the data encoded with the WriteDyanmicData command, to be sent via SPI to the nrf8001.

    Ignorng the first 3 Bytes from the encoded Write: command [1D ,08, 01] : 1D is length of 29, 27 from sequence and 2 from #define MSG_WRITE_DYNAMIC_DATA_BASE_LEN 2 in the acilib.h file from the sdk. 08 is the code for WriteDynamicData, and 01 is the sequence number. The rest of the data is acutally the Dynamic Data from the Read ignore-(1D 08 01) read- 04 02 03 00 08 11 ...

    I am not using an Arduino or the SDK for it. I am using the regular nrf8001 SDK, so using the encode command is my only option. From acilib.c :

    void acil_encode_cmd_write_dynamic_data(uint8_t buffer, uint8_t seq_no, uint8_t dynamic_data, uint8_t dynamic_data_size) { *(buffer + OFFSET_ACI_CMD_T_LEN) = MSG_WRITE_DYNAMIC_DATA_BASE_LEN + dynamic_data_size; *(buffer + OFFSET_ACI_CMD_T_CMD_OPCODE) = ACI_CMD_WRITE_DYNAMIC_DATA; *(buffer + OFFSET_ACI_CMD_T_WRITE_DYNAMIC_DATA + OFFSET_ACI_CMD_PARAMS_WRITE_DYNAMIC_DATA_T_SEQ_NO) = seq_no; memcpy((buffer + OFFSET_ACI_CMD_T_WRITE_DYNAMIC_DATA + OFFSET_ACI_CMD_PARAMS_WRITE_DYNAMIC_DATA_T_DYNAMIC_DATA), dynamic_data, dynamic_data_size); }

    Write: displays uint8_t buffer parameter value after calling acil_encode..(), and Read: displays uint8_t dynamic_data parameter value.

    Additionally I have tested the storgage issue, I have tried to call WriteDyanmicData cycle directly after ReadDynamicData cycle, storing the data in uint8_t arrays and sending them directly into the WriteDynamicData cycle as parameters - no saving into storage, no manipulating- and I get the same error at the same sequence, 2. So storage cannot be the issue?

Children
No Data
Related