"[ERROR] Read(64 bytes) failed" and "cannot deliver frequency" after receiving for some time

After debugging some code, and not closing the device in code properly, I get

e[1me[31m[ERROR] TuneVCO(CGEN) - failed to lock (cmphl!=0)e[0m
e[1me[31m[ERROR] SetFrequencyCGEN(440 MHz) failede[0m
e[1me[31m[ERROR] SetFrequencySXR(2427 MHz) - cannot deliver frequencye[0m

In Lime Suite GUI I see that the gateware is version 0 revision 0

[08:32:43] WARNING: Gateware version mismatch!
  Expected gateware version 2, revision 17
  But found version 0, revision 0
  Follow the FW and FPGA upgrade instructions:
  http://wiki.myriadrf.org/Lime_Suite#Flashing_images
  Or run update on the command line: LimeUtil --update

Trying the self test doesn’t work at all. Just loading the self_test.ini shows some errors, as well as other steps:

[08:33:36] ERROR: TuneVCO(CGEN) - failed to lock (cmphl!=0)
[08:33:36] ERROR: SetFrequencyCGEN(60.9751 MHz) failed

So 2 questions:

  • How can I make the LimeSDR usable again (so similar to How to reset the USB connection to the LimeSDR)?
  • How can I detect that kind of problem? The issue is that when I call SoapySDRDevice_setFrequency it returns 0 as if everything went fine, SoapySDRDevice_getFrequency shows the requested frequency, but I see in the console e[1me[31m[ERROR] SetFrequencySXR(2450 MHz) - cannot deliver frequencye[0m

This time I was able to make the Lime usable again by uploading the gateware again. The problem is that it does not always work.