Main Site Documentation

.NET GADGETEER SPI Fez Hydra


#1

I am getting this error,

Exception System.Exception - CLR_E_DRIVER_NOT_REGISTERED (2)

#### Message: 
#### Microsoft.SPOT.Hardware.NativeEventDispatcher::.ctor [IP: 0000] ####
#### GHIElectronics.NETMF.System.InternalEvent::.cctor [IP: 0014] ####

An unhandled exception of type ‘System.Exception’ occurred in Microsoft.SPOT.Hardware.dll

When using this code for an SPI instance.

//GT = Gadgeteer
            GT.Socket socket = GT.Socket.GetSocket(3, false, null, null);
            SPI.Configuration SpiConfiguration = new SPI.Configuration(false, 2, 2, false, true, 1000);
            SPI.Sharing shared = new SPI.Sharing();
            SPI SpiCom = new SPI(socket, SpiConfiguration, shared, socket, GT.Socket.Pin.Five, null);

            SpiCom.WriteRead(WriteBuffer, ReadBuffer);

Is my code correct or am I bouncing off the walls?


#2

What references do you have added to your project? It looks like you may be using a non-OSH assembly, which is usually the cause of this error.


#3

I just have to ask this. Is firmware on the board and installed SDK in sync?


#4

Guys, Solved it!
I was using the gadgeteer template, and placed the SPI instance within ProgramStarted(). I am now using a standard class template and not getting any errors. Its nice to see that SPI has a shared method, so why cant we have the same for I2C, which is also a buss?

@ Steven, I can only find 2 OSH refs should there be more?

@ Architect, Good call, but I updated my Hydra a few days ago!


#5

Sorry its not solved! It appears to be ok when using the emulator, but when I change to USB I get the above error.

@ Steven I am using:

using System;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;

using GHIElectronics.OSH.NETMF.Hardware;
using GHIElectronics.OSH.NETMF.Native;
using GHIElectronics.NETMF.System;

using Gadgeteer;
using Gadgeteer.Interfaces;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;

in my program, and

Gadgeteer
GHIElectronics.Gadgeteer.FEZHydra
GHIElectronics.NETMF.System
GHIElectronics.OSH.NETMF.Hardware
GHIElectronics.OSH.NETMF.Native
GTM.GHIElectronics.UsbClientDP
Microsoft.SPOT.Hardware
Microsoft.SPOT.Native

references.


#6

GHIElectronics.NETMF.System

Is not supposed to be there.


#7

@ Architect, Excellent thats fixed it, but now, how do I use trig functions?


#8

System.Math?

**** Oooops. I thought there were trig functions there.


#9

This project has some functions,but I don’t see the code there

http://www.tinyclr.com/codeshare/entry/149

Something is broken on codeshare for this one after the recent update.


#10

I have a math lib here.

Also, I think I read that 4.2 was adding a lot of the trig functions. I haven’t explored that yet, though.


#11

I have a copy of Grommet somewhere I will dig that out. I’m sure that has Trig functions, it just makes it a bit messy. Thanks for the help!


#12

Math.cs from Grommet works fine! Thanks again!


#13

You are welcome!

What are you working on, just curious?


#14

@ Architect,

I’m not focused on anything at the moment. I get so much pleasure form just connecting sensors etc, to a uC and getting something working, normaly without an end product in mind. Yeah I know I need to get a life, but it keeps me happy. I am sure I will fly a Panda II, with the help of an STM32F103, buts that will be at least 3 - 4 months when I have enough spare cash, and if I dont lose intrest.


#15

I see. As long as you having fun like the rest of us. Good luck with your projects! :slight_smile: