- Netduino Forums
- → Genious's Content
Genious's Content
There have been 10 items by Genious (Search limited from 20-April 23)
#6987 Lots of Serial
Posted by Genious on 04 January 2011 - 03:02 PM in Netduino 2 (and Netduino 1)
#6975 Lots of Serial
Posted by Genious on 04 January 2011 - 12:34 PM in Netduino 2 (and Netduino 1)
#6149 WiFly Shield
Posted by Genious on 16 December 2010 - 11:25 AM in Netduino 2 (and Netduino 1)
In the end I got it booting into ad-hoc (by setting up ad-hoc with an Arduino program) and connected from the laptop. Was able to telnet in on port 80, enter command mode and send data as you'd expect.
Swapped the shield over to the netduino with a simple program to copy every received char to Debug.Write. Nothing happened.
Plugged back into Arduino and now the red comms light doesn't flash when the Arduino boots (so no comms at all from the SPI/Serial). Have I killed the WiFly..? probably. No clue how I managed it though, and the other lights still flash when it's powered.
Totally confused and quite miserable about the £60 I may have just flushed down the toilet!!
Dan
#5851 WiFly Shield
Posted by Genious on 07 December 2010 - 02:30 PM in Netduino 2 (and Netduino 1)
I have been assuming up to now that it's because A: The serial commands I'm sending are garbled somehow or B: The unit fails to enter command mode.
Since I can't analyse the serial comms, there's not much more I can work out!
Dan
#5844 WiFly Shield
Posted by Genious on 07 December 2010 - 11:08 AM in Netduino 2 (and Netduino 1)
Power: Fine on my board as I use external power and was managing to read something back anyway.
SPI/Serial: Looks like I'm setting that up correctly as my init code matches Innovactive's.
Writing: The only difference is that I call _spi.Write twice but Innovactive just calls it once (which is much more elegant if nothing else!).
Quiche31: Maybe I have this problem too? I don't understand why I can't get it into command mode with the Netduino, but the Arduino running the Sparkfun demo code gets it right every time!
Has anyone managed to get commands into the module from the Netduino or is everyone just preconfiguring with a PC connection?
Innovactive: Can you post the body of your SpiUartReadByte method? Just want to check it matches mine!
Excellent work with the Silverlight GUI by the way. I'm a WPF developer for a living, so I like to see good looking WPF/Silverlight GUIs. I'd hoped to make a similar one for remote control of my little robot project.
Cheers,
Dan
#4655 WiFly Shield
Posted by Genious on 08 November 2010 - 04:01 PM in Netduino 2 (and Netduino 1)
#4244 WiFly Shield
Posted by Genious on 26 October 2010 - 06:08 PM in Netduino 2 (and Netduino 1)
#4178 WiFly Shield
Posted by Genious on 24 October 2010 - 05:22 PM in Netduino 2 (and Netduino 1)
* I know the SPI/Serial chip is outputting something because the activity light flashes.
* I know that the WiFly shield itself works because it works with my Arduino.
* I know that whatever activity I'm sending isn't working, because I can't get the chip to work!
I'm totally at a loss now really... I really want to make the shield work, but I just don't know what else to try. The current solution looks like I'll have to use the Arduino to act as a serial/WiFly bridge - a solution that takes up too much space, too much power and looks nasty!
Any help you guys can give would be massively appreciated.
Dan
#4066 WiFly Shield
Posted by Genious on 21 October 2010 - 06:56 PM in Netduino 2 (and Netduino 1)
using System; using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware; using SecretLabs.NETMF.Hardware.Netduino; namespace WirelessTester { public class Program { private static SPI _spi; private const byte LCR = 0x03 << 3; private const byte DLL = 0x00 << 3; private const byte DLM = 0x01 << 3; private const byte EFR = 0x02 << 3; private const byte FCR = 0x02 << 3; private const byte SPR = 0x07 << 3; private const byte RHR = 0x00 << 3; private const byte LSR = 0x05 << 3; private const byte THR = 0x00 << 3; private const byte DivL = 0x60;//0x50; private const byte DivM = 0x00; private const byte DataFormat = 0x03; private const byte Flow = 0x10; public static void Main() { // write your code here OutputPort led = new OutputPort(Pins.ONBOARD_LED, false); SPI.Configuration config = new SPI.Configuration( Pins.GPIO_PIN_D10, false, 0, 0, false, true, 10000, SPI.SPI_module.SPI1); _spi = new SPI(config); Thread.Sleep(1000); _spi.Write(new byte[] { LCR, 0x80 }); _spi.Write(new byte[] { DLL, DivL }); _spi.Write(new byte[] { DLM, DivM }); _spi.Write(new byte[] { LCR, 0xBF }); _spi.Write(new byte[] { EFR, Flow }); _spi.Write(new byte[] { LCR, DataFormat }); _spi.Write(new byte[] { FCR, 0x06 }); _spi.Write(new byte[] { FCR, 0x01 }); SpiUartWriteChar('H'); char c = (char) SpiUartReadByte(SPR); Debug.Print(c.ToString()); //SpiUartWriteLine(""); //SpiUartWriteLine("exit"); //Thread.Sleep(500); SpiUartFlush(); SpiUartWrite("$$$"); Debug.Print(SpiUartReadLine()); Thread.Sleep(500); led.Write(true); SpiUartWriteLine("reboot"); Thread.Sleep(3000); led.Write(false); SpiUartWrite("$$$"); Debug.Print(SpiUartReadLine()); Thread.Sleep(500); SpiUartWriteLine("set w a 3"); Debug.Print(SpiUartReadLine()); Thread.Sleep(500); SpiUartWriteLine("set w p sdgvsfdsf"); Debug.Print(SpiUartReadLine()); Thread.Sleep(500); SpiUartWriteLine("set i l 80"); Debug.Print(SpiUartReadLine()); Thread.Sleep(500); Thread.Sleep(100); SpiUartFlush(); Thread.Sleep(100); SpiUartWriteLine("join ManParadise"); Thread.Sleep(10000); Debug.Print(SpiUartReadLine()); SpiUartWriteLine("show c"); Debug.Print("Setup done"); while(true) { string s = SpiUartReadLine(); if (s != "") Debug.Print(s); } } private static void SpiUartFlush() { int i = 0; while (i < 1000) { if ((SpiUartReadByte(LSR) & 0x01) == 0x01) { SpiUartReadByte(RHR); } else { i++; } } } private static string SpiUartReadLine() { int i = 0; string data = ""; while(i < 1000) { if ((SpiUartReadByte(LSR) & 0x01) == 0x01) { byte b = SpiUartReadByte(RHR); //if (b == '\n' || b == 0xFF) // break; data += (char)b; } else { i++; } } return data; } private static void SpiUartWriteLine(string data_) { SpiUartWrite(data_ + "\n"); } private static void SpiUartWrite(string data_) { Debug.Print(data_); byte[] sendBuffer = new byte[data_.Length]; for (int i = 0; i < data_.Length; ++i) { sendBuffer[i] = (byte) data_[i]; } _spi.Write(new byte[] {THR, 0x01}); _spi.Write(sendBuffer); } private static void SpiUartWriteChar(char c_) { _spi.Write(new[] { SPR, (byte)c_ }); } private static byte SpiUartReadByte(byte addr_) { byte[] b = new byte[2]; _spi.WriteRead(new byte[] { (byte) (addr_ | 0x80) }, B); return b[1]; } } }
#4059 WiFly Shield
Posted by Genious on 21 October 2010 - 11:52 AM in Netduino 2 (and Netduino 1)
- Netduino Forums
- → Genious's Content
- Privacy Policy