Skip to content

ESP32 reference app for interfacing with DepthAI over SPI

License

Notifications You must be signed in to change notification settings

paulwingert865/esp32-spi-message-demo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NOTE!

OAK IoT series and this repository is community supported only, and is provided as-is. We most likely won't update it and we don't provide support for it (Discord, forums, email...).

Demo

See below for this running on the BW1092:

SPI ESP32 Interface with DepthAI

And see https://github.com/luxonis/depthai-experiments/tree/master/gen2-spi for pulling off JPEG and/or depth (including cropping on DepthAI) instead of the MobileNetv2-SSD or tinyYOLOv3 metadata shown below.

Building

The first time you build, the repository submodules need be initialized:

git submodule update --init --recursive

# Tip: You can ask Git to do that automatically:
git config submodule.recurse true

Later submodules also need to be updated. To build an example, you will need to use ESP-IDF's idf.py. Examples here were only tested with ESP-IDF version 4.1 and we encourage you to use the same version as well.

SPI Protocol

SPI messaging is currently arranged in 2 layers. The first is the spi protocol. The spi protocol is the lowest level. It defines a standard packet for all SPI communication. It is a 256 byte packet arranged in the following manner:

typedef struct {
    uint8_t start;
    uint8_t data[SPI_PROTOCOL_PAYLOAD_SIZE];
    uint8_t crc[2];
    uint8_t end;
} SpiProtocolPacket;

start and end are constant bytes to mark the beginning and end of packets.

static const uint8_t START_BYTE_MAGIC = 0b10101010;
static const uint8_t END_BYTE_MAGIC = 0b00000000;

SPI Messaging

On top of this we have a layer called SPI messaging. This code defines the following:

  • A list of a supported commands,
  • A way to encapsulate commands going to the MyriadX over SPI.
  • A way to receive and parse command responses.
  • We’ll go into greater depth as to how exactly to use this in the SPI Messaging Example.

The SPI Messaging Examples

We have a few SPI messaging examples in the depthai-experiments repository. Please see the following: https://github.com/luxonis/depthai-experiments/tree/master/gen2-spi

About

ESP32 reference app for interfacing with DepthAI over SPI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 60.2%
  • Python 19.0%
  • CMake 10.0%
  • C 5.3%
  • HTML 4.1%
  • Makefile 0.7%
  • Shell 0.7%