Hi,
I am using a Fez Spider, I bought a couple of NRF24L01 module with hope that I could use it for private wireless chatter between Gadgeteer boards.
I’ve had a look at the specification for the module
and I had a look at the tutorial to SPI
https://www.ghielectronics.com/docs/14/spi
I’ve soldered the module pins to my extender like this
Vcc → 3.3V
GND → GND
CE → 3
SCK → 4
MISO → 5
CSN → 6
MOSI → 7
IRQ → 8
I’ve never actually done SPI before and don’t understand which pins need to be used where.
I’ve attempted to produce some code that would setup an interface with the device.
Obviously it doesn’t work, but it’s a start.
Please can someone who knows how to use SPI to interface with a device guide me as to what I should be doing to setup the device. Thank you.
using SPI = Gadgeteer.Interfaces.SPI;
...
SPI.Configuration MyConfig = new SPI.Configuration(
false, //initial state
0, //setup time
0, //hold time
false, //clock idle state
true, //clock edge
1000 //clock speed khz
);
GT.Socket socket = GT.Socket.GetSocket(
(int)GT.Socket.Pin.Nine, //Extender Module Socket
true, //Exception if invalid
extender, //Module?
null //Label
);
GT.Socket.Pin csPin = GT.Socket.Pin.Six; //chip select pin = CSN
GT.Socket chipSelectSocket = GT.Socket.GetSocket(
(int)csPin, //cs pin
//this is saying port six intead of pin 6 of the extender(I think)
true,
extender,
null
);
SPI MySPI = new SPI(
socket, //module socket
MyConfig, //config
SPI.Sharing.Shared, //sharing mode
chipSelectSocket, //cs socket
csPin, //cs pin
extender //module
);