Hello,
We recently bought a AK-FFC 4P module. We want to be able to run uart script in standalone mode.
We ran the uart scirpt (from the example folder) in "normal" mode with a computer and scoped the uart GPIO with an oscilloscope, and we were able to validate that it works.
So then we tried to use this script in standalone mode. To do that, we used this page. We flashed the bootloader. And tried to modify the uart script to match the expected structure for the standalone mode.
So we modified the script from :
#!/usr/bin/env python3
'''
NOTE: This should only be run on OAK-FFC-4P, as other OAK cameras might have different GPIO configuration!
'''
import depthai as dai
import time
# Start defining a pipeline
pipeline = dai.Pipeline()
script = pipeline.create(dai.node.Script)
script.setScript("""
import serial
import time
ser = serial.Serial("/dev/ttyS0", baudrate=115200)
i = 0
while True:
i += 1
time.sleep(0.1)
serString = f'TEST_{i}'
ser.write(serString.encode())
""")
# Define script for output
script.setProcessor(dai.ProcessorType.LEON_CSS)
config = dai.Device.Config()
# Get argument first
GPIO = dai.BoardConfig.GPIO
config.board.gpio[15] = GPIO(GPIO.OUTPUT, GPIO.ALT_MODE_2)
config.board.gpio[16] = GPIO(GPIO.INPUT, GPIO.ALT_MODE_2)
config.board.uart[0] = dai.BoardConfig.UART()
with dai.Device(config) as device:
device.startPipeline(pipeline)
print("Pipeline started")
while True:
time.sleep(1)
to this :
#!/usr/bin/env python3
'''
NOTE: This should only be run on OAK-FFC-4P, as other OAK cameras might have different GPIO configuration!
'''
import depthai as dai
import time
# Start defining a pipeline
pipeline = dai.Pipeline()
script = pipeline.create(dai.node.Script)
script.setScript("""
import serial
import time
ser = serial.Serial("/dev/ttyS0", baudrate=115200)
i = 0
while True:
i += 1
time.sleep(0.1)
serString = f'TEST_{i}'
ser.write(serString.encode())
""")
# Define script for output
script.setProcessor(dai.ProcessorType.LEON_CSS)
config = dai.Device.Config()
# Get argument first
GPIO = dai.BoardConfig.GPIO
config.board.gpio[15] = GPIO(GPIO.OUTPUT, GPIO.ALT_MODE_2)
config.board.gpio[16] = GPIO(GPIO.INPUT, GPIO.ALT_MODE_2)
config.board.uart[0] = dai.BoardConfig.UART()
# 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)
We ran it, wait until the flash complete, rebooted the board. But we were not able to see uart data on the oscilloscope.
1. Do you think we modified the code correctly to run in standalone mode, or did we make a mistake ?
2. How to be sure that the pipeline is well flashed in the memory and is running on boot since we can not have logs ? Do you have a basic example which for example blinks a led or something like that which would allow us to properly verify that a pipeline is indeed operating?
Thank you very much.