OZ8ET's Content - Netduino Forums
   
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.

OZ8ET's Content

There have been 46 items by OZ8ET (Search limited from 15-May 23)


By content type

See this member's


Sort by                Order  

#42381 OneWire ALPHA

Posted by OZ8ET on 29 December 2012 - 06:32 AM in Beta Firmware and Drivers

Has OneWire on 4.2 been skiped as a result of the comming of NetduiinoPlus 2???

I still have a bunch of old NetduinoPlus waiting for 4.2 upgrade with OneWire.

What is the status?




#47265 New: Netduino 4.3 SDK and VS2012 support!

Posted by OZ8ET on 16 March 2013 - 10:06 AM in General Discussion

Onewire support is also available on NETMF 4.2 through ToniA's firmware here

There was a problem deploying large software because the watchdog interupted the deploy. ToniA is looking into it and right now I am using the original boot-loader wihich  disables the watchdog.




#45604 New: Netduino 4.3 SDK and VS2012 support!

Posted by OZ8ET on 16 February 2013 - 06:20 AM in General Discussion

Does the 4.3 implementation support OneWire?

 

Will the Gen.1 implementation of 4.3 support OneWire?

 

Netduino has been ignoring OneWire allthough it is an essential part of NETMF and should not be negleted.

 

The argument of saving flash/ram is like removing the wheels from a car beause they take up too much space!

 

I am a litle (very) frustrated waiting for OneWire on 4.2, Gen.1.

 




#34713 Announcing: .NET MF 4.2 upgrade for all Netduino hardware

Posted by OZ8ET on 06 September 2012 - 04:12 AM in General Discussion

I hate to aske - when will OneWire support be available on 4.2? (CW2's version will be fine!) Regards Erik



#34740 Announcing: .NET MF 4.2 upgrade for all Netduino hardware

Posted by OZ8ET on 06 September 2012 - 11:47 AM in General Discussion

Thanks Chris. By the way – are you ever sleeping? – You answer prompt at any time :rolleyes: Thank you. Erik



#47014 Hardware watchdog on Netduino Plus

Posted by OZ8ET on 11 March 2013 - 08:48 AM in Netduino Plus 2 (and Netduino Plus 1)

Having installed the original Secret Lab TinyBoot-thing for fw 4.2, I could upgrade the Firmware to ToniA's version, and I now have another 3 NetduinoPlus version 1 working with Onewire.

Life is good - thanks to ToniA, 

I look forward to a solution to the Watchdog problem, which will be en enhancement.

Regards

Erik




#47266 Hardware watchdog on Netduino Plus

Posted by OZ8ET on 16 March 2013 - 10:28 AM in Netduino Plus 2 (and Netduino Plus 1)

There is a problem using the MF-Deploy tool to change Network configuration on NP Gen1 with this firmware.

It takes foreveer to get the Configuration window to show. 

If I take power off-on, it shows.




#47347 Hardware watchdog on Netduino Plus

Posted by OZ8ET on 18 March 2013 - 07:59 PM in Netduino Plus 2 (and Netduino Plus 1)

Thank you Toni - great job!

Erik




#47290 Hardware watchdog on Netduino Plus

Posted by OZ8ET on 17 March 2013 - 11:03 AM in Netduino Plus 2 (and Netduino Plus 1)

Sorry - has the download a new bootloader? - if so when did you change it? is there any description on how to use?

Thanks again for your great work.

Erik




#47010 Hardware watchdog on Netduino Plus

Posted by OZ8ET on 11 March 2013 - 06:24 AM in Netduino Plus 2 (and Netduino Plus 1)

Thanks ToniA - there is a logic to that. Writing my post, I realised that the difference was the TinyBoot-thing that was not installed in my first attempt and the Watchdog therefore was not enabled. 

I am about to install the original TinyBoot-thing but right now have problem seeing the COM-port in SAM-BA.

This is however another problem that I hopefully will solve soon.

Thanks for quick reply

Erik




#47005 Hardware watchdog on Netduino Plus

Posted by OZ8ET on 11 March 2013 - 05:03 AM in Netduino Plus 2 (and Netduino Plus 1)

Please explain!

 

I installed the firmware (thank you ToniA) and my first attempt on an fault (analog-port) NetduinoPlus 1 worked fine.

Next two other boards were upgraded, and they Work with some small sample programs.

Then I took the program that Works on NetduinoPlus 2 (changed reference and using to NetduinoPlus)but whenever I try to deploy, I get the error: "An error has occured: please check your hardware."

 

Is this a memory problem(Ram or Flash)?

How can I see how much memory is available for my application?

How can I see how much memory my application require to deploy?

 

Thanks in advance

Erik

 

Additional information:

When I upgraded the first (faulty) device, I did not installed the TinyBootLoader (by mistake). I did have som problems with upgrading the firmware, but managed to do it at last.

When I upgraded the other devices, I had the same problems, but realised I had to opgrade the TinyBootLoader. After doing that, the firmware upgrade was ok.

Now the first (faulty) device kan accept the application, but the others makes an error.

 

Device Info from the first (faulty) device:

DeviceInfo:

HAL build info: 4.2.0.0, Netduino Plus (v4.2.0.1) by Secret Labs LLC [CW2 mod]

OEM Product codes (vendor, model, SKU): 34, 177, 4097

Serial Numbers (module, system):

00000000000000000000000000000000

0000000000000000

Solution Build Info: 4.2.0.0, Netduino Plus (v4.2.0.1) by Secret Labs LLC [CW2 mod]

AppDomains:

default, id=1

Assemblies:

mscorlib,4.2.0.0

Microsoft.SPOT.Native,4.2.0.0

Microsoft.SPOT.Hardware,4.2.0.0

Microsoft.SPOT.Net,4.2.0.0

System,4.2.0.0

Microsoft.SPOT.Hardware.SerialPort,4.2.0.0

Microsoft.SPOT.IO,4.2.0.0

System.IO,4.2.0.0

Microsoft.SPOT.Hardware.PWM,4.2.0.1

Microsoft.SPOT.Hardware.OneWire,4.2.0.0

SecretLabs.NETMF.Diagnostics,4.2.0.0

SecretLabs.NETMF.Hardware.Netduino,4.2.1.0

Microsoft.SPOT.Graphics,4.2.0.0

SecretLabs.NETMF.IO,4.2.0.0

Easyweb,2.2013.310.1337

SecretLabs.NETMF.Hardware,4.2.0.0

 

Device Info from one of the other (not working) devices:

 

DeviceInfo:

HAL build info: 4.2.0.0, Netduino Plus (v4.2.0.1) by Secret Labs LLC [CW2 mod]

OEM Product codes (vendor, model, SKU): 34, 177, 4097

Serial Numbers (module, system):

00000000000000000000000000000000

0000000000000000

Solution Build Info: 4.2.0.0, Netduino Plus (v4.2.0.1) by Secret Labs LLC [CW2 mod]

AppDomains:

default, id=1

Assemblies:

mscorlib,4.2.0.0

Microsoft.SPOT.Native,4.2.0.0

Microsoft.SPOT.Hardware,4.2.0.0

Microsoft.SPOT.Net,4.2.0.0

System,4.2.0.0

Microsoft.SPOT.Hardware.SerialPort,4.2.0.0

Microsoft.SPOT.IO,4.2.0.0

System.IO,4.2.0.0

Microsoft.SPOT.Hardware.PWM,4.2.0.1

Microsoft.SPOT.Hardware.OneWire,4.2.0.0

SecretLabs.NETMF.Diagnostics,4.2.0.0

SecretLabs.NETMF.Hardware.Netduino,4.2.1.0




#43169 Netduino Plus 2 Native OneWire Temp Sensor

Posted by OZ8ET on 11 January 2013 - 04:14 PM in Netduino Plus 2 (and Netduino Plus 1)

For reference - her is my OneWire Engine using Netduino Plus 2 and native OneWire. (it may not run without modifications as it is part of my home automation controller.).

The engine runs in a loop and maintain 2 tables - one for DS1820 and one for DS2438 as these are the once i use.

All use of the data from the devices, are retrieved from these tables.

 

I have used a similar module on Netduino Plus (ver.1) but with the use of CW2's implementation of OneWire. This requires the special firmware and is only availalbe on NETMF 4.1.

 

using System;using System.Collections;using System.Threading;using Config;using Microsoft.SPOT;using Microsoft.SPOT.Hardware;namespace EPD{	static class owCommands	{		public const byte SkipRom = 0xCC;		public const byte MatchRom = 0x55;		public const byte Convert1820 = 0x44;		public const byte ReadScratchpad = 0xBE;		public const byte CopyScratchpad = 0x48;		public const byte WriteScratchpad = 0x4E;		public const byte RecallMemory = 0xB8;		public const byte ConvertT = 0x44;		public const byte ConvertV = 0xB4;	}	static class OneWireExtension	{		public static bool isOwAddr(string parm)		{			if (parm.Length != 16) return false;			for (int i = 0; i < 16; i++)			{				bool ishex = (((parm[i] >= '0') & (parm[i] <= '9')) | ((parm[i] >= 'A') & (parm[i] <= 'F')) | ((parm[i] >= 'a') & (parm[i] <= 'f')));				if (!ishex) return false;			}			return true;		}		const string hexChar = "0123456789ABCDEF";		public static string AddrString(this byte[] buf)	//	{ 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF } converts to 'FECDAB8967452301'		{			string s = string.Empty;			for (int i = 0; i < buf.Length; i++) s += buf[buf.Length - i - 1].toHex();			return s;		}		public static byte[] AddrBytes(this string s)	//	'0123456789ABCDEF' converts to { 0xEF, 0xCD, 0xAB, 0x89, 0x67, 0x45, 0x23, 0x01 }		{			int j = s.Length;			byte[] b = new byte[(j + 1) >> 1];			for (int i = 0; i < j; i++)			{				int ir = b.Length - (i >> 1) - 1;				int x = hexChar.IndexOf(s.ToUpper()[i]);				b[ir] = ((i & 1) == 0) ? (byte)(x << 4) : (byte)(b[ir] | (byte)x);			}			return b;		}		public static int inList(this ArrayList ar, string addr)		{			for (int i = 0 ; i< ar.Count; i++)				{ if ((ar[i] as byte[]).AddrString() == addr) return i;  }			return -1;		}		public static string getLocation(string addr)		{			//string place = HttpClient.webGet("http://palsbo.net/getLocation.php?addr=" + addr);			//if (place != "") Ini.setValue(addr, place);			//return place == "" ? Ini.getValue(addr, "(undefined)") : place;			return Ini.getValue(addr, "(undefined)");		}	}	class OneWireEngine : IDisposable	{		static OneWire core;		public static bool Pause = false;		private static bool ready = false;		public OneWireEngine(OutputPort _core)		{			core = new OneWire(_core);			ds1820.dev.Clear();			new Thread(Start).Start();			while (!ready) { Thread.Sleep(200); }			Debug.Print("OneWire Started");		}		public void Dispose() { GC.SuppressFinalize(this); }		public static void Start()		{			while (true)			{				core.TouchReset();				core.TouchByte(owCommands.SkipRom);				core.TouchByte(owCommands.Convert1820);				Thread.Sleep(750);				var devs = core.FindAllDevices();				lock (ds1820.dev) foreach (ds1820.Device d in ds1820.dev) { if (devs.inList(d.Addr) < 0) ds1820.dev.Remove(d); }				lock (ds2438.dev) foreach (ds2438.Device d in ds2438.dev) { if (devs.inList(d.Addr) < 0) ds2438.dev.Remove(d); }				foreach (byte[] _Rom in devs)				{					string addr = _Rom.AddrString();					if (addr.Substring(14) == "10")					{						double Temp = get1820(_Rom);						int index = ds1820.inList(addr);						if (index < 0)						{							string Place = OneWireExtension.getLocation(addr);							ds1820.dev.Add(new ds1820.Device(addr, Temp, Place));						}						else						{							ds1820.setTemp(index, Temp);						}					}					if (addr.Substring(14) == "26")					{						double Temp = 0.0;						double Current = 0.0;						double Volt = 0.0;						int index = ds2438.inList(addr);						if (index < 0)						{							init2438(_Rom);							get2438(_Rom, ref Temp, ref Current, ref Volt);							string Place = OneWireExtension.getLocation(addr);							ds2438.dev.Add(new ds2438.Device(addr, Temp, Current, Volt, Place));						}						else						{							get2438(_Rom, ref Temp, ref Current, ref Volt);							ds2438.setData(index, Temp, Current, Volt);						}					}					ready = true;					Thread.Sleep(2000);				}			}		}		public static void WriteBytes(byte[] data)		{			foreach (byte B in data) { core.TouchByte(B); }		}		public static void ReadBytes(byte[] buf)		{			for (var i = 0; i < buf.Length; i++) buf[i] = (byte)(core.ReadByte());		}		public static void Match(byte[] addr)		{			core.TouchReset();			core.TouchByte(owCommands.MatchRom); //match rom			WriteBytes(addr);		}		private static double get1820(byte[] _Rom)		{			Match(_Rom);			core.WriteByte(owCommands.ReadScratchpad);			byte[] buf = { 255, 255, 255, 255, 255, 255, 255, 255, 255 };			ReadBytes(buf);			return (float)((short)((buf[1] << 8) | buf[0]) >> 1) + (float)(buf[7] - buf[6]) / (float)buf[7] - .25;		}		private static void init2438(byte[] _Rom)		{			const byte IAD = 0x01;			const byte CA = 0x02;			const byte EE = 0x04;			//const byte AD = 0x08;			const byte Page0 = 0x00;			const byte Ctrl = IAD | CA | EE;			var buf = new byte[9];			Match(_Rom);			WriteBytes(new byte[] { owCommands.WriteScratchpad, Page0, Ctrl });			Match(_Rom);			WriteBytes(new byte[] { owCommands.ReadScratchpad, 0x00 });			ReadBytes(buf);			Match(_Rom);			WriteBytes(new byte[] { owCommands.CopyScratchpad, 0x00 });			while (core.ReadByte() != 0xFF) { };		}		private static void get2438(byte[] _Rom, ref double Temp, ref double Current, ref double Volt)		{			var buf = new byte[9];			Match(_Rom);			core.WriteByte(owCommands.ConvertT);			while (core.ReadByte() != 0xFF) { };			Thread.Sleep(10);			Match(_Rom);			core.WriteByte(owCommands.ConvertV);			while (core.ReadByte() != 0xFF) { };			Thread.Sleep(10);			Match(_Rom);			WriteBytes(new byte[] { owCommands.RecallMemory, 0x00 });			Match(_Rom);			WriteBytes(new byte[] { owCommands.ReadScratchpad, 0x00 });			ReadBytes(buf);			Temp = (double)((buf[2] << 8) + (buf[1])) / 256;			Volt = (double)((buf[4] << 8) + (buf[3])) - 224; // / 100;			//Volt = Volt / 1.75672;			Current = (double)((Int16)(buf[6] << 8) | (Int16)buf[5]);		}	}	class ds1820	{		public class Device		{			public string Addr { get; set; }			public string Place { get; set; }			public double Temp { get; set; }			public Device(string addr, double temp, string place = null)			{				Addr = addr;				Temp = temp;				if (place == null) Place = Ini.getValue(Addr, "(undefined)");				else Place = place;			}		}		public static int inList(string addr)		{			for (int i = 0; i< dev.Count; i++) { if ((dev[i] as Device).Addr == addr) return i; }			return -1;		}		public static string Addr(int i) { return (dev[i] as Device).Addr; }		public static string Place(int i) { return (dev[i] as Device).Place; }		public static void Place(int i, string Place) { (dev[i] as Device).Place = Place; }		public static double Temp(int i) { return (dev[i] as Device).Temp; }		public static void setTemp(int index, double Temp) { (dev[index] as Device).Temp = Temp; }		public static ArrayList dev = new ArrayList();		public static int Count { get { return dev.Count; } }		public class InUse		{			static string _InUse;			public static int Index			{				get				{					for (int i = 0; i < dev.Count; i++) { if (Addr(i) == _InUse) return i; }					if (dev.Count > 0) return 0; else return -1;				}			}			public static string Addr			{				get { return Index < 0 ? "" : Addr(Index); }				set				{					_InUse = value.ToUpper();					Ini.setValue("DS1820inUse", _InUse);				}			}		}	}	class ds2438	{		public class Device		{			public string Addr { get; set; }			public string Place { get; set; }			public double Temp { get; set; }			public double Volt { get; set; }			public double Current { get; set; }			public Device(string addr, double temp, double current, double volt, string place = null)			{				Addr = addr;				Temp = temp;				Current = current;				Volt = volt;				if (place == null) Place = Ini.getValue(Addr, "(undefined)");				else Place = place;			}		}		public static int inList(string addr)		{			for (int i = 0; i<dev.Count; i++) { if ((dev[i] as Device).Addr == addr) return i; }			return -1;		}		public static ArrayList dev = new ArrayList();		public static int Count { get { return dev.Count; } }		public static string Addr(int i) { return (dev[i] as Device).Addr; }		public static string Place(int i) { return (dev[i] as Device).Place; }		public static void Place(int i, string Place) { (dev[i] as Device).Place = Place; }		public static double Temp(int i) { return (dev[i] as Device).Temp; }		public static double Current(int i) { return (dev[i] as Device).Current; }		public static double Volt(int i) { return (dev[i] as Device).Volt; }		public static void setData(int index, double Temp, double Current, double Volt) { 			(dev[index] as Device).Temp = Temp; 			(dev[index] as Device).Current = Current; 			(dev[index] as Device).Volt = Volt;		}		public class InUse		{			static string _InUse;			public static int Index			{				get				{					for (int i = 0; i < dev.Count; i++) { if (Addr(i) == _InUse) return i; }					if (dev.Count > 0) return 0; else return -1;				}			}			public static string Addr			{				get { return Index < 0 ? "" : Addr(Index); }				set				{					_InUse = value.ToUpper();					Ini.setValue("DS2438inUse", _InUse);				}			}		}	}}

(this code block display needs to be fixed!!!)

 




#50474 Expert tip: switching between WinUSB and MFUSB drivers

Posted by OZ8ET on 14 June 2013 - 03:58 AM in General Discussion

So far users seem to be having a really great experience with the new WinUSB drivers.

A handful of users running under VMs have reported a preference for the legacy MFUSB drivers. Here's a quick set of instructions on how to force your 4.2 Netduino or Netduino Plus to use the MFUSB drivers.

To manually switch to MFUSB (SpotUSB) drivers -- for special cases


    [*]Open Device Manager. Under USB controllers, find "Netduino"
    [*]Right-click on the Netduino and click "Update driver software".
    [*]Click the "Browse my computer for driver software" option.
    [*]Click the "Let me pick from a list of device drivers on my computer" option
    [*]If presented with device types, choose "All devices"
    [*]Press the "Have Disk..." button.
    [*]Select the ini file in folder "C:Program Files (x86)Secret LabsNetduino SDKDriversMFUSB"
    [*]Complete the wizard. It may warn you about a mismatch, but accept the mismatch anyway. This is for VID/PID override.
    [*]Your Netduino will now be using the legacy MFUSB (SpotUSB) drivers instead.
    [/list]If you want to switch back to the WinUSB drivers, you can repeat this process...selecting the WINUSB driver folder in step 7 instead.

    NOTE: if you plug your Netduino into a different USB port, you may need to repeat the above steps once for that port.

    Chris

     

This driver is not available in the lib for 4.3 ???




#33982 HttpListener does not respond

Posted by OZ8ET on 21 August 2012 - 05:08 AM in General Discussion

Hi
I use a socket-based server and get the same problem. It is very easy to reproduce. Just hit the F5 on the browser a couple of times and you get the Socket Exception.

With the socket-based server, it looks like it recovers after the exception - I have not tried it for a long perode of time yet.

This is what it looks like:
		public HttpSession(int Port = 80, WebRequest userRequester = null)
		{
			_userRequester = userRequester;
			_socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
			_socket.Bind(new IPEndPoint(IPAddress.Any, Port));
			new Thread(_Listen).Start();
		}

		private void _Listen()
		{
			_socket.Listen(10);
			while (true)
			{
				try
				{
					using (Socket client = _socket.Accept())
					{
						int _requestSize;
						byte[] _buffer;
						int _amountRead;
						Request _request;

						_requestSize = client.Available;
						_buffer = new byte[Settings.bufLen];
						_amountRead = client.Receive(_buffer, Settings.bufLen, SocketFlags.None);
						_request = new Request(client, _buffer);
						_buffer = null;
						if (_userRequester != null) _userRequester(_request); else _defaultRequester(_request);
						_request = null;
						Debug.GC(true);
					}
				}
				catch (Exception ex) { 
					Debug.Print(ex.Message);
					//PowerState.RebootDevice(false, 1000); 
				}
				Thread.Sleep(10);
			}
		}

The latest change I made was to move the statement "_socket.Listen(10);" from the sub HttpSession() to the sub _Listen().
For some unexplainable (for me!) reasoen, it made the thing recover after the exception rather than stopping the server.

This is with 4.1 - when (if!) 4.2 is relesed and when (if!) OneWire becomes available for 4.2, I look forward to see if this has been solved in 4.2.

Regards
Erik



#32365 Is this the end of NetduinoPlus?

Posted by OZ8ET on 20 July 2012 - 03:52 PM in Beta Firmware and Drivers

I find CW2's implementation very reliable. I use a digital port directly with a 1K8 resister to +5V - it drives about 5 meter with many drops and no problems. Implementing One-wire devices is not dificult. Erik



#32325 Is this the end of NetduinoPlus?

Posted by OZ8ET on 20 July 2012 - 06:31 AM in Beta Firmware and Drivers

Sorry to be a bit negative. My previous exitement for NetduinoPlus has slowly turned into a lot of frustrations. I may be stupid, but I based my project on Onewire, and maybe I am the only one left en the world using it. After asking around a lot in the forum, I found CW2's very nice implementation which I still use with Firmware version 4.1.1. 4.1 had other problems (OutOfMemoryExeption in Stremwriter) and I have been looking forward to version 4.2 in the hope that this problem was solved. I was promised that there would be a 'speciaol verion' of 4.2 with onewire support, but after the introduction of NetduinoGo, it looks like no one cares about NetduionoPlus anymore. I am about to give up on this forum. My requests are no more answered and it is not even possible to find them searching my own comments (sometime I can find them by searching specific text). It is not my intention to be destructive, but I think my life with NetduinoPlus is running into a deadend.



#32379 Is this the end of NetduinoPlus?

Posted by OZ8ET on 20 July 2012 - 06:58 PM in Beta Firmware and Drivers

One thing is theory - annoter practise. anyway - the issues were onewire support ón 4.2 and OutOfMemoryExeption with streamwriter!



#32373 Is this the end of NetduinoPlus?

Posted by OZ8ET on 20 July 2012 - 05:03 PM in Beta Firmware and Drivers

I have no doubt about the good realization of CW2, nor in your bona-fide...the problem is exactly what you write: the impedance is not balanced, thus the "reliability" is just a statistical performance of your implementation.
Basically, you have just one (?) resistor as pull-up by the Netduino side (or the other).
First off, when the line is pulled down the impedance is almost zero Ohms, but when the line is left floating the actual impedance is 1.8k.
Secondly, probably your 5mt wiring is short enough to avoid reflections, otherwise an high-impedance (by the device side) would have a mirror-effect for the high frequencies. You know, any edgy wave is composed as very high frequencies.
Thirdly, I suppose your wiring is a shielded cable, or either your wires run along a noiseless environment. If not, your signal would be plenty of undesired noise, spikes, and whatever else.

It's just a clarification, because many users are asking that, but the long wiring is often an hard task to solve.
Cheers


Sorring - the correcte lenet is 50 meters (150ft). It was an erfor in writing



#32371 Is this the end of NetduinoPlus?

Posted by OZ8ET on 20 July 2012 - 04:26 PM in Beta Firmware and Drivers

I am not sure if the same issue is occurring that I had on my project but I was getting the same error message writing to the SD card.

In my project I have 6 sensors that are being polled up to 3 times a second then that data is written to 6 different log files using the same basic method as you.

I was getting this same error and it was due to trying to write the data too fast (or I assume that was the case). So I put a few Thread.Sleep(1) or Thread.Sleep(10) in certain places to allow for catch up and completion of the file create/close and write/close. This worked and it has never thrown an error again after running hundreds of hours now.


Thanks Dave - I tried this but with no luck.:)

Erik



#34582 Is this the end of NetduinoPlus?

Posted by OZ8ET on 03 September 2012 - 05:11 AM in Beta Firmware and Drivers

Your meaning on "watchdog" may be more complicated than mine, but this is how I do it - the simple way:

public static class WatchDog
	{
		const Int32 wdDelay = 1000*60*60*12;
		static Timer wdtimer = new Timer(on_TimerTick, null, wdDelay, 0);

		public static void Reset()
		{
			wdtimer.Change(wdDelay, 0);
		}

		static void on_TimerTick(Object state)
		{
			CLog.LogEvent("Watchdog Rebooting.");
			PowerState.RebootDevice(false, 1000);
		}
	}

The watchdogdelay (wDelay) is her set to 12 hours (100*60*60*12 miliseconds).
The Reset() command sits in a place I want to make sure that I excecute within the 12 hours, and it resets the wDelay counter.
On timeout (_TimerTick) the watchdog write a message to my log, and reboot the device. Simple but effective.

Erik



#32332 Is this the end of NetduinoPlus?

Posted by OZ8ET on 20 July 2012 - 07:15 AM in Beta Firmware and Drivers

Thanks for quick reply Stefan and Chris

I am now using NetduinoPlus_v4.1.1_beta1_CW.NETMF.OneWire-1.0.5.0

I was having problem with I2C because of som problem in firmware but this may have been with 4.1.0-6 - I gave up on I2C because of that.

Now I have probems with StreamWriter.
    #### Exception System.OutOfMemoryException - CLR_E_OUT_OF_MEMORY (4) ####
    #### Message: 
    #### System.IO.StreamWriter::.ctor [IP: 0023] ####
    #### Main.CIni::Save [IP: 0020] ####
    #### Main.Engine::update [IP: 0026] ####
    #### Main.OneWireEngine::onPoll [IP: 01e8] ####
A first chance exception of type 'System.OutOfMemoryException' occurred in System.IO.dll

This is the Code:
		public static void Save()
		{
			try
			{
				Debug.GC(true);
				if (File.Exists(_FileName)) File.Delete(_FileName);
				using (FileStream outFileStream = new FileStream(_FileName, FileMode.CreateNew, FileAccess.Write))
				{
					using (StreamWriter outStreamWriter = new StreamWriter(outFileStream))
					{
						foreach (object Sections in _Sections.Keys)
						{
							outStreamWriter.WriteLine("[" + Sections.ToString() + "]");
							Hashtable keyvalpair = (Hashtable)_Sections[Sections];
							//foreach (object key in keyvalpair.Keys)	outStreamWriter.WriteLine(key.ToString() + "=" + keyvalpair[key].ToString());
							string s = "";
							foreach (object key in keyvalpair.Keys) s += (key.ToString() + "=" + keyvalpair[key].ToString() + '\r');
							outStreamWriter.Write(s);
						}
						outStreamWriter.Close();
					}
					outFileStream.Close();
					_Dirty = false;
				}
			}
			catch (Exception Ex) { Fail.Create("Init Save: " + Ex.Message, 5); }
			Debug.GC(true);
		}

ways to (partly) deal with the problem are:
- spreading "Debug.GC(true);" all over the place in rich quanities.
- NOT making small chunks of date to write, but puttin everything in one string!!!

I can make a small program with only read and write of the file, and it will usually work but as soon as I add other code to it, problems begin.

Erik



#47636 SMTP_Client throws System.ArgumentOutOfRangeException

Posted by OZ8ET on 27 March 2013 - 02:51 PM in Netduino Plus 2 (and Netduino Plus 1)

I have the same problem - is it a v4.2 problem? I cannot get it to accept "IntegratedSocket".

 

I installed toolbox,

included Toolbox.NETMF.NET.SMTP_Client

using Toolbox.NETMF.NET;

 

IntegratedSocket integratedSocket = new IntegratedSocket("<smtp-server>", 587);SMTP_Client client = new SMTP_Client(integratedSocket, SMTP_Client.AuthenticationTypes.Login, "<username>", "<password>");client.Send(message, from, receiver);

?




#47465 DNS request problem in 4.2

Posted by OZ8ET on 22 March 2013 - 06:36 AM in General Discussion

Thanks for good answers.. I did check the router DNS and tested as you suggest emg, but everything works from the PC.

I just don’t understand why it works with an in-LAN DNS??.

 

Maybe it is a problem with the internet provider however. This morning things have changed a bit.

Right now I am able to use my old software again – strange! – I am digging into it.




#47447 DNS request problem in 4.2

Posted by OZ8ET on 21 March 2013 - 05:20 PM in General Discussion

Yesterday my internet provider "upgraded the Network" and after this my NetduinoPlus2 NTP client will not Work.

(It has been working for month before - and before on NetduinoPlus 1.gen for years).

I have isolated the problem to the DNS call:

 

IPEndPoint ep = new IPEndPoint(Dns.GetHostEntry(servername).AddressList[0],123)  

After timeout I get an Socket error exception.

Having messed around for 24 hours, I decided to make an experiment. I installed a DNS server on my Synology fileserver and changed the DNS address in the NETMF program to the Synology DNS.  

This works! – as it use to.

It doesn’t solve the problem, but proves that my program is still working. My conclusion is that there must be a problem/weakness in the METMF/Netduino DNS that makes this protocol more sensitive to deviations than most other equipment (all other equipment works). My internet provider claims that they have no other problems reported.

Does anyone have an explanation? – or maybe an advice?

I tried:

Using DHCP – same problem Using the router as DNS (192.168.1.1) – same problem Using the providers DNS-IP – same problem Using an open DNS (8.8.8.8) – same problem  

Why does it work with a local DNS-server?

Does IP4 – IP6 has something to do with it (Synology also uses IP6)

?????????????????????????????????????????

 




#47549 DNS request problem in 4.2

Posted by OZ8ET on 25 March 2013 - 07:22 AM in General Discussion

In early 4.2 releases there wherer issues with socket (i found this on other threads back in 2011). Have these been solved??

I stille have big problems with latest release.

(This is on NetduinoPlus 1.gen)

 

This is my code (reduced)

 

namespace NetduinoApplication1{	public class Program	{		public static void Main()		{			foreach (string ip in NetworkInterface.GetAllNetworkInterfaces()[0].DnsAddresses)			{ Debug.Print("DNS:" + ip); }			IPEndPoint ep = new IPEndPoint(Dns.GetHostEntry("microsoft.com").AddressList[0], 80);			Debug.Print("Finish");		}	}}

and this is the result I get:

The thread '<No Name>' (0x2) has exited with code 0 (0x0).DNS:8.8.8.8DNS:8.8.4.4A first chance exception of type 'System.Net.Sockets.SocketException' occurred in Microsoft.SPOT.Net.dllAn unhandled exception of type 'System.Net.Sockets.SocketException' occurred in Microsoft.SPOT.Net.dll Uncaught exception The thread '<No Name>' (0x1) has exited with code 0 (0x0).Done.The program '[2] Micro Framework application: Managed' has exited with code 0 (0x0).

even when I establish the EPEndPoint with an IP address, I get problems with socket commands.

	new IPEndPoint(IPAddress.Parse(serverip), 123);	using (Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.Tcp))	{		s.Connect(ep);		byte[] ntpData = new byte[48]; // RFC 2030		Array.Clear(ntpData, 0, 48);		ntpData[0] = 0x1B;		s.SendTo(ntpData,ep);		if (s.Poll(5000000, SelectMode.SelectRead)) { s.Receive(ntpData); }	}

 

 

all help is highly appreciated.

 

Erik





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.