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

When/How to call lib_aci_get_address using nRF8001 SDK

Hi all,

Trying to read out the nRF8001 serial number using the nRF8001 SDK 1.7 and I cant seem to work out where I should be making the call to lib_aci_get_address? After checking Table 30 of the nRF8001 datasheet, it states that I can call this function at the same places as the known working GetBatteryLevel function. So in the Heart Rate Monitor demo, in heart_rate_sensor.c I added a call to lib_aci_get_address just before the start_battery_monitoring call. I also added a check of the Opcode in lib_aci_cmd_response_hook and dump out a message when I receive ACI_CMD_GET_DEVICE_ADDRESS - which I am receiving. However the device doesnt come up advertising anymore. If I take out the lib_aci_get_address then its fine.

What I want to do, is to load the 8001's address into the Device Information - Serial Number characteristic using services_set_device_information_serial_number_string. However I am having problems with this as well. Where should I be writing this?

Any suggestions?

Mat

Parents
  • The nRF8001 SDK v1.7 uses a single buffer for the SPI ACI communications so you need to certain that you are not you are not sending 2 ACI commands in a row.

    In your case you are sending 2 ACI commands in a row i.e lib_aci_get_address and the lbi_aci_bond/connect so the first command is placed in the SPI buffer while the second command is discarded. This explains the fact that the lib_aci_get_address is processed correctly while the device does not advertise.

    You can move the call to the lib_aci_connect/bond to the lib_aci_cmd_response_hook , when the command response event for the ACI_CMD_GET_DEVICE_ADDRESS is received.

    The same issue is likely to be present when you added the call to services_set_device_information_serial_number_string which uses lib_aci_set_local_data

    = If you use the Bluetooth low energy SDK for Arduino, this uses a FIFO for handling the ACI. This allows you to increase the number of buffers in the FIFO if you need to send more ACI commands in a row and then wait for ACI events. I.e. lib_aci_get_address, lib_aci_set_local_data (pipe=set_device_information_serial_number_string), lib_aci_connect/bond

    Since you need 3 ACI commands in a row you need to set the queue size to more than 3. (uses one slot free method for empty and full conditions so needs 3+1 = 4) In hal_aci_tl.h #define ACI_QUEUE_SIZE 4

Reply
  • The nRF8001 SDK v1.7 uses a single buffer for the SPI ACI communications so you need to certain that you are not you are not sending 2 ACI commands in a row.

    In your case you are sending 2 ACI commands in a row i.e lib_aci_get_address and the lbi_aci_bond/connect so the first command is placed in the SPI buffer while the second command is discarded. This explains the fact that the lib_aci_get_address is processed correctly while the device does not advertise.

    You can move the call to the lib_aci_connect/bond to the lib_aci_cmd_response_hook , when the command response event for the ACI_CMD_GET_DEVICE_ADDRESS is received.

    The same issue is likely to be present when you added the call to services_set_device_information_serial_number_string which uses lib_aci_set_local_data

    = If you use the Bluetooth low energy SDK for Arduino, this uses a FIFO for handling the ACI. This allows you to increase the number of buffers in the FIFO if you need to send more ACI commands in a row and then wait for ACI events. I.e. lib_aci_get_address, lib_aci_set_local_data (pipe=set_device_information_serial_number_string), lib_aci_connect/bond

    Since you need 3 ACI commands in a row you need to set the queue size to more than 3. (uses one slot free method for empty and full conditions so needs 3+1 = 4) In hal_aci_tl.h #define ACI_QUEUE_SIZE 4

Children
Related