Main Site Documentation

Spider SPI


#1

I have tried for a week to set up an SPI link to a 16bit ADC using an extender module on my spider. The problem is the Gadgeteer API entry for SPI gives no indication, or example, of how to configure or use the SPI ports and there are no code examples on the web as far as I can tell. I have tried most of the ten pages or so of non-Spider code examples and they don’t work. I have attached a typical example. Can anybody tell me how to gain access to SPI ports on the Spider, please?


#2

Check the following function:


public Oled_SSD1306(int socketNumber) : base(WPFRenderOptions.Intercept)
        {
            // This finds the Socket instance from the user-specified socket number.  
            // This will generate user-friendly error messages if the socket is invalid.
            // If there is more than one socket on this module, then instead of "null" for the last parameter, 
            // put text that identifies the socket to the user (e.g. "S" if there is a socket type S)
            Socket socket = Socket.GetSocket(socketNumber, true, this, null);
 
            _resetPin = new GTI.DigitalOutput(socket, Socket.Pin.Four, true, this);
            _dcPin = new GTI.DigitalOutput(socket, Socket.Pin.Five, true, this);
 
            // Create an LCD Configuration and set LCDControllerEnabled to false
            // to tell the mainboard that the LCD controller is not used and save on clock cycles
            Mainboard.LCDConfiguration lcdConfig = new Mainboard.LCDConfiguration();
            lcdConfig.LCDControllerEnabled = false;
            lcdConfig.Width = this.Width;
            lcdConfig.Height = this.Height;
            GT.Modules.Module.DisplayModule.SetLCDConfig(lcdConfig);
 
            GTI.SPI.Configuration spiConfig = new GTI.SPI.Configuration(false, 0, 0, true, true, 10000);
            _spi = new GTI.SPI(socket, spiConfig, GTI.SPI.Sharing.Shared, socket, Socket.Pin.Six, this);
 
            Init();
        }

It is taken from the driver on code share:
http://code.tinyclr.com/project/439/gadgeteer-oledssd1306-display-module/

It shows how to properly initialize spi on Gadgeteer.


#3

Thank you for the advice. It appears that I may be the first to try and use the Spider’s SPI to [italic]receive[/italic] data. The workload implied by the downloads I will need to read to understand module building is huge. I wonder if you would advise me whether a triggered upload of 32kB of data in 0.4s is actually a realistic possibility with the Spider. I have read somewhere recently that one must expect delays of 1 to 10ms because the .NET code has to be interpreted by the processor before each action and hence may be unsuited for time-critical tasks. Perhaps instead I should learn how to drive a simpler processor for that task and focus instead on things for which the Spider is better suited.


#4

Hi there,

you say 32kb of data in .4s, can you elaborate? I assume you’re just wanting to retrieve this from the SPI chip? How many data points is that, and in how many iterations? What are you going to then do with that data - subsequent processing, logging to storage, publishing to internet? All of those other things will have an equally large impact on how achievable your task is.

Personally, I wouldn’t consider a move elsewhere until you know the Spider doesn’t meet that goal, and I don’t think that’s the case just yet.