Main Site Documentation

N18 display and Cerbot


#1

Got the Cerbot and various modules for xmas.
So bit of a noob so please be gentle…
Compass and cerbot itself work fine.
Plugged the N18 display into port 3.
Get Invalid Operation Exception at this line:

private void InitializeModules() {
this.compass = new GTM.Seeed.Compass(4);
this.cerbotController = new GTM.GHIElectronics.CerbotController();
this.display_N18 = new GTM.GHIElectronics.Display_N18(3); << exception
}

A first chance exception of type ‘System.InvalidOperationException’ occurred in Microsoft.SPOT.Hardware.dll

Assembly: mscorlib (4.2.0.0) Assembly: Microsoft.SPOT.Native (4.2.0.0) Assembly: Microsoft.SPOT.Hardware (4.2.0.0)
Assembly: Microsoft.SPOT.Graphics (4.2.0.0) Assembly: Microsoft.SPOT.TinyCore (4.2.0.0)
Assembly: Microsoft.SPOT.Hardware.SerialPort (4.2.0.0) Assembly: Microsoft.SPOT.IO (4.2.0.0)
Assembly: System.IO (4.2.0.0) Assembly: Microsoft.SPOT.Hardware.OneWire (4.2.0.0)
Assembly: Microsoft.SPOT.Hardware.Usb (4.2.0.0) Assembly: System.Xml (4.2.0.0)
Assembly: Microsoft.SPOT.Hardware.PWM (4.2.0.1) Assembly: Microsoft.SPOT.Net (4.2.0.0)
Assembly: System (4.2.0.0) Loading Deployment Assemblies.

Attaching deployed file.

Assembly: GTM.GHIElectronics.Display_N18 (4.2.101.0) Attaching deployed file.

Assembly: GHI.OSHW.Hardware (4.2.6.1) Attaching deployed file.

Assembly: Gadgeteer (2.42.0.0) Attaching deployed file.

Assembly: Gadgeteer.SPI (2.42.0.0) Attaching deployed file.

Assembly: GTM.Seeed.Compass (1.6.0.0) Attaching deployed file.

Assembly: GadgeteerApp2 (1.0.0.0) Attaching deployed file.

Assembly: GTM.GHIElectronics.CerbotController (4.2.101.0) Attaching deployed file.

Assembly: GHIElectronics.Gadgeteer.FEZCerbot (4.2.101.0) Resolving.

Thanks in advance.


#2

I too am having the same issue.


#3

Something inside module’s constructor throwing the exception.

Try this:

  1. Download N18 driver code from codeplex (just on .cs file)
    http://gadgeteer.codeplex.com/SourceControl/latest#Main/Modules/GHIElectronics/Display N18/Software/Display N18/Display_N18_42/Display_N18_42.cs

  2. Remove the reference for N18 from your project

  3. Add the downloaded file to your project

At this point you should be able to compile and step into the module constructor and see exactly which line throwing the exception.


#4

public Display_N18(int socketNumber)
: base(WPFRenderOptions.Intercept)

… // socket - 3 for cerbot

        this.spi = new GTI.SPI(this.socket, this.spiConfig, GTI.SPI.Sharing.Shared, this.socket, Socket.Pin.Six, this); // throws the error

#5

I am in the process of rewriting my BLE pimping of my Cerbot so i decided to have a look at the problem here.

The issue is the CerbotController is setting up the LED’s to use SPI.

The N18 is then trying to do the same and here in lays the problem.

Quick and dirty fix is yo add the CerbotController source to your project and comment out the following :

//private SPI forwardLEDs;
//private SPI.Configuration spiConfig;

//this.forwardLEDs.Write(toSend);

And then it’s “Bob’s and uncle and Fannies your aunt”


#6

Thanks…that was it! Now on to the next hurdle :slight_smile:


#7

Shouldn’t it be shareable?


#8

It should be, i only spent a couple of minutes on it as i was in the middle of pimping my Cerbot…

It appears to be throwing a reserved pin error - needs a wee bit more digging…


#9

@ Kwaugh32 - keep us posted with progress :slight_smile:


#10

@ Justin - That is some serious pimping.


#11

I have some of the other samples now running (display battery usage etc). Next goal is pulling the serial camera image onto the Display N18. I bet, I will need to grab the source code (sercam_42) and use it (eg. tweak).

This is fun but frustrating at the same time.


#12

We can reproduce the issue. It occurs because the CerbotController does not currently use Gadgeteer interfaces, so an exception is thrown when a second NETMF SPI instance is created by Gadgeteer after our first inside the CerbotController driver.

Until we update the driver to use the Gadgeteer interfaces, if you need to use the LEDs and a another SPI device, you could update the LEDs to use the Gadgeteer SPI interface instead.