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.

  • Why are you using a text file?

    The data is binary - not text.

  • That is the easiest way with the current setup I have. I know the data is binary, but have compared the data from ReadDynamicData and from reading it back after saving it and the data is correctly recorded so that should not be an issue.

  • And you're certain there is no translation; eg LF/CR/CRLF ... ?

  • Each of the 8 sequences is stored as its own line with CRLF added to each. I read out the CRLF into a temp buffer for each line when reading the data back in order to write just the dynamic data it to the nrf8001. If there was an issue with the data itself, wouldn't I be expecting Status of ACI_STATUS_ERROR_INVALID_LENGTH, ACI_STATUS_ERROR_INVALID_PARAMETER or ACI_STATUS_ERROR_INVALID_DATA instead of the ACI_STATUS_ERROR_INTERNAL?

  • 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.

1 2