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

nRF52 ANT DFU, hangs at wait_for_events()

Hello, I'm trying to implement a buttonless DFU via ANT for a custom nRF52 board. I've got the 212 v4.02 Softdevice and I'm using the 14.0.0 SDK. I am able to transmit and receive via ANT, I am able to go into my bootloader, and I can progress through the bootloader until I hit the "err_code = bootloader_dfu_start();" line. This function progresses until it hits "wait_for_events()". At this point it just hangs waiting for (I assume) an ANT event that never occurs.

When I attempt to connect to the device via "OTAUpdater.exe" I am unable to, thus no ANT event. I set the manufacturer ID and product ID to wildcard (0), select nRF52 as the platform, and it is unable to see my board. When the ANT-FS in the bootloader times out (~2 minutes via default setting), it kicks me back to my main program code, at which point ANT broadcasting starts working immediately.

I am able to perform an OTA update on my nRF52 DK using the same method I am trying with my custom device. Any suggestions?

  • I received another one of my custom boards. Same symptoms on that board as the first one. I am able to do everything ANT I could want within the application, but I am unable to connect with the OTA DFU program when I put it into bootloader DFU mode.

  • I meant without the buttonless application. Only SoftDevice and bootloader. Then you should start in the bootloader directly, but as I said shot in the dark.

    There is a trick you can do to be able do debug. If you set optimizations to 0, then increase the amount of flash set aside for the bootloader and set the new start address in UICR. I set the flash start to 0x77000 and size to 0x9000. Then you you can change the BOOTLOADER_REGION_START to 0x77000.

    Have you checked with ANTware that the bootloader is actually broadcasting?

    Are you using the exact same bootloader firmware on the nRF52 DK and the custom board? If not, could it be that you forgot to set the ANT-FS network key? ANT_FS_NETWORK_KEY

  • I haven't tried the bootloader without application code, no. I guess I can try that out here in a minute.

    I am using the same bootloader, however I have ANTFS_CONFIG_AUTH_TYPE_PASSKEY_ENABLED set to 0 and ANTFS_CONFIG_AUTH_TYPE_PASSTHROUGH_ENABLED set to 1, so I don't think it's the network key.

    I know my application code and my bootloader code have different sdk_config.h files, so is there some conflict I need to be resolving in there or something?

  • I'm not sure what those defines have to do with the network key? Have you defined ANT_FS_NETWORK_KEY? It will be all zeroes if not modified, and then I don't think it will work.

  • You were correct, I needed to add the ANT_FS_NETWORK_KEY (and I added the ANT+ network key too). Now I am able to connect to the device, but I am unable to upload an image. It says I have 421888 free space, and my .hex is only 49152.

    When I look at the ao_debug_ANTFSHost.txt file, it shows the device being found, has data, has upload enabled, is not in pairing mode, and is a match. It shows some pinging, downloads, and requests, and then it starts "Requesting Upload..." and continues to do so until it says:

    " 36.156 { 2422468}: ANTFSHostChannel::Upload(): Timeout. 36.156 { 2422468}: ANTFSHostChannel::UploadLoop(): RETURN_FAIL - 2412937 36.281 { 2422593}: ANTFSHostChannel::Upload(): Tx error sending upload command."

    At this point I lose connection and I am unable to reconnect without restarting the device and putting it back into bootloader DFU mode. What should I do to solve this?

Related