Bootloader

Depthai bootloader is a small program which aids in booting and updating bootloader or depthai application packages.

To be able to run hostless, the Depthai bootloader must be first flashed to the devices flash. This step is required only once.

Plug USB to the board Flash bootloader using DeviceBootloader::flashBootloader (Check Example at the bottom) Disconnect the board and switch the boot mode GPIO to the following settings: BOOT[4:0] : 01000 (see attached images for reference) Reassemble the board

Once the device has the bootloader flashed, it will perform the same as before. Running pipelines with a host connected doesn’t require any changes.

Suggested workflow is to perform as much of development as possible with the host connected as the iteration cycle is greatly improved.

Once desired pipeline is created, use the following function to flash: DeviceBootloader::flash

API

DeviceBootloader is a class to communicate with the bootloader. It is used to flash created Pipeline, depthai application package or update the bootloader itself.

progressCb parameter takes a callback function, which will be called each time an progress update occurs (rate limited to 1 second). This is mainly used to inform the user of the current flashing progress.

You can also check the version of the current bootloader by using the Bootloader Version example.

DepthAI Application Package (.dap)

Depthai application package is a binary file format which stores sections of data. The purpose of this format is to be able to extract individual sections and do OTA updates without requiring to update all data. Example: Between update 1 and 2 of users application, Depthai firmware, Asset storage (50MiB neural network) and asset structure remained the same, but some additional processing nodes were added to the pipeline. Instead of transferring the whole package only Pipeline description can be sent and updated.

Depthai application package (.dap) consists of:

  • SBR (512B header which describes sections of data)

  • Depthai device firmware (section “__firmware”)

  • Pipeline description (section “pipeline”)

  • Assets structure (section “assets”)

  • Asset storage (section “asset_storage”)

Example

Following section will show an example of: Flashing bootloader (needed only once) and flashing a created Pipeline “myExamplePipeline” to the device (The example is written in Python, similar steps apply to C++)

  1. Flashing bootloader

    import depthai as dai
    (f, bl) = dai.DeviceBootloader.getFirstAvailableDevice()
    bootloader = dai.DeviceBootloader(bl)
    progress = lambda p : print(f'Flashing progress: {p*100:.1f}%')
    bootloader.flashBootloader(progress)
    

    Note

    Make sure to switch GPIO BOOT mode settings (See image below for more details)

  2. Flashing created pipeline

    import depthai as dai
    # ...
    # Create Pipeline 'myExamplePipeline'
    # ...
    (f, bl) = dai.DeviceBootloader.getFirstAvailableDevice()
    bootloader = dai.DeviceBootloader(bl)
    progress = lambda p : print(f'Flashing progress: {p*100:.1f}%')
    bootloader.flash(progress, myExamplePipeline)
    

GPIO boot settings. Boot settings must be set as following: BOOT[4:0] : 01000 and GPIO58 (WAKEUP): 0

boot-depthai

Got questions?

We’re always happy to help with code or other questions you might have.