SPIOut blocking the pipeline
Problem Hi, as the title suggests, the problem regards the SPIOut node. If I add this node the pipeline blocks otherwise the pipeline works fluently by removing the SPIOut node. Precisely, if SPIOut is present then the keypoints drawed seem to be blocked and there is no any message written in the serial channel.
Pipeline structure The pipeline is formed by these nodes:
MonoCamera → ImageManip → NeuralNetwork → SPIOut
ImageManip → XLinkOut
NeuralNetwork → XLinkOut
The two XLinkOut nodes are used for testing purpose on the host.
Code of the pipeline
def create_pipeline(model_config, camera, sync=False):
model_config["shaves"] = 6
pipeline = dai.Pipeline()
cam_left = pipeline.create(dai.node.MonoCamera)
cam_left.setBoardSocket(dai.CameraBoardSocket.LEFT)
cam_left.setResolution(dai.MonoCameraProperties.SensorResolution.THE_400_P)
cam_left.setFps(30)
imageManip = pipeline.create(dai.node.ImageManip)
imageManip.setResize(*model_config["input_size"])
imageManip.initialConfig.setFrameType(dai.ImgFrame.Type.BGR888p)
cam_left.out.link(imageManip.inputImage)
# Create pose estimation network
pose_nn = pipeline.createNeuralNetwork()
model_blob = (model_config["blob"] + "_sh" + str(model_config["shaves"]) + ".blob")
path = os.path.join(MODELS_FOLDER, model_blob)
if not os.path.exists(path):
raise ValueError("Blob file '{}' does not exist.".format(path))
print("Blob file:", path)
pose_nn.setBlobPath(path)
pose_nn.input.setQueueSize(1)
pose_nn.input.setBlocking(False)
imageManip.out.link(pose_nn.input)
xout = pipeline.create(dai.node.XLinkOut)
xout.setStreamName("pose")
pose_nn.out.link(xout.input)
spiout = pipeline.createSPIOut()
spiout.setStreamName("cose123")
spiout.setBusId(0)
pose_nn.out.link(spiout.input)
xoutManip = pipeline.create(dai.node.XLinkOut)
xoutManip.setStreamName("preview")
imageManip.out.link(xoutManip.input)
return pipeline
Example of the problem

It looks to me like for some reason (I don't know why), the SPIOut node fails to send messages to the ESP32 after a few seconds. When this happens, the SPIOut node gets backed up with messages, which then starts backing up the neural network.
I'm also experiencing a (different) issue with with SPIOut node (#20). However, if you add the line spiout.input.setBlocking(False), the neural network won't get backed up when the SPIOut node does. I know this doesn't fix the issue with the SPIOut node, but it will at least prevent the rest of the pipeline from freezing up.
Hopefully this can help until some Luxonis folks have some availability to work on the SPIOut node.
Hi @vipulkumar-developer
Can you try reducing the SPI clock in esp32_spi_impl.c
//Configuration for the SPI device on the other side of the bus
spi_device_interface_config_t devcfg={
.command_bits=0,
.address_bits=0,
.dummy_bits=0,
.clock_speed_hz=4000000, // Reduced to 4MHz
...
Due to some driver issues on MX side, we are seeing some issues like the one you've experienced.
We'll hopefully be able to check this out more, to resolve such issues