After developing with an nRF52832 DK (pca10040), our code builds and runs fine. But when we try to use the same code on the nRF52840 dongle it does'nt work. We added flashing LEDs in the main function to get some feedback about whether or not the code is running. The scan_init function seems to be the problem as we are able to make LEDs glow at the end of the main function when we removed scan_init and scan_start. I can't find any examples with pca10059 as central. Is it any special configuration you need to do?
The best work method when developing for nRF52840 dongle is to use the nRF52840 DK. For starters, the pin assignments and the softdevice that are typically used is different between nRF52832 and nRF52840. This answer contains some stuff that needs to be changed when moving from nRF52832 to nRF52840. I think the best and fastest way would be to copy your project into a SDK example project that already has been configured for the Dongle.
There is also some differences between projects configured for the nRF52840 Dongle and the nRF52840 DK as highlighted by this blog post.