• RuntimeError: Device not in UNBOOTED, BOOTLOADER or FLASH_BOOTED state

When trying to flash the device, I'm getting:

python flash-oak.py
[2023-08-28 13:28:55] INFO [root.__exit__:408] Closing OAK camera
Traceback (most recent call last):
  File "/Users/alain/code/flash-oak.py", line 20, in <module>
    bootloader = dai.DeviceBootloader(bl)
RuntimeError: Device not in UNBOOTED, BOOTLOADER or FLASH_BOOTED state
Sentry is attempting to send 2 pending error messages
Waiting up to 2 seconds
Press Ctrl-C to quit

    Hi Craftonix
    Try waiting some time after restarting the device. Also re-running the same script after it fails usually works.
    Let me know if it works.

    Thanks,
    Jaka

    How much time is "some time" ?

    This camera is not a toy. It's a professional device costing USD$400.

    Where in the docs can I find the meaning of UNBOOTED, BOOTLOADER or FLASH_BOOTED state?

    How can I put the device in one of those states?

      Hi Craftonix
      I usually wait around 10 seconds to give device time to boot up.
      I would also strongly suggest using our device_manager.py app if you intend to flash bootloader to your POE device.
      UNBOOTED usually means the device doesn't have a bootloader (eg. usb devices) or the device is not booted. BOOTLOADER is state where device has successfully booted using bootloader. FLASH_BOOTED - when device has booted from flash.
      A device shouldn't be manually put in those states.

      Thanks,
      Jaka

      I restarted the device and I waited 60 seconds, and still getting the same error.

      I re-ran the same script after it failed, and still gettting the same error.

      I repeated the above steps several times, and still getting the same error.

      While in this state, running any other example works. Also running the Device Manager, I am able to communicate with the camera and read the version:

      The screenshot confirms that the Device state is FLASH_BOOTED.

      So, there must be some conflict or bug in the implementation of OakCamera() that is conflicting with bootloader.flash()

        Hi Craftonix
        Well, if you are using the SDK, the problem is likely that. Could you add the flash-oak.py file you are running. I believe that for SDK the code will need some modifications.

        Thanks,
        Jaka