Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Turning camera off in nrf52-ble-image-transfer-demo for nRF52840 Dongle

Hello everyone, I'd like to implement the nrf52-ble-image-transfer-demo for nRF52840 Dongle. The normal code already plays well. However, since I am aiming for a low-power application, I need to somehow put the camera in sleep mode while it is not used. Since I've found no such code or method, I simply turn it off completely using MOSFET. This worked well for the big nRF52840. I simply introduced a camera_init_new() function to initialize the camera before every Take Picture command. The only problem here I have is that I need to put in a delay after the camera init, I think this is due to the fact that the camera needs some time to initialize. 

However, this does not work for the Donlge. The whole thing simply crashes as soon as I send the take picture command. Funny though that after it crashes it performs some kind of reset, meaning that I get automatically disconnected and can connect again.

Anyone an idea where the problem might be?

  • As long as the SWDIO and SWDCLK pins are connected to P20 of the DK, you should only have to power the Dongle with the same voltage level that the DK is running at (3.0V), and connect the VTG pin of P20 header to VDD on the DK. If you power the dongle through the USB port, the default voltage should be 3.0V, but make sure you do not do an eraseall operation from the debugger (see previously linked tutorial for details).

    I do not see any reasons you should need to cut the D+/- lines of the USB port. It looks like the user in that thread have modified the dongle to connect SWDIO/CLK to the D+/- pads.

  • I tried now to debug via the SWD port and the P19 debug output of the DK. The dongle programming tutorial says that I should be able to program the dongle now like any other DK, so I tried to program it with the functioning code I programmed with the NRF Connect tool via SEGGER. It does not work, however. I also included the following code at the beginning of my main as it was described in the tutorial.

    Where could the problem be?

    if ((NRF_UICR->REGOUT0 & UICR_REGOUT0_VOUT_Msk) ==
        (UICR_REGOUT0_VOUT_DEFAULT << UICR_REGOUT0_VOUT_Pos))
    {
        NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen;
        while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
    
        NRF_UICR->REGOUT0 = (NRF_UICR->REGOUT0 & ~((uint32_t)UICR_REGOUT0_VOUT_Msk)) |
                            (UICR_REGOUT0_VOUT_3V0 << UICR_REGOUT0_VOUT_Pos);
    
        NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren;
        while (NRF_NVMC->READY == NVMC_READY_READY_Busy){}
    
        // System reset is needed to update UICR registers.
        NVIC_SystemReset();
    }

  • Did you erase the dongle before programming the application? If not, the MBR and bootloader on the dongle may not be able to boot the application correctly. Erasing the dongle (using eraseall operation) will set the GPIO voltage to 1.8V, so make sure you have a debugger that supports this voltage before erasing.

    Can you post the exact steps you used to program the dongle, and which example(s) you have tried to program?

Related