DepthAI v2 has been superseded by DepthAI v3. You are viewing legacy documentation.
DepthAI Tutorials
DepthAI API References

ON THIS PAGE

  • Demo
  • Setup
  • Source code

Bootloader Version

This example shows basic bootloader interaction, retrieving the version of bootloader running on the device.Click on Bootloader for more information.

Demo

Example script output
Command Line
1~/depthai-python/examples$ python3 bootloader_version.py
2    Found device with name: 1.1
3    Version: 0.0.26
4    USB Bootloader - supports only Flash memory
5    Memory 'Memory.FLASH' size: 33554432, info: JEDEC ID: 01 02 19

Setup

Please run the install script to download all required dependencies. Please note that this script must be ran from git context, so you have to download the depthai-python repository first and then run the script
Command Line
1git clone https://github.com/luxonis/depthai-python.git
2cd depthai-python/examples
3python3 install_requirements.py
For additional information, please follow the installation guide.

Source code

Python

Python
GitHub
1#!/usr/bin/env python3
2
3import depthai as dai
4
5(res, info) = dai.DeviceBootloader.getFirstAvailableDevice()
6
7if res == True:
8    print(f'Found device with name: {info.name}')
9    bl = dai.DeviceBootloader(info)
10    print(f'Version: {bl.getVersion()}')
11
12    supportedMemTypes = [dai.DeviceBootloader.Memory.FLASH, dai.DeviceBootloader.Memory.EMMC]
13    if bl.getType() == dai.DeviceBootloader.Type.USB:
14        print("USB Bootloader - supports only Flash memory")
15        supportedMemTypes = [dai.DeviceBootloader.Memory.FLASH];
16    else:
17        print(f"NETWORK Bootloader, is User Bootloader: {bl.isUserBootloader()}")
18
19    try:
20        for mem in supportedMemTypes:
21            memInfo = bl.getMemoryInfo(mem)
22            if memInfo.available:
23                print(f"Memory '{mem}' size: {memInfo.size}, info: {memInfo.info}")
24                appInfo = bl.readApplicationInfo(mem)
25                if appInfo.hasApplication:
26                    print(f"Application name: {appInfo.applicationName}, firmware version: {appInfo.firmwareVersion}")
27            else:
28                print(f"Memory '{mem.name}' not available...")
29    except Exception as ex:
30        print(f"Couldn't retrieve memory details: {ex}")
31else:
32    print('No devices found')

C++

1#include "depthai/depthai.hpp"
2
3int main(int argc, char** argv) {
4    bool res = false;
5    dai::DeviceInfo info;
6    std::tie(res, info) = dai::DeviceBootloader::getFirstAvailableDevice();
7
8    if(res) {
9        std::cout << "Found device with name: " << info.name << std::endl;
10        dai::DeviceBootloader bl(info);
11        std::cout << "Version: " << bl.getVersion().toString() << std::endl;
12
13        std::list<dai::DeviceBootloader::Memory> supportedMemTypes = {dai::DeviceBootloader::Memory::FLASH, dai::DeviceBootloader::Memory::EMMC};
14        if(bl.getType() == dai::DeviceBootloader::Type::USB) {
15            std::cout << "USB Bootloader - supports only Flash memory" << std::endl;
16            supportedMemTypes = {dai::DeviceBootloader::Memory::FLASH};
17        } else {
18            std::cout << "NETWORK Bootloader, is User Bootloader: " << bl.isUserBootloader() << std::endl;
19        }
20
21        try {
22            for(const auto& mem : supportedMemTypes) {
23                std::cout << std::endl;
24                auto memoryInfo = bl.getMemoryInfo(mem);
25                if(memoryInfo.available) {
26                    std::cout << "Memory '" << mem << "' size: " << memoryInfo.size << ", info: " << memoryInfo.info << std::endl;
27
28                    auto appInfo = bl.readApplicationInfo(mem);
29                    std::cout << "Application, flashed: " << appInfo.hasApplication << " firmware version: " << appInfo.firmwareVersion
30                              << " application name: " << appInfo.applicationName << std::endl;
31                } else {
32                    std::cout << "Memory '" << mem << "' not available..." << std::endl;
33                }
34            }
35        } catch(const std::exception& ex) {
36            std::cout << "Couldn't retrieve memory details: " << ex.what() << std::endl;
37        }
38    } else {
39        std::cout << "No devices found" << std::endl;
40    }
41
42    return 0;
43}

Need assistance?

Head over to Discussion Forum for technical support or any other questions you might have.