I'm trying to figure out SPI on the netduino with this code:
using System; using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware; using SecretLabs.NETMF.Hardware.Netduino; using System.IO.Ports; namespace NetduinoApplication1 { public class Program { public static void Main() { SPI spi_port = new SPI(new SPI.Configuration( Pins.GPIO_NONE, // Chip select pin false, // false - CS active state is low 0, // CS setup time in ms 0, // CS hold time false, // false - Clk low on idle false, // false - Data valid on falling edge 100, // Clock rate in kHz SPI_Devices.SPI1 // SPI Module )); byte[] readBuffer = new byte[2]; while (true) { spi_port.WriteRead(new byte[] { 0x00, 0x55 }, readBuffer); //Thread.Sleep(1); } } } }
I have problem with:
1. Clock rate adjustment. What clock speed is supported by Netduino?
2. 20us before the data transfer, the clock line is weakly pulled-up for about 40us. This gave me an extra unwanted clock edge. Is it possible to remove this?