Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

SPI Help


  • Please log in to reply
2 replies to this topic

#1 Squintz

Squintz

    Advanced Member

  • Members
  • Pip
  • 9 posts
  • LocationMaryland

Posted 15 August 2010 - 09:44 PM

What about the following code is causing an exception to be thrown when I create a new SPI object? The exception says

#### Exception System.Exception - CLR_E_PIN_UNAVAILABLE (2) ####
#### Message:
#### Microsoft.SPOT.Hardware.Port::.ctor [IP: 0000] ####
#### Microsoft.SPOT.Hardware.OutputPort::.ctor [IP: 0006] ####
#### Microsoft.SPOT.Hardware.SPI::.ctor [IP: 004d] ####
#### NetduinoApplication1.Program::.cctor [IP: 0024] ####
A first chance exception of type 'System.Exception' occurred in Microsoft.SPOT.Hardware.dll
An unhandled exception of type 'System.Exception' occurred in Microsoft.SPOT.Hardware.dll

Uncaught exception
The thread '<No Name>' (0x2) has exited with code 0 (0x0).
#### Exception System.NullReferenceException - CLR_E_NULL_REFERENCE (1) ####
#### Message:
#### NetduinoApplication1.Program::Main [IP: 000b] ####
A first chance exception of type 'System.NullReferenceException' occurred in NetduinoApplication1.exe
An unhandled exception of type 'System.NullReferenceException' occurred in NetduinoApplication1.exe


        public static SPI.Configuration spi_config = new SPI.Configuration(Pins.GPIO_PIN_D13,
                                      false,
                                      1,
                                      1,
                                      true,
                                      false,
                                      15000,
                                      SPI_Devices.SPI1);

        public static SPI mySPI = new SPI(spi_config);

Harford Hackerspace - Collaborate, Learn, Socialize! Visit us if you are in the Baltimore, MD area!

#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 15 August 2010 - 10:08 PM

Hi Squintz, At first glance...Pins.GPIO_PIN_D13 is the clock line for the SPI...you won't be able to use that as your Chip Select line. I would recommend Pins.GPIO_PIN_D10 in most cases... The following three pins are not available when using SPI (since they are the SPI data lines): Pins.GPIO_PIN_D11 (SPI Slave Input) Pins.GPIO_PIN_D12 (SPI Slave Output) Pins.GPIO_PIN_D13 (SPI Clock) Chris

#3 Squintz

Squintz

    Advanced Member

  • Members
  • Pip
  • 9 posts
  • LocationMaryland

Posted 15 August 2010 - 11:06 PM

Doh! I traced the wrong wire out. :)
Harford Hackerspace - Collaborate, Learn, Socialize! Visit us if you are in the Baltimore, MD area!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.