unosquare / raspberryio

The Raspberry Pi's IO Functionality in an easy-to-use API for Mono/.NET/C#
https://unosquare.github.io/raspberryio
Other
672 stars 104 forks source link

A hardware exception occurred. Error Code: 2 (when attempting to use LedStripAPA102C) #214

Closed MatthewSteeples closed 4 years ago

MatthewSteeples commented 4 years ago

I have a NETCORE 2 app that I'm attempting to run under Mono 6.10 on a Raspberry Pi Zero W. I'm using version 0.27 of Unosquare.Raspberry.IO, 0.5 of Unosquare.RaspberryIO.Peripherals and 0.5 of Unosquare.WiringPi I have the following code:

Pi.Init<BootstrapWiringPi>();
Console.WriteLine(Pi.Info.ToString());
var ledStrip = new LedStripAPA102C(4 * 8, 1, 1000000);

The init appears to work fine, and the Info prints out the following:

System Information LibraryVersion : 2.50 RaspberryPiVersion : PiZeroW BoardRevision : 2 ProcessorCount : 1 InstalledRam : 453414912 IsLittleEndian : True ModelName : ARMv6-compatible processor rev 7 (v6l) Features : half thumb fastmult vfp edsp java tls CpuImplementer : 0x41 CpuArchitecture : 7 CpuVariant : 0x0 CpuPart : 0xb76 CpuRevision : 7 Hardware : BCM2835 Revision : 9000c1 RevisionNumber : 1 Serial : 0000000041d99c02 UptimeTimeSpan : 00:14:39.6400000

The line to initiate the LedStripAPA102C prints the following

Unhandled Exception: Unosquare.RaspberryIO.Abstractions.Native.HardwareException on SpiChannel.Channel1: (2) - A hardware exception occurred. Error Code: 2 [ERROR] FATAL UNHANDLED EXCEPTION: Unosquare.RaspberryIO.Abstractions.Native.HardwareException on SpiChannel.Channel1: (2) - A hardware exception occurred. Error Code: 2

The hardware that I'm using is a Unicorn phat

I have enabled the I2C and SPI Kernel modules, and verified that they are running with lsmod

The Kernel version is 4.19.118+ and it's a relatively fresh install of buster. I have not run rpi-update

I'm all out of ideas so would appreciate any pointers in the right direction

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.