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.

Stephen

Member Since 19 Aug 2010
Offline Last Active Jan 24 2014 11:09 AM
-----

Topics I've Started

SPI

22 August 2010 - 10:10 AM

Hello,

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?

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.