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.

netiness

Member Since 21 Sep 2013
Offline Last Active Jul 02 2017 08:26 PM
-----

Topics I've Started

Emulator, can it handle OneWire ?

04 December 2013 - 08:21 AM

After accidently turning at least three of the io-ports on my NP2 to output only, I moved into using the emulator for a while. I can use it to simulate my io connections, spi and i2c device all fine. But I also want to handle the onewire temperature-sensor. I've looked into the NetMF sources, and see that OneWire is mapped directly to a cpu pin, even though an OutputPort is passed to its constructor (which lead me to believe that I could use it in the emulator in the first case). Is it possible to debug/emulate OneWire devices in the emulator, or will I have to use a special class just for deplyment to the emulator ? This shouldn't be too hard to do, but I dont like to use defines depending on the "deployment platform". 

 

Thanks in advance,

 

Kjetil


Need help with TFT display and SPI

17 October 2013 - 06:29 PM

Still learning but boy is this fun. A big thanks to the people at Secret Labs !! 

 

I have a TFT display like this one

http://www.elecfreak...#External_Links

 

I have connected it with SCK on D13,MOSI on D11, CS on D10, reset on A1, D/C on A2.

 

I have converted the source from the above link to C# and have no problem setting pixels on the display. Really slooow, but it works. Now, I would like to try using SPI to speed things up, but have run into some problems.

This is how I have found the SPI should be initialized :

Device1 = new SPI.Configuration(       Pins.GPIO_PIN_D10, // CS-pin       false,             // CS-pin active state       0,                 // The setup time for the SS port        0,                 // The hold time for the SS port       true,              // The idle state of the clock       false,             // The sampling clock edge       1000,              // The SPI clock rate in KHz        SPI_Devices.SPI1   // The used SPI bus (refers to a MOSI MISO and SCLK pinset)   );                SPIBus = new SPI(Device1);

I use the following for sending data/commands to the display. Note that if I set UseSPI=false everything works as expected

 void LCD_Write_Bus(byte data)        {            if (UseSPI)            {                SPIBus.Write(new byte[] { data });            }            else            {                P_CS.Write(false);                for (byte c = 0; c < 8; c++)                {                    P_MOSI.Write((data & 0x80) != 0);                    data = (byte)(data << 1);                    P_SCK.Write(false);                    P_SCK.Write(true);                }                P_CS.Write(true);            }        }        void LCD_Write_COM(byte VL)        {            P_DC.Write(false);            LCD_Write_Bus(VL);        }        void LCD_Write_DATA(byte VL)        {            P_DC.Write(true);            LCD_Write_Bus(VL);        }

Anyone experience who can point me in the right direction ?

 

Kjetil


Unable to use GPIO pin 12 as output

13 October 2013 - 05:01 PM

Hello all,

I'm all very new to this, so please excuse a beginner for asking questions; I've only had the NP2 for a couple of weeks.

I was under the impression that any pin could be used for gpio, but if I try to use Pin 12 for output, the NP2 crashes - so hard that I have to reflash the firmware. Also, if I remove the USB cable before Visual Studio times out the connection I am greated with a BSOD.

 

This statement stop everything for me:

public OutputPort SpindlePort = new OutputPort(Cpu.Pin.GPIO_Pin12, false);

Pin 13 is OK to use, but is there any reason for me not being able to use Pin 12 as I want to (or do I have to disable something since this pin belongs to the SPI interface) ?

 

Regard,

Kjetil


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.