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

ios nrf loader timeout during upload

I have the nRF Loader app installed on an iPad Mini. I have the dfu_dual_bank_ble firmware from SDK V5.0.0 and SoftDevice V6.0.0.1-beta loaded on my nRF51822.

The app is able to see the device named "DfuTarg" and pair with it, the status becomes "ready", but when it tries to upload, it will hang for a minute and then report an unexpected timeout error.

The LED that indicates connection establishment is on when DfuTarg is selected, but it goes off when the timeout error arrives.

How do I make DFU work? What is causing the timeout?

  • I added some UART debug statements to the nRF DFU code.

    It seems like the nRF51 chip itself is resetting periodically after the dfu timer times out.

    Once upload starts, it hits "receive fw" and runs "app_data_process" a few times, then it freezes for a few seconds before the entire microcontroller resets

    Also I am forced to use MicroLIB to compile, because without MicroLIB, it doesn't fit into the IRAM. I wonder if that makes a difference

    the iOS NSLog is shown below

    2013-12-08 15:36:47.286 nRF Loader[1103:60b] Set firmware with size 17260, notificationPacketInterval: 43 2013-12-08 15:36:47.398 nRF Loader[1103:60b] CoreBluetooth[WARNING] <CBCentralManager: 0x15d24510> is disabling duplicate filtering, but is using the default queue (main thread) for delegate events 2013-12-08 15:36:47.401 nRF Loader[1103:60b] Started scan. 2013-12-08 15:36:47.405 nRF Loader[1103:60b] Central manager did update state: 5 2013-12-08 15:36:48.519 nRF Loader[1103:60b] Stopped scan. 2013-12-08 15:36:48.634 nRF Loader[1103:60b] didConnectPeripheral DfuTarg 2013-12-08 15:36:48.637 nRF Loader[1103:60b] didConnect 2013-12-08 15:36:48.640 nRF Loader[1103:60b] State changed from 0 to 1. 2013-12-08 15:36:49.196 nRF Loader[1103:60b] didDiscoverServices succeeded. 2013-12-08 15:36:49.199 nRF Loader[1103:60b] Discover characteristics... 2013-12-08 15:36:49.376 nRF Loader[1103:60b] didDiscoverCharacteristics succeeded. 2013-12-08 15:36:49.379 nRF Loader[1103:60b] Found packet characteristic. 2013-12-08 15:36:49.380 nRF Loader[1103:60b] Found control point characteristic. 2013-12-08 15:36:49.382 nRF Loader[1103:60b] didFinishDiscovery 2013-12-08 15:36:49.384 nRF Loader[1103:60b] State changed from 1 to 2. 2013-12-08 15:36:55.144 nRF Loader[1103:60b] startTransfer 2013-12-08 15:36:55.146 nRF Loader[1103:60b] State changed from 2 to 3. 2013-12-08 15:36:55.148 nRF Loader[1103:60b] sendNotificationRequest 2013-12-08 15:36:55.196 nRF Loader[1103:60b] didWriteControlPoint, state 3 2013-12-08 15:36:55.199 nRF Loader[1103:60b] State changed from 3 to 4. 2013-12-08 15:36:55.202 nRF Loader[1103:60b] sendStartCommand 2013-12-08 15:36:55.256 nRF Loader[1103:60b] didWriteControlPoint, state 4 2013-12-08 15:36:55.316 nRF Loader[1103:60b] Did update value for characteristic <CBCharacteristic: 0x15e56cf0>. Value: <100101>. 2013-12-08 15:36:55.319 nRF Loader[1103:60b] didReceiveResponse, 1, in state 4 2013-12-08 15:36:55.321 nRF Loader[1103:60b] State changed from 4 to 5. 2013-12-08 15:36:55.322 nRF Loader[1103:60b] sendReceiveCommand 2013-12-08 15:36:55.376 nRF Loader[1103:60b] didWriteControlPoint, state 5 2013-12-08 15:36:55.379 nRF Loader[1103:60b] State changed from 5 to 6. 2013-12-08 15:36:55.380 nRF Loader[1103:60b] sendFirmwareData 2013-12-08 15:36:55.392 nRF Loader[1103:60b] didWriteDataPacket 2013-12-08 15:36:55.394 nRF Loader[1103:60b] State changed from 6 to 9. 2013-12-08 15:36:55.395 nRF Loader[1103:60b] Sent 860 bytes, total 860. 2013-12-08 15:36:55.438 nRF Loader[1103:60b] Did update value for characteristic <CBCharacteristic: 0x15e56cf0>. Value: <100306>. 2013-12-08 15:36:55.440 nRF Loader[1103:60b] didReceiveResponse, 6, in state 9 2013-12-08 15:36:55.442 nRF Loader[1103:60b] Did update value for characteristic <CBCharacteristic: 0x15e56cf0>. Value: <100306>. 2013-12-08 15:36:55.443 nRF Loader[1103:60b] didReceiveResponse, 6, in state 9 2013-12-08 15:36:55.466 nRF Loader[1103:60b] Did update value for characteristic <CBCharacteristic: 0x15e56cf0>. Value: <100306>. 2013-12-08 15:36:55.469 nRF Loader[1103:60b] didReceiveResponse, 6, in state 9 2013-12-08 15:36:55.471 nRF Loader[1103:60b] Did update value for characteristic <CBCharacteristic: 0x15e56cf0>. Value: <100306>. 2013-12-08 15:36:55.473 nRF Loader[1103:60b] didReceiveResponse, 6, in state 9 2013-12-08 15:36:55.498 nRF Loader[1103:60b] Did update value for characteristic <CBCharacteristic: 0x15e56cf0>. Value: <100306>. 2013-12-08 15:36:55.499 nRF Loader[1103:60b] didReceiveResponse, 6, in state 9 2013-12-08 15:36:55.501 nRF Loader[1103:60b] Did update value for characteristic <CBCharacteristic: 0x15e56cf0>. Value: <100306>. 2013-12-08 15:36:55.503 nRF Loader[1103:60b] didReceiveResponse, 6, in state 9 2013-12-08 15:36:55.526 nRF Loader[1103:60b] Did update value for characteristic <CBCharacteristic: 0x15e56cf0>. Value: <100306>. 2013-12-08 15:36:55.529 nRF Loader[1103:60b] didReceiveResponse, 6, in state 9 2013-12-08 15:36:55.531 nRF Loader[1103:60b] Did update value for characteristic <CBCharacteristic: 0x15e56cf0>. Value: <100306>. 2013-12-08 15:36:55.533 nRF Loader[1103:60b] didReceiveResponse, 6, in state 9 2013-12-08 15:36:55.556 nRF Loader[1103:60b] Did update value for characteristic <CBCharacteristic: 0x15e56cf0>. Value: <100306>. 2013-12-08 15:36:55.559 nRF Loader[1103:60b] didReceiveResponse, 6, in state 9 2013-12-08 15:36:55.586 nRF Loader[1103:60b] Did update value for characteristic <CBCharacteristic: 0x15e56cf0>. Value: <100306>. 2013-12-08 15:36:55.589 nRF Loader[1103:60b] didReceiveResponse, 6, in state 9 2013-12-08 15:36:55.591 nRF Loader[1103:60b] Did update value for characteristic <CBCharacteristic: 0x15e56cf0>. Value: <100306>. 2013-12-08 15:36:55.592 nRF Loader[1103:60b] didReceiveResponse, 6, in state 9 2013-12-08 15:36:55.616 nRF Loader[1103:60b] Did update value for characteristic <CBCharacteristic: 0x15e56cf0>. Value: <100306>. 2013-12-08 15:36:55.619 nRF Loader[1103:60b] didReceiveResponse, 6, in state 9 2013-12-08 15:36:55.621 nRF Loader[1103:60b] Did update value for characteristic <CBCharacteristic: 0x15e56cf0>. Value: <100306>. 2013-12-08 15:36:55.622 nRF Loader[1103:60b] didReceiveResponse, 6, in state 9 2013-12-08 15:37:56.349 nRF Loader[1103:60b] didDisconnectPeripheral DfuTarg: Error Domain=CBErrorDomain Code=6 "The connection has timed out unexpectedly." UserInfo=0x15d49480 {NSLocalizedDescription=The connection has timed out unexpectedly.} 2013-12-08 15:37:56.351 nRF Loader[1103:60b] didDisconnect 2013-12-08 15:37:56.481 nRF Loader[1103:60b] State changed from 9 to 0. 2013-12-08 15:37:56.554 nRF Loader[1103:60b] cancelTransfer 2013-12-08 15:37:56.556 nRF Loader[1103:60b] CoreBluetooth[WARNING] <CBCentralManager: 0x15d24510> is disabling duplicate filtering, but is using the default queue (main thread) for delegate events 2013-12-08 15:37:56.560 nRF Loader[1103:60b] Started scan.

  • I've identified that hci_mem_pool_rx_produce is failing due to NRF_ERROR_NO_MEM

    Is it because iOS is sending faster than the nRF can process? How do we slow down iOS?

  • You can change how many packets the iOS app sends between receiving a confirmation, which may help NO_MEMORY issues, by tuning the setting of the notificationPacketInterval in setFirmwareURL of the DFUController.

    The algorithm to set this number was chosen based on getting a reasonable amount of updates over an application upload, but doesn't check the size it ends up at. May I ask how large the binary you're trying to upload is? It could be that this number simply becomes too big for the buffers on the nRF51822 side if the binary itself is big.

  • Thanks for the logs. I've posted a separate answer showing how the number of packets transmitted per notification can be changed, since it doesn't seem to have anything to do with what I thought was the initial problem.

  • I am just trying out ble_app_rscs, 17260 bytes

    changing notificationPacketInterval to 1 worked! it seems to transfer 20 (which is max packet size) bytes per notification now.

    should I just increase it until it stops working?

    Also although it seems to detect a valid application because it attempts to launch it, the application itself seems to be self-resetting... How do I go about generating a .bin file from my own .hex file?

    I realize the above question is actually very simple to answer myself, but hex files specify addresses, bin files do not, I need to know the proper way of doing the conversion because of the address offset.

Related