• DepthAI-v2
  • Oak-D CM4 Couldn't read data from stream: '__timesync' (X_LINK_ERROR)

I have a Luxonis Oak-D Camera that I'm trying to get working on Raspberry Pi CM4 mounted to a custom carrier board. I've verified the camera and cable are good by installing and successfully running DepthAI demos on my M1 Macbook Pro. I have a coworker who has gotten an OakD working on his Raspberry Pi4B.

```
$ python --version
Python 3.9.18

$ uname -a
Linux eck-us-qa02-pi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux

$ getconf LONG_BIT
64

$ dpkg --print-architecture
arm64

$ pip debug --verbose
pip version: pip 24.0 from /home/eyecheq/.asdf/installs/python/3.9.18/lib/python3.9/site-packages/pip (python 3.9)
sys.version: 3.9.18 (main, Feb 7 2024, 22:51:11)
[GCC 10.2.1 20210110]
sys.executable: /home/eyecheq/.asdf/installs/python/3.9.18/bin/python3
sys.getdefaultencoding: utf-8
sys.getfilesystemencoding: utf-8
locale.getpreferredencoding: UTF-8
sys.platform: linux
sys.implementation:
name: cpython
'cert' config value: global
REQUESTS_CA_BUNDLE: None
CURL_CA_BUNDLE: None
pip.vendor.certifi.where(): /home/eyecheq/.asdf/installs/python/3.9.18/lib/python3.9/site-packages/pip/vendor/certifi/cacert.pem
pip._vendor.DEBUNDLED: False
vendored library versions:
CacheControl==0.13.1
colorama==0.4.6
distlib==0.3.8
distro==1.8.0
msgpack==1.0.5
packaging==21.3
platformdirs==3.8.1
pyparsing==3.1.0
pyproject-hooks==1.0.0
requests==2.31.0
certifi==2023.07.22
chardet==5.1.0
idna==3.4
urllib3==1.26.17
rich==13.4.2 (Unable to locate actual module version, using vendor.txt specified version)
pygments==2.15.1
typing_extensions==4.7.1 (Unable to locate actual module version, using vendor.txt specified version)
resolvelib==1.0.1
setuptools==68.0.0 (Unable to locate actual module version, using vendor.txt specified version)
six==1.16.0
tenacity==8.2.2 (Unable to locate actual module version, using vendor.txt specified version)
tomli==2.0.1
truststore==0.8.0 (Unable to locate actual module version, using vendor.txt specified version)
webencodings==0.5.1 (Unable to locate actual module version, using vendor.txt specified version)
```

I followed the hello_world.py instructions here…
https://docs.luxonis.com/projects/api/en/latest/tutorials/hello_world/

$ python3 hello_world.py

[2024-02-07 23:25:50.676] [debug] Python bindings - version: 2.21.2.0 from  build: 2023-04-06 00:15:31 +0000
[2024-02-07 23:25:50.676] [debug] Library information - version: 2.21.2, commit:  from , build: 2023-04-05 23:12:49 +0000
[2024-02-07 23:25:50.683] [debug] Initialize - finished
[2024-02-07 23:25:50.909] [debug] Resources - Archive 'depthai-bootloader-fwp-0.0.24.tar.xz' open: 5ms, archive read: 227ms
[2024-02-07 23:25:51.132] [debug] Device - OpenVINO version: 2022.1
[2024-02-07 23:25:51.132] [debug] Device - BoardConfig: {"camera":[],"emmc":null,"gpio":[],"imu":null,"logDevicePrints":null,"logPath":null,"logSizeMax":null,"logVerbosity":null,"network":{"mtu":0,"xlinkTcpNoDelay":true},"nonExclusiveMode":false,"pcieInternalClock":null,"sysctl":[],"uart":[],"usb":{"flashBootedPid":63037,"flashBootedVid":999,"maxSpeed":4,"pid":63035,"vid":999},"usb3PhyInternalClock":null,"watchdogInitialDelayMs":null,"watchdogTimeoutMs":null}
libnop:
0000: b9 11 b9 05 81 e7 03 81 3b f6 81 e7 03 81 3d f6 04 b9 02 00 01 ba 00 be be bb 00 bb 00 be be be
0020: be be be be 00 bb 00 be
[2024-02-07 23:25:51.825] [debug] Resources - Archive 'depthai-device-fwp-3575b77f20e796b4e79953bf3d2ba22f0416ee8b.tar.xz' open: 5ms, archive read: 1143ms
[2024-02-07 23:25:52.637] [debug] Searching for booted device: DeviceInfo(name=1.4, mxid=19443010B184E01200, X_LINK_BOOTED, X_LINK_USB_VSC, X_LINK_MYRIAD_X, X_LINK_SUCCESS), name used as hint only
[19443010B184E01200] [1.4] [0.854] [system] [info] Memory Usage - DDR: 0.12 / 340.34 MiB, CMX: 2.04 / 2.50 MiB, LeonOS Heap: 7.51 / 77.23 MiB, LeonRT Heap: 2.89 / 41.14 MiB
[19443010B184E01200] [1.4] [0.854] [system] [info] Temperatures - Average: 30.74C, CSS: 32.25C, MSS 30.32C, UPA: 30.32C, DSS: 30.08C
[19443010B184E01200] [1.4] [0.854] [system] [info] Cpu Usage - LeonOS 47.59%, LeonRT: 1.78%
[2024-02-07 23:25:53.537] [debug] Schema dump: {"connections":[{"node1Id":1,"node1Output":"out","node1OutputGroup":"","node2Id":3,"node2Input":"in","node2InputGroup":""},{"node1Id":0,"node1Output":"preview","node1OutputGroup":"","node2Id":2,"node2Input":"in","node2InputGroup":""},{"node1Id":0,"node1Output":"preview","node1OutputGroup":"","node2Id":1,"node2Input":"in","node2InputGroup":""}],"globalProperties":{"calibData":null,"cameraTuningBlobSize":null,"cameraTuningBlobUri":"","leonCssFrequencyHz":700000000.0,"leonMssFrequencyHz":700000000.0,"pipelineName":null,"pipelineVersion":null,"sippBufferSize":18432,"sippDmaBufferSize":16384,"xlinkChunkSize":-1},"nodes":[[0,{"id":0,"ioInfo":[[["","video"],{"blocking":false,"group":"","id":13,"name":"video","queueSize":8,"type":0,"waitForMessage":false}],[["","still"],{"blocking":false,"group":"","id":11,"name":"still","queueSize":8,"type":0,"waitForMessage":false}],[["","isp"],{"blocking":false,"group":"","id":10,"name":"isp","queueSize":8,"type":0,"waitForMessage":false}],[["","preview"],{"blocking":false,"group":"","id":12,"name":"preview","queueSize":8,"type":0,"waitForMessage":false}],[["","raw"],{"blocking":false,"group":"","id":9,"name":"raw","queueSize":8,"type":0,"waitForMessage":false}],[["","frameEvent"],{"blocking":false,"group":"","id":8,"name":"frameEvent","queueSize":8,"type":0,"waitForMessage":false}],[["","inputConfig"],{"blocking":false,"group":"","id":7,"name":"inputConfig","queueSize":8,"type":3,"waitForMessage":false}],[["","inputControl"],{"blocking":true,"group":"","id":6,"name":"inputControl","queueSize":8,"type":3,"waitForMessage":false}]],"name":"ColorCamera","properties":[185,25,185,27,0,3,0,0,0,185,3,0,0,0,185,5,0,0,0,0,0,185,5,0,0,0,0,0,0,0,0,0,0,0,0,185,3,0,0,0,185,3,0,0,0,0,0,0,0,0,0,0,0,0,0,255,189,0,255,0,0,0,129,44,1,129,44,1,255,255,255,255,0,136,0,0,240,65,0,136,0,0,128,191,136,0,0,128,191,1,185,4,0,0,0,0,3,3,4,4,4]}],[1,{"id":1,"ioInfo":[[["","out"],{"blocking":false,"group":"","id":5,"name":"out","queueSize":8,"type":0,"waitForMessage":false}],[["","passthrough"],{"blocking":false,"group":"","id":4,"name":"passthrough","queueSize":8,"type":0,"waitForMessage":false}],[["","in"],{"blocking":true,"group":"","id":3,"name":"in","queueSize":5,"type":3,"waitForMessage":true}]],"name":"DetectionNetwork","properties":[185,6,130,75,197,220,0,189,12,97,115,115,101,116,58,95,95,98,108,111,98,8,0,0,185,7,1,136,0,0,0,63,0,0,186,0,187,0,136,0,0,0,0]}],[2,{"id":2,"ioInfo":[[["","in"],{"blocking":true,"group":"","id":2,"name":"in","queueSize":8,"type":3,"waitForMessage":true}]],"name":"XLinkOut","properties":[185,3,136,0,0,128,191,189,3,114,103,98,0]}],[3,{"id":3,"ioInfo":[[["","in"],{"blocking":true,"group":"","id":1,"name":"in","queueSize":8,"type":3,"waitForMessage":true}]],"name":"XLinkOut","properties":[185,3,136,0,0,128,191,189,2,110,110,0]}]]}
[2024-02-07 23:25:53.537] [debug] Asset map dump: {"map":{"/node/1/__blob":{"alignment":64,"offset":0,"size":14468427}}}
[19443010B184E01200] [1.4] [1.044] [system] [info] SIPP (Signal Image Processing Pipeline) internal buffer size '18432'B, DMA buffer size: '16384'B
[2024-02-07 23:25:53.775] [debug] DataOutputQueue (nn) closed
[2024-02-07 23:25:53.775] [debug] DataOutputQueue (rgb) closed
[2024-02-07 23:25:53.775] [debug] Timesync thread exception caught: Couldn't read data from stream: '__timesync' (X_LINK_ERROR)
[2024-02-07 23:25:53.775] [debug] RPC error: Couldn't read data from stream: '__rpc_main' (X_LINK_ERROR)
[2024-02-07 23:25:53.775] [debug] Log thread exception caught: Couldn't read data from stream: '__log' (X_LINK_ERROR)
[2024-02-07 23:25:53.775] [debug] Device about to be closed...
[2024-02-07 23:25:53.775] [debug] XLinkResetRemoteTimeout returned: X_LINK_ERROR
[2024-02-07 23:25:54.209] [debug] XLinkResetRemote of linkId: (0)
[2024-02-07 23:25:54.997] [debug] Device closed, 1221
Traceback (most recent call last):
  File "/home/eyecheq/depthai-tutorials-practice/1-hello-world/hello_world.py", line 41, in <module>
    with depthai.Device(pipeline) as device:
RuntimeError: Device already closed or disconnected: Input/output error

When the script runs, I can hear the OakD click and then a short moment later, it clicks again and the Timesync thread exception is caught.

jakaskerl Yes, I ran…

sudo curl -fL https://docs.luxonis.com/install_dependencies.sh | bash

Which is what was listed under the Pi OS install section.

I'll try running your scripts and rebuilding both Python and all dependencies.

I did the following:

Removed Python 3.9.18…
asdf uninstall python 3.9.18

Removed virtual environment…
rm -rf .venv/

Ran the dependency installer script you provided…
sudo wget -qO- https://raw.githubusercontent.com/luxonis/depthai-python/jakaskerl-patch-1/docs/source/_static/install_dependencies.sh | bash

Using pre-22.04 package list

For ARM architecture

Reading package lists... Done

Building dependency tree... Done

Reading state information... Done

libatlas-base-dev is already the newest version (3.10.3-10).

build-essential is already the newest version (12.9).

git is already the newest version (1:2.30.2-1+deb11u2).

libgstreamer1.0-dev is already the newest version (1.18.4-2.1).

libhdf5-dev is already the newest version (1.10.6+repack-4+deb11u1).

libilmbase-dev is already the newest version (2.5.4-1).

libjpeg-dev is already the newest version (1:2.0.6-4).

libpng-dev is already the newest version (1.6.37-3).

libsm6 is already the newest version (2:1.2.3-1).

libxext6 is already the newest version (2:1.3.3-1.1).

python3-numpy is already the newest version (1:1.19.5-1).

libopenexr-dev is already the newest version (2.5.4-2+deb11u1).

pkg-config is already the newest version (0.29.2-1).

python3-pyqt5 is already the newest version (5.15.2+dfsg-3).

python3-pyqt5.qtquick is already the newest version (5.15.2+dfsg-3).

python3 is already the newest version (3.9.2-3).

python3-dev is already the newest version (3.9.2-3).

qt5-qmake is already the newest version (5.15.2+dfsg-9).

qtbase5-dev is already the newest version (5.15.2+dfsg-9).

qtbase5-dev-tools is already the newest version (5.15.2+dfsg-9).

qtchooser is already the newest version (66-2).

qml-module-qtquick-layouts is already the newest version (5.15.2+dfsg-6).

qml-module-qtquick-window2 is already the newest version (5.15.2+dfsg-6).

qml-module-qtquick2 is already the newest version (5.15.2+dfsg-6).

qtdeclarative5-dev is already the newest version (5.15.2+dfsg-6).

qml-module-qt-labs-platform is already the newest version (5.15.2+dfsg-2).

qml-module-qtquick-controls2 is already the newest version (5.15.2+dfsg-2).

udev is already the newest version (247.3-7+deb11u4).

libtiff-dev is already the newest version (4.2.0-1+deb11u5).

cmake is already the newest version (3.18.4-2+rpt1+rpi1+deb11u1).

ffmpeg is already the newest version (8:4.3.6-0+deb11u1+rpt5).

libavcodec-dev is already the newest version (8:4.3.6-0+deb11u1+rpt5).

libavformat-dev is already the newest version (8:4.3.6-0+deb11u1+rpt5).

libgl1-mesa-glx is already the newest version (20.3.5-1+rpt5+rpi1).

libgtk2.0-dev is already the newest version (2.24.33-2+rpt1).

libswscale-dev is already the newest version (8:4.3.6-0+deb11u1+rpt5).

python3-pip is already the newest version (20.3.4-4+rpt1+deb11u1).

Suggested packages:

libtbb-doc

The following NEW packages will be installed:

libtbb-dev libtbb2

0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.

Need to get 0 B/444 kB of archives.

After this operation, 2,403 kB of additional disk space will be used.

Selecting previously unselected package libtbb2:arm64.

(Reading database ... 99682 files and directories currently installed.)

Preparing to unpack .../libtbb2_2020.3-1_arm64.deb ...

Unpacking libtbb2:arm64 (2020.3-1) ...

Selecting previously unselected package libtbb-dev:arm64.

Preparing to unpack .../libtbb-dev_2020.3-1_arm64.deb ...

Unpacking libtbb-dev:arm64 (2020.3-1) ...

Setting up libtbb2:arm64 (2020.3-1) ...

Setting up libtbb-dev:arm64 (2020.3-1) ...

Processing triggers for libc-bin (2.31-13+rpt2+rpi1+deb11u7) ...

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple

Requirement already satisfied: pip in ./.asdf/installs/python/3.9.18/lib/python3.9/site-packages (24.0)

Installing udev rules...

Finished installing global libraries.

Then I tried installing the project's dependencies
poetry install

Creating virtualenv ec-oakd-service in /home/eyecheq/ec-oakd-service/.venv

Updating dependencies

Resolving dependencies... (2.3s)

Failed to clone luxonis/depthai_pipeline_graph.git at '848a147', verify ref exists on remote.

Not sure I understand the error as the hash exists…
luxonis/depthai_pipeline_graph848a147

poetry --version
Poetry (version 1.7.1)

When I try to run install again, I get a different error…
poetry install

Updating dependencies

Resolving dependencies... (28.6s)

Unable to determine package info for path: /home/eyecheq/ec-oakd-service/.venv/src/depthai_pipeline_graph

Command ['/tmp/tmplzdidmc/.venv/bin/python', '-I', '-W', 'ignore', '-c', "import build\nimport build.env\nimport pyproject_hooks\n\nsource = '/home/eyecheq/ec-oakd-service/.venv/src/depthai_pipeline_graph'\ndest = '/tmp/tmplzdidmc/dist'\n\nwith build.env.DefaultIsolatedEnv() as env:\n builder = build.ProjectBuilder(\n source_dir=source,\n python_executable=env.python_executable,\n runner=pyproject_hooks.quiet_subprocess_runner,\n )\n env.install(builder.build_system_requires)\n env.install(builder.get_requires_for_build('wheel'))\n builder.metadata_path(dest)\n"] errored with the following return code 1

Error output:

Traceback (most recent call last):

File "<string>", line 9, in <module>

File "/tmp/tmplzdidmc_/.venv/lib/python3.9/site-packages/build/init.py", line 174, in init

_validate_source_directory(source_dir)

File "/tmp/tmplzdidmc_/.venv/lib/python3.9/site-packages/build/init.py", line 77, in _validate_source_directory

raise BuildException(msg)

build._exceptions.BuildException: Source /home/eyecheq/ec-oakd-service/.venv/src/depthai_pipeline_graph does not appear to be a Python project: no pyproject.toml or setup.py

No fallback setup.py file was found to generate egg_info.

Hi @JordanDuggan
Have you tried installing requirements without poetry? Seems like there might be a poetry specific issue. What is the reason behind using it?

Thanks,
Jaka

8 days later

I may have figured out the issue with my OakD. The power supply that came with my particular OakD is a WP0503000D switching power supply that is supposed to convert 100-240v ~50/60 Hz to 5V 3A output.

When I first plug it in, I get out 5.26V steady, but if the connection to the probes are disturbed and reconnected, the voltage starts to decay at a fairly steady rate and drops well below 5V. Here is a video.

https://www.screencast.com/t/TWyllVZaCCJ

In some earlier testing, I saw some over-current errors in the dmesg logs, related to the USB port. Could those have been caused by the OakD trying to switch over and pull power from the USB cable when the power block dropped too low?

When I connect the same OakD with the same power supply and USB cable to my MacBook, I am able to start the camera and run my program on it without errors. Could that be because my MacBook is able to maintain power to the OakD over the USB cable, where as my custom PCB can't?

What power supply is being shipped with OakD cameras today?

Hi @JordanDuggan
It's entirely possible it's a power related issue.
The power supply should be more than capable or running the device on it's own, but it could be faulty I guess, in which case the device would pull from USB. If the PCB is unable to maintain the power required for oak to run, the oak would brown out.
Do you have any other 5v power supply to test?

Thanks
Jaka

Well, the good news is that swapping out the power supply that came with the OakD with one ordered from Amazon fixed the issue. I am now able to start and run the OakD on our custom carrier board without issue.

The bad news is that I've purchased 5 OakD's and the power supply is bad on two of them. Not a stellar success rate. You should have your hardware team dig in and figure out if they got a bad lot of them or there is a broader manufacturing control issue with them.

Thanks for your help!

Hi @JordanDuggan

The PSU on the video is the older model, but due to the reason that UFL does not rotate stock properly (FIFO) there still might be some older SKUs of the CM4 and OAK-D with older model PSUs going to the customers.
Strange is that WillElectonics never reported issues with PSU, but I give it a chance that they just silently changed the model due to the issues they might have foreseen.

Any chance you can send us the PSU back so we can test it in the office?

Thanks,
Jaka

    jakaskerl Yes, I can mail them to you. Can you DM or private message me with the address I should send them to, and the name of the person I should specify as the receiver?