0

I'm trying to setup my Rasperry Pi 0 to use two SPI ports simultaneously I need such configuration since I need:

  1. to connect this board trough ETHERNET to a local LAN;
  2. to collect video stream from a camera (FLIR Lepton 3).

The first point is successfully achieved using an ENC28J60 IC (it works fine). The second point is a little more challenging because of several issues I run into, the first one seems to be related to SPI managing/setup but I'm not a deep expert of such protocol/standard and thus I'm looking for infos. The camera is connected to /dev/spidev1.1:

My config.txt is set as follows:

dtparam=i2c_arm=on
dtparam=spi=on
dtoverlay=enc28j60
dtoverlay=spi1-2cs
dtparam=audio=on
start_x=1
gpu_mem=128

I can shut off audio and maybe reduce the amount of GPU memory (the system will run on terminal only), but AFAIK it should be correct.

The core of my solution is a program written in C that should get data from the camera mentioned above trough SPI bus. Unluckly when the following code is executed:

spi_fd = open(device, O_RDWR);
{
    perror("can't open device");

    piUnlock(SPI_MUTEX);
    return  0;
}

_result = ioctl(spi_fd, SPI_IOC_WR_MODE, &mode);
if (_result == -1)
{
    perror("can't set spi mode");

    piUnlock(SPI_MUTEX);
    return 0;
}

The first ioctl call fails (return -1). What can it depend on?

To clearify where the problem is I can replace the camera with a micro programmed by myself and verify on the other side of SPI bus what's going on but first of all I need to know if the setup has a chance to work or not.

I did the same setup on a Rasperry Pi 3 A+ with the same result.

I did some experiment connecting the camera on /dev/spidev0.1 and in such case ioctl() call works unluckly I need to use ENC28J60 to connect to LAN and I don't know a setup to use it trough a different SPI bus.

  • The camera output a video in 160x120@9Hz trough SPI (VO-SPI protocol). – weirdgyn Oct 11 '19 at 9:07
  • Perhaps errno indicates the error? – joan Oct 11 '19 at 9:51
  • good question. I'll check it. – weirdgyn Oct 11 '19 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.