Git Product home page Git Product logo

raspberryio's People

Contributors

andreasbotsikas avatar bruceme avatar dependabot-preview[bot] avatar devjutsu avatar edmundormz avatar forki avatar geoperez avatar gpduck avatar israelramosm avatar jtone123 avatar k3z0 avatar klauzyx avatar lmssonos avatar lucagraziani82 avatar manusanram avatar mariodivece avatar michaeldimoudis avatar oa4ajp avatar pgrawehr avatar samjonescodehouse avatar serk352 avatar wezzix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

raspberryio's Issues

Z-Wave functionality

Hello,

is it possible to address a z-wave usb stick in .net core? :)

Best regards

Turn off lights on program crash

I'm using this nice lib to control couple of LEDs via GPIO. Unfortunately sometimes my dotnet core program gets killed (there are good reasons for that) and the lights are still on.
Any ideas on how to configure it so that they are only on as long as my program lives?

No call backs whilst capturing video

I'm trying out your library on a RPi B. Communicating with the GPIO pins seems to work great. I could also capture an image fine. However when I was trying to capture video, nothing was captured. If I set CaptureDisplayPreview = true, the preview window does not open. I wrote a little python script to capture video that seemed to work fine, so I'm fairly sure the camera is working.

Do you have any suggestions for debugging the problem?

I don't suppose you have a way of actually attaching a debugger remotely to the .Net code?

Shutdown|Restart

Hey,
i would miss an Interface to restart and shutdown the device.
Could you implement that in this fantastic library :)

Best regards
Frank

Move WiringPi wrappers to its own project and NuGet package

I think that the WiringPi library wrappers should be placed in their own project and distributed as it's own NuGet package on which the actual RaspberryIO depends.

This would be great for those who would just want to use the wrapper.

Proposed package name: Unosquare.WiringPi

Callback executed multiple times and upon exit a wait for a callback prevents app from quitting...

I've created a sample project for ELECROW shield. 2 leds (one blinking) second turned on/off by button pressing down. It's a .NET standard 2.0 library running on Raspbian (sudo is needed)...

Now there are 2 issues:

  1. one is that the button press event (even if it should react on one edge, even if it's hold down for a longer period) does execute the callback multiple times (sometimes) and multiple is from (2 to 8 times approx).

  2. second: after releasing handles (maybe I do wrong) the app. does not exists until I don't push the button (so there's a wait that does not get cancelled)...

using System;
using System.Threading;
using System.Threading.Tasks;
using Unosquare.RaspberryIO;
using Unosquare.RaspberryIO.Gpio;

namespace LibRIO
{
    public class PiCode
    {
        public void Run()
        {
            //
            // Blinker
            var ledGreen = Pi.Gpio.Pin27;
            ledGreen.PinMode = GpioPinDriveMode.Output;

            var blinkerCancellationTokenSource = new CancellationTokenSource();
            var blinkerCancellationToken = blinkerCancellationTokenSource.Token;

            var taskBlinker = new Task(
                () =>
                {
                    Console.WriteLine("Starting blinker");

                    do
                    {
                        var value = ledGreen.Read();
                        value = !value;
                        ledGreen.Write(value);
                        Thread.Sleep(1000);

                    } while (!blinkerCancellationToken.IsCancellationRequested);

                },
                blinkerCancellationToken
            );

            //
            // Button - led
            var ledRed = Pi.Gpio.Pin28;
            ledRed.PinMode = GpioPinDriveMode.Output;

            var buttonRed = Pi.Gpio.Pin02;
            buttonRed.PinMode = GpioPinDriveMode.Input;
            buttonRed.InputPullMode = GpioPinResistorPullMode.PullUp;
            buttonRed.RegisterInterruptCallback(EdgeDetection.RisingEdge, () =>
            {
                var now = DateTime.Now;
                Console.WriteLine($"Button callback {now:HH:mm:ss.fffff}");
                var level = ledRed.Read();
                level = !level;
                ledRed.Write(level);
            });

            //
            // Main
            try
            {
                Console.WriteLine("Starting GPIO program...");

                taskBlinker.Start();

                Console.WriteLine("Press ENTER to exit...");
                Console.ReadLine();
            }
            finally
            {
                // Stop threads
                Console.WriteLine("Cancelling blinking...");
                blinkerCancellationTokenSource.Cancel();

                Console.WriteLine("Disposing GPIO...");
                Pi.Gpio.Dispose();

                Console.WriteLine("All OK to QUIT...");
            }

        }
    }
}

LCD 16x2

Has anyone ever needed to write 16x2 using a library?
How to make?

Does this library support asp.net core 2.1?

As I am getting bellow error as I reach sample code line in visual studio 2017.
var blinkingPin = Pi.Gpio[0];
{System.TypeInitializationException: The type initializer for 'Unosquare.RaspberryIO.Pi' threw an exception. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.PlatformNotSupportedException: This library does not support the platform
at Unosquare.RaspberryIO.Gpio.GpioController.Initialize(ControllerMode mode)
at Unosquare.RaspberryIO.Gpio.GpioController..ctor()
--- End of inner exception stack trace ---

Add Component: Button

I have a component that could be something to consider for Peripherals:

public class Button
    {
        private GpioPin gpioPin;
        private ulong last_interrupt_time;

        public Button(GpioPin gpioPin)
        {
            this.gpioPin = gpioPin;

            Initialize();
        }

        private void Initialize()
        {
            gpioPin.InputPullMode = GpioPinResistorPullMode.PullDown;
            gpioPin.PinMode = GpioPinDriveMode.Input;
            gpioPin.RegisterInterruptCallback(EdgeDetection.RisingAndFallingEdges, OnClick);
        }

        private void OnClick()
        {
            if (!gpioPin.Read())
            {
                ulong interrupt_time = WiringPi.millis();
                if (interrupt_time - last_interrupt_time > 500)
                {
                    last_interrupt_time = interrupt_time;
                    Click?.Invoke(this, new EventArgs());
                }
            }
        }

        public event EventHandler<EventArgs> Click;
    }

It could be further improved, and rather than the unsuitable “Click” event there would be “Pressed” and “Released”.

libwiringPi.so exception

Hi,
I am having this issue while using the PI GPIO :
System.DllNotFoundException: Unable to load shared library 'libwiringPi.so.2.46'

Full exception :

connection id "0HLFAL62TEK7E", Request id "0HLFAL62TEK7E:00000002": An unhandled exception was thrown by the application. System.TypeInitializationException: The type initializer for 'Unosquare.RaspberryIO.Pi' threw an exception. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.DllNotFoundException: Unable to load shared library 'libwiringPi.so.2.46' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibwiringPi.so.2.46.so: cannot open shared object file: No such file or directory

RFID is not working properly

Describe the bug
RFID controller is not working properly, it doesn't detect rfid devices, if it does, it can rarely read it´s info.

To Reproduce
Steps to reproduce the behavior:

  1. Setup RaspberryPI with RFID-RC522 (more info)
  2. Setup Unosquare.RaspberryIO.Playgroung to run Rfid test.
  3. Deploy Unosquare.RaspberryIO.Playgroung to the RaspberryPI (more info).
  4. Run Unosquare.RaspberryIO.Playgroung using mono.
  5. Try to read a RFID device with the RFID-RC522 card.
  6. No action is shown in console.

Expected behavior
When the RFID device is close enough to the reader it is expected to observe the following messages in console:

Card detected
Card UID: xx,xx,xx,xx

Initialise GpioController with user selectable ControllerMode

Is your feature request related to a problem? Please describe.
Would be beneficial to allow app to use GPIO without root permissions. For example GPIO control from a asp. net core application.

Describe the solution you'd like
Have the availability to set ControllerMode.FileStreamWithHardwarePins when GpioController is initalised.

Add servo motor support

It is unclear how pmwm works with current parameters. Change them to get more user friendly pwm and create a servo wrapper

GpioPin.RegisterInterruptCallback doesn't update /sys/class/gpio/gpioN/edge

After running the following code, I would expect that /sys/class/gpio/gpio20/edge would contain falling but instead it seems to be none.

var gpioPin = Pi.Gpio[28];
gpioPin.PinMode = GpioPinDriveMode.Input;
gpioPin.RegisterInterruptCallback(EdgeDetection.FallingEdge, OnButtonPressed);

Is it expected that I set /sys/class/gpio/gpio20/edge or should that be handled by this library? I find that only when I manually set it that the callback starts being fired.

I'm also finding I have to manually export the above pin before writing to it, which also seems a bit weird, and is probably related. I suspected some permissions issue but don't see any errors.

Type initialization exeption

Hi, I am trying to use your library for camera image capturing. I added it from nuget, added references to dll and paste this example code:

using System;
using System.IO;
using Unosquare.RaspberryIO;

namespace CameraTest
{
	class Program
	{
		static void Main(string[] args)
		{
			var pictureBytes = Pi.Camera.CaptureImageJpeg(640, 480);
			var targetPath = "picture.jpg";

			if (File.Exists(targetPath))
				File.Delete(targetPath);

			File.WriteAllBytes(targetPath, pictureBytes);
			Console.WriteLine($"Took picture -- Byte count: {pictureBytes.Length}");
		}
	}
}

But after running in Raspberry Pi 3 Model B with mono version 4.6.2, I got this:

Unhandled Exception:
System.TypeInitializationException: The type initializer for 'Unosquare.RaspberryIO.Pi' threw an exception. ---> System.TypeLoadException: Could not resolve type with token 01000043
  at Unosquare.RaspberryIO.Pi..cctor () [0x0002e] in <24c16b38f03d4d8384ee43863d670a67>:0
   --- End of inner exception stack trace ---
  at CameraTest.Program.Main (System.String[] args) [0x00000] in <9a994054a6e2462080c7b958b2bf44a6>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'Unosquare.RaspberryIO.Pi' threw an exception. ---> System.TypeLoadException: Could not resolve type with token 01000043
  at Unosquare.RaspberryIO.Pi..cctor () [0x0002e] in <24c16b38f03d4d8384ee43863d670a67>:0
   --- End of inner exception stack trace ---
  at CameraTest.Program.Main (System.String[] args) [0x00000] in <9a994054a6e2462080c7b958b2bf44a6>:0

Help please =)

Enabled getting a jpeg from the video stream

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Help with pca9685

I am trying to make commands via i2c, but I can not identify the deviceid. I would like to control servos using pca9685.

i2c response wrong

Describe the bug
Arduino send "hello " text but you can see screenshot.
Caming hhhhhhhh

Screenshots
If applicable, add screenshots to help explain your problem.
screen shot 2019-01-02 at 01 20 11
screen shot 2019-01-02 at 01 19 58

  • Version [0.17.2]

i2c add device typeinitialization exception

Making my first attempt using this library and it's not going well. I don't know if its because of the lack of examples or if something is actually wrong.

Using VS2015 with Raspberry Pi3 and Raspbian Stretch with wiringpi enabled and RaspberryIO installed by Nuget two days ago.
My code:
using Unosquare.RaspberryIO; ..... class BMP180 { public BMP180(int address) { try { var BMP180Device = Pi.I2C.AddDevice(address); } catch (Exception ex) { Console.WriteLine("Failed to register BMP180 at {0}. {1}", string.Format("{0:X2}", address), ex.GetType().FullName); } } }
And I get "Failed to register BMP180 at 77. System.TypeInitializationException"

I've been searching through all the documentation I can find and don't see anything else I should be doing.

P.S. Yes, i2cdetect shows the device at 77.

root privileges not required

Is your feature request related to a problem? Please describe.
Currently the GPIO requires root privileges, but since this is using wiringPi and it no longer requires root privileges this shouldn't require them either.

Describe the solution you'd like
The GPIO shouldn't require root privileges.

Describe alternatives you've considered
I've tested removing the "IsRunningAsRoot" check before the "WiringPiSetup" and it works without using sudo.

Additional context
I don't know if the change to wiringPi works across all bords and revisions. I've only tested on RPi3. But if we test for the existence of "/dev/gpiomem/" should be enough to know that it can work without root privileges, if it doesn't exist we can keep the "IsRunningAsRoot" check.

Issue with TemperatureSensorAM2302 on May 27 commit

Hi there, firstly thanks for this great library.

I'm using the TemperatureSensorAM2302, even though it's not that accurate it used to work. The update on May 27 880ec2c broke it. Reverting back to before that commit still works for me.

The error on a RaspberryPi running Raspbian .NET Core 2.0.7 is:

WRN >> [TemperatureSensorAM2302] 0 = L:   50 | H:   24
WRN >> [TemperatureSensorAM2302] 0 = L:   53 | H:   23
WRN >> [TemperatureSensorAM2302] 1 = L:   51 | H:   70
ERR >> [TemperatureSensorAM2302] BAD CHECKSUM: Expected C0; Was: D0```

RetrieveWirelessNetworks retrieving wrong network security

I wasn't able to detect the reason for this issue. When running Playground on rasp no password is required for secured networks, especially for Unosquare Mobiles.

At same time, ran "iwlist wlan0 scanning" which retrieves that network as secured.

This is a recurrent problem when using the wifi-connection assistant of AccessCore, sometimes it does not ask for password trying to connect to Unosquare WiFi

Any idea why this behaviour?

>.net standard class library

It's not possible to use the Raspberry.io inside .net standard 2.0. Nuget package will install but gives errors when debugging.

How to fix this?

Add NetworkInfo Singleton

NetworkInfo will contain a collection of NetworkAdapters
The ability to programmatically configure adapters (including wireless) will be exposed by this API

.Net Core ok?

Sorry for the stupid question, but does this support .net core?

SPI Bits Per Word / Frequency support

Currently developing for a board header

https://pi-plates.com/product/relayplate/

In their python script,

image

They set the transfer rate at send to 300000 with bits per word at 60.

Then they set the frequency to 500000 with 20 bits per word.

I am no SPI expert by any mean here. But I got this to work in UWP ( https://github.com/TWhidden/PiPlateRelay/blob/9b62a845c98e7ca2b3acc2f00973ad2d95d48d03/src/uwp/PiPlateRelay/PiRelay.cs#L182 ) and now I want to port it to .net Core.

This library looks to be one of the cleanest.

Looking at the source for wiringPi, he has it hard coded at 8 bits per word, so I imagine that would have to be something the user could pass through.

image

I am going to make some changes in my own repo, but curious if this is something that could be made available in a future release. Since UWP classes support it, I think it should be supported in this cool lib.

In this lib, you can see once its set, it does not change it because its been initialized.

internal static SpiChannel Retrieve(SpiChannelNumber channel, int frequency)

Thanks.

Initial call to Pi.Spi fails with exception

Describe the bug
Calling Pi.Spi.Channel0Frequency = Spi.MinFrequency results in an exception. The message from that exception is:

System.TypeInitializationException
HResult=0x80131534
Message=The type initializer for 'Unosquare.RaspberryIO.Pi' threw an exception.
Source=Unosquare.RaspberryIO
StackTrace:
at Unosquare.RaspberryIO.Pi.get_Spi()
at MAX31865..ctor(Int32 channel, Int32 chipSelect, Int32 readyPin, Byte config) in MAX31865.cs:line 91
at AppFunctions..ctor(AppGlobal app) in AppFunctions.cs:line 81
at AppGlobal..ctor() in AppGlobal.cs:line 18
at App..ctor() in App.xaml.cs:line 33
at Program.<>c.

b__0_0(ApplicationInitializationCallbackParams p) in App.g.i.cs:line 24

Inner Exception 1:
MissingMethodException: Method not found: 'System.String Unosquare.Swan.Runtime.get_EntryAssemblyDirectory()'.

For background info I'm using Visual Studio 2017 and deploying to an RPi 3B.

To Reproduce
Steps to reproduce the behavior:

  1. Download RaspberryIO nuget packages as described on "Installation" step of ReadMe
  2. Add using statements in file
  3. Add code to set Channel0 frequency for SPI bus as described above
  4. See error

Expected behavior
Get SPI bus and set the frequency of Channel 0

Desktop (please complete the following information):

  • OS: Windows 10
  • IDE: Visual Studio 2017

Hardware (please complete the following information):

  • Device: Raspberry Pi 3B
  • OS: Windows IoT v1803

.Net Core 2.0 on Win 10 IoT Supported?

I'm writing a .Net Core 2.0 Console App (not UWP) to control some external devices on a Raspberry Pi 3. Does RaspberryIO support this?

I've added the NuGet package to my console app and added the following code to void main() to turn on a LED on pin 5:

var pin = Pi.Gpio.Pin05;
pin.PinMode = GpioPinDriveMode.Output;
pin.Write(true);

When stepping over the first line I get a System.TypeInitializationException (The type initializer for 'Unosquare.RaspberryIO.Pi' threw an exception)

System.TypeInitializationException: The type initializer for 'Unosquare.Raspberr
yIO.Pi' threw an exception. ---> System.Reflection.TargetInvocationException: Ex
ception has been thrown by the target of an invocation. ---> System.PlatformNotS
upportedException: This library does not support the platform
at Unosquare.RaspberryIO.Gpio.GpioController.Initialize(ControllerMode mode)
at Unosquare.RaspberryIO.Gpio.GpioController..ctor()
--- End of inner exception stack trace ---
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOn
ly, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipChec
kThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean s
kipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at Unosquare.Swan.Abstractions.SingletonBase1.<>c.<.cctor>b__7_0() at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy1.CreateValue()
at Unosquare.Swan.Abstractions.SingletonBase`1.get_Instance()
at Unosquare.RaspberryIO.Pi..cctor()
--- End of inner exception stack trace ---
at Unosquare.RaspberryIO.Pi.get_Gpio()
at Echo.Program.SetLightState(Boolean state) in C:\Software\ParkSmart\Echo\Ec
ho\Program.cs:line 34

Documentation for Peripheral Classes

Hi, I'd like to use the 'Button' peripheral class (I've installed the Unosquare.RaspberryIO.Peripherals package), but I'm not sure how to use it as I can't seem to find any documentation for it.
I'm new to C# so apologies if my question seems a bit simple...
Thanks for helping me out! :)

Cannot catch HardwareException upon I2C Access to not Connected Device

Hi,

I am accessing a PCF8574 I/O expander via I2C on a Raspbeery Pi. No problem, as long as the I/O expander is connected to the I2C bus. However, when it is not connected, the program crashes, although I am trying to catch the relevant exceptions.

I am using Visual Studio 2017, .Net 4.5.2, Unosquare.Raspberry.IO 0.15.1 and Unosquare.Swan 0.32.2, mono 4.6.2 and Raspbian 4.14.50.

The relevant code, which reproduces the problem is:

        I2CDevice pcf8574_0 = null;

        try {
           pcf8574_0 = I2CBus.Instance.AddDevice(0x20);
        }
        catch {
           logger?.Warn("Cannot access I2C bus");
        };


        try {
           pcf8574_0?.Write(0);
        }
        catch (Exception e) {
           logger?.Error($"cannot write to I/O expander: {e}");
        }

Executing the code, without the PC8574 connected to the I2C bus, results in the following stacktrace:

at <0xffffffff>
at (wrapper managed-to-native) object.__icall_wrapper_mono_marshal_free (intptr) <0x00037>
at (wrapper managed-to-native) Unosquare.RaspberryIO.Native.Standard.StrError (int) <0x0005f>
at Unosquare.RaspberryIO.Native.HardwareException..ctor (int,string) <0x00073>
at Unosquare.RaspberryIO.Native.HardwareException.Throw (string,string) <0x00053>
at Unosquare.RaspberryIO.Gpio.I2CDevice.Write (byte) <0x0006f>
at Linq2Sql_Test.Program.Main () <0x00117>
at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) <0x000bf>

Native stacktrace:

Debug info from gdb:

[New LWP 18424]
[New LWP 18425]
[New LWP 18426]
[New LWP 18427]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
0x76ea54cc in __waitpid (pid=18428, stat_loc=0x7ea29f88, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
29 ../sysdeps/unix/sysv/linux/waitpid.c: Datei oder Verzeichnis nicht gefunden.
Id Target Id Frame

  • 1 Thread 0x76fbc570 (LWP 18423) "Main" 0x76ea54cc in __waitpid (pid=18428, stat_loc=0x7ea29f88, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
    2 Thread 0x763ff470 (LWP 18424) "SGen worker" 0x76ea094c in __pthread_cond_wait (cond=0x3258f0, mutex=0x3258bc) at pthread_cond_wait.c:186
    3 Thread 0x76a5f470 (LWP 18425) "Finalizer" 0x76ea3014 in futex_abstimed_wait_cancelable (private=0, abstime=0x0, expected=1, futex_word=0x31d8c0) at ../sysdeps/unix/sysv/linux/futex-internal.h:205
    4 Thread 0x73c17470 (LWP 18426) "Main" 0x76e160f0 in read () at ../sysdeps/unix/syscall-template.S:84
    5 Thread 0x739ff470 (LWP 18427) "Timer-Scheduler" 0x76ea094c in __pthread_cond_wait (cond=0x1fd3930, mutex=0x1fd3914) at pthread_cond_wait.c:186

Thread 5 (Thread 0x739ff470 (LWP 18427)):
#0 0x76ea094c in __pthread_cond_wait (cond=0x1fd3930, mutex=0x1fd3914) at pthread_cond_wait.c:186
#1 0x0021cdfc in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Thread 4 (Thread 0x73c17470 (LWP 18426)):
#0 0x76e160f0 in read () at ../sysdeps/unix/syscall-template.S:84
#1 0x7497868c in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Thread 3 (Thread 0x76a5f470 (LWP 18425)):
#0 0x76ea3014 in futex_abstimed_wait_cancelable (private=0, abstime=0x0, expected=1, futex_word=0x31d8c0) at ../sysdeps/unix/sysv/linux/futex-internal.h:205
#1 do_futex_wait (sem=sem@entry=0x31d8c0, abstime=0x0) at sem_waitcommon.c:115
#2 0x76ea3158 in __new_sem_wait_slow (sem=0x31d8c0, abstime=0x0) at sem_waitcommon.c:282
#3 0x001ac174 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Thread 2 (Thread 0x763ff470 (LWP 18424)):
#0 0x76ea094c in __pthread_cond_wait (cond=0x3258f0, mutex=0x3258bc) at pthread_cond_wait.c:186
#1 0x002158e8 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Thread 1 (Thread 0x76fbc570 (LWP 18423)):
#0 0x76ea54cc in __waitpid (pid=18428, stat_loc=0x7ea29f88, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:29
#1 0x000bbb44 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.

First of all I wonder why pcf8574_0 is not null, although the device is not connected. Then the call to I2CDevice .Write() raises an exception and it looks like the constructor of the HardwareException is causing the crash. Any idea why this happens?

kind regards
Wolfgang

Troubleshooting hardware error

Hi
I am using Visual Studio 2017, .Net 4.5.2, Unosquare.Raspberry.IO 0.17.2 and Unosquare.Swan 0.34.2, mono 4.6.2 and Raspbian 4.14.71.

After step "Run the project"(./Unosquare.RaspberryIO.Playground) I recived error bellow:

root@SH:/home/root/playground# mono Unosquare.RaspberryIO.Playground.exe
00:07:23.715 INF >> Starting program at 03/11/2018 00:07:23
00:07:23.937 INF >> GPIO Controller initialized successfully with 32 pins
00:07:23.952 INF >> System Information
WiringPiVersion : 2.46
RaspberryPiVersion : Pi3ModelBSony
WiringPiBoardRevision : 2
ProcessorCount : 4
InstalledRam : 972234752
IsLittleEndian : True
ModelName : ARMv7 Processor rev 4 (v7l)
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CpuImplementer : 0x41
CpuArchitecture : 7
CpuVariant : 0x0
CpuPart : 0xd03
CpuRevision : 4
Hardware : BCM2835
Revision : a02082
Serial : 00000000da879820
UptimeTimeSpan : 03:29:55.9000000
00:07:23.954 INF >> Microseconds Since GPIO Setup: 89538
00:07:23.955 INF >> Uname Linux 4.14.71-v7+ #1145 SMP Fri Sep 21 15:38:35 BST 2018
00:07:23.961 INF >> HostName SH
00:07:23.963 INF >> Uptime (seconds) 12595.91015625
00:07:23.964 INF >> Uptime (timespan) 0 days 03:29:55
00:07:24.274 INF >> Adapter: eth0 | IPv4: | IPv6: | AP: | MAC: b8:27:eb:87:98:20
00:07:24.274 INF >> Adapter: lo | IPv4: 127.0.0.1 | IPv6: ::1 | AP: | MAC:
00:07:24.274 INF >> Adapter: wlan0 | IPv4: 192.168.1.41 | IPv6: | AP: Z | MAC:
00:07:24.279 INF >> Testing RFID
00:07:24.292 ERR >> [Main] Error
$type : Unosquare.RaspberryIO.Native.HardwareException
ErrorCode : 2
Component : SpiChannel.Channel1
ExtendedMessage : No such file or directory
Message : A hardware exception occurred. Error Code: 2
TargetSite : Void Throw(System.String, System.String)
StackTrace :
at Unosquare.RaspberryIO.Native.HardwareException.Throw (System.String className, System.String methodName) [0x00016] in :0
at Unosquare.RaspberryIO.Gpio.SpiChannel..ctor (Unosquare.RaspberryIO.Gpio.SpiChannelNumber channel, System.Int32 frequency) [0x00074] in :0
at Unosquare.RaspberryIO.Gpio.SpiChannel.Retrieve (Unosquare.RaspberryIO.Gpio.SpiChannelNumber channel, System.Int32 frequency) [0x00031] in :0
at Unosquare.RaspberryIO.Gpio.SpiBus.get_Channel1 () [0x00021] in :0
at Unosquare.RaspberryIO.Playground.Program.TestRfidController () [0x0001f] in :0
at Unosquare.RaspberryIO.Playground.Program.Main (System.String[] args) [0x00038] in :0
Source : Unosquare.RaspberryIO
HResult : -2146233088
00:07:24.552 INF >> Program finished.

Can you help me to fix this error?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.