question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error on using ONLY SPI1 (Can not set SPI mode to Mode3)

See original GitHub issue

Since I have a broken pin on SPI0, I have to use SPI1 on my Raspberry Pi 3B+ In config.txt i have set

# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on
dtoverlay=spi1-1cs,cs0_pin=12

pi@raspberrypi:~ $ ls -l /dev/spidev* crw-rw---- 1 root spi 153, 0 Okt 1 11:36 /dev/spidev1.0 pi@raspberrypi:~ $

If i use this code:

            var settings = new SpiConnectionSettings(1, 0)
            {
                ChipSelectLineActiveState = PinValue.Low,
                ClockFrequency = 2000000,
                DataBitLength = 8,
                DataFlow = DataFlow.MsbFirst,
                Mode = SpiMode.Mode3
            };
            using var spiDevice = SpiDevice.Create(settings);
            spiDevice.WriteByte((byte)(address | 0x80));

i get: Unhandled exception. System.IO.IOException: Error 22. Can not set SPI mode to Mode3. at System.Device.Spi.UnixSpiDevice.Initialize() at System.Device.Spi.UnixSpiDevice.WriteByte(Byte value)

Add following information:

pi@raspberrypi:~ $ dotnet --info
.NET Core SDK (gemäß "global.json"):
 Version:   3.1.402
 Commit:    9b5de826fd

Laufzeitumgebung:
 OS Name:     raspbian
 OS Version:  10
 OS Platform: Linux
 RID:         linux-arm
 Base Path:   /opt/dotnet/sdk/3.1.402/

Host (useful for support):
  Version: 3.1.8
  Commit:  9c1330dedd

.NET Core SDKs installed:
  3.1.402 [/opt/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.1.8 [/opt/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.8 [/opt/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download
  • Version of System.Device.Gpio package is 1.0.0
  • Version of Iot.Device.Bindings package is 1.0.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
krwqcommented, Oct 1, 2020

@wolfgangmauer, we only support Uln2003 for stepper motors for now. If you get that to work I’d recommend you to create a PR so someone can re-use your works 😄

0reactions
Ellerbachcommented, Jul 1, 2021

[Triage] As this seems to be Raspberry Pi related and based on the discussion, we will close this issue. Do not hesitate to reopen if needed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't set modes 1 and 3 in Auxillary SPI(1)
I can send and receive data but only SPI_MODE_2 and SPI_MODE_0. Setting to mode 3 produces a file error within spidev. The modes...
Read more >
Auxillary SPI(1) Mode 3 not set - Raspberry Pi Forums
The auxiliary SPI dose not appear to accept mode 3. I've enabled spi1-1cs, /dev/spidev1.0 created fine and I can send and receive data...
Read more >
Enabling SPI1 on the Raspberry Pi B+/Zero/2/3
I'm running into issues with SPI modes. SPI1 only supports mode 0 and mode 2, but not mode 1 and 3. All the...
Read more >
Why SPI@c260000 in slave mode keep reporting error on ...
Hi, now i set the spi@c260000 as slave mode, but when i use spidev_test ... (no connection, only connect fpga's MOSI to Xavier's...
Read more >
Teensy 4.1 SPI1 BUG at > 150MHZ
Hi there, My teensy 4.1 is connected to the mpu9250 over SPI1. I found out that when I use a CPU Speed of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found