Hi Maimilian , This is far from minimal reproducible code.
Standalone mode oak ffc 4p does not work
- Edited
erik oh sorry i missed it in my hurry 
Here's a new version:
from pathlib import Path
import cv2
import depthai as dai
import numpy as np
\# Get argument first
yolo_v5_path = str((Path(__file__).parent / Path('ai_v2/result/best_openvino_2022.1_6shave.blob')).resolve().absolute())
GPIO = dai.BoardConfig.GPIO
\# Define outputs for serial communication
uartNum = 0
uarts = {
0: { # Suitable for the custom TG board
'txPin' : 15,
'rxPin' : 16,
'txPinMode' : GPIO.ALT_MODE_2,
'rxPinMode' : GPIO.ALT_MODE_2,
}
}
\# Start defining a pipeline
pipeline = dai.Pipeline()
pipeline.setOpenVINOVersion(version=dai.OpenVINO.Version.VERSION_2022_1)
pyserial = """
import serial
ser = serial.Serial("/dev/ttyS0", baudrate=115200)
bboxes = []
while True:
in_nn = node.io['detections'].get()
if in_nn is not None:
bboxes = in_nn.detections
if bboxes is not None:
yellowValues = [-1,-1,-1,-1]
blueValues = [-1,-1,-1,-1]
ballValues = [-1,-1,-1,-1]
for bbox in bboxes:
# denormalize bounding box
x1 = int(bbox.xmin \* size)
x2 = int(bbox.xmax \* size)
y1 = int(bbox.ymin \* size)
y2 = int(bbox.ymax \* size)
if check:
coordinates = list()
coordinates.append(x1)
coordinates.append(x2)
coordinates.append(y1)
serString = 'str(ballValues[0])'
ser.write(serString.encode())
"""
\# Define script for output
script = pipeline.create(dai.node.Script)
script.setProcessor(dai.ProcessorType.LEON_CSS)
script.setScript(pyserial)
\# Create output
detectionNetwork.out.link(script.inputs["detections"])
config = dai.Device.Config()
config.board.gpio[uarts[uartNum]['txPin']] = GPIO(GPIO.OUTPUT, uarts[uartNum]['txPinMode'])
config.board.gpio[uarts[uartNum]['rxPin']] = GPIO(GPIO.INPUT, uarts[uartNum]['rxPinMode'])
config.board.uart[uartNum] = dai.BoardConfig.UART()
config.version = config.version.VERSION_2021_4
\# Flash the pipeline
(f, bl) = dai.DeviceBootloader.getFirstAvailableDevice()
bootloader = dai.DeviceBootloader(bl)
progress = lambda p: print(f'Flashing progress: {p \* 100:.1f}%')
bootloader.flash(progress, pipeline)
DetectionNetwork is my network with the blobpath.- Edited
erik Maybe there's also a problem with the current and latest bootloader version. I think so because when I flashed with the version 0.0.18 instead of the latest version 0.0.24 it flashed normally (about 2 minutes with a progress). However, even there standalone mode has not worked yet. Nevertheless, is there a way to downgrade bootloader version?
Furthermore I read about the parameter compress in bootloader.flash(). Should this be true?
- Best Answerset by erik
Maimilian very likely you have only 16MB of memory, and if you don't compress the firmware (bootlaoder.flash(progress, pipeline, compress=True)) it will fail. Try the following:
(ok, err) = bootloader.flash(progress, pipeline)
print(f"Flashing success: {ok}, error: {err}")
And then change to:
(ok, err) = bootloader.flash(progress, pipeline, compress=True)Also note that with 16MB memory, I don't think you'll be able to flash any kind of neural network to the device. The depthai itself takes like 10MB-15MB (when compressed), so you will have a small margin. It might also be that only the USB Bootlaoder doesn't find eMMC flash (usually present on SOMs). I opened Feature Request here.
Maimilian For that, I believe it would be best to open feature request on depthai-core, that even USB bootloader can access eMMC memory (currently, only NETWORK bootlaoder can). I also don't think flashing BoardConfig (needed for UART) is available, perhaps creating separate feature request for that would be useful as well.
Maimilian It's always suggested to write concise and thought-over messages 
- It depends on the opportunity. If you could share the volume opportunity here (or email support@luxonis.com) we can expedite this. Commitment (to buy) may be required. If this is a bachelors thesis then I don't see this being implemented even in 1 year, but if there are 1000s pcs/year opportunity then we would fix this over the weekend. I hope you understand.
- depthai-core github repository.
- No, I don't think so.
- No, standalone mode is the only way.