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.

Nobby's Content

There have been 66 items by Nobby (Search limited from 29-June 23)


By content type

See this member's


Sort by                Order  

#37294 Yet another diagnostic question

Posted by Nobby on 16 October 2012 - 11:43 PM in General Discussion

This is a similar thread to the one I posted earlier about free memory. This time I'm looking at writing thread-based diagnostics. Due to the Process class not being relevant for .Net MF, is there a way of getting a list or a count of threads that are in any possible state within the application domain or "process"? Secondly, if I have a stray, unreferenced thread floating around, does the GC gobble it up if it's in a non-idle state or when IsAlive is true?



#30581 Netduino Reset Button Issues

Posted by Nobby on 12 June 2012 - 08:05 AM in Netduino Plus 2 (and Netduino Plus 1)

Hey guys, I'm having random issues with my PC rebooting after pressing the reset button on the Netduino(Both regular and Plus versions). I usually pin these kinds of things on the USB 5V rail being shorted(high current) to ground from faulty devices and sometimes from plugging USB devices in and out of chassis USB ports(crappy ones). I've looked at the system schematic and can see that the switch is fairly isolated from VBUS. The issues occurs maybe once every 20 resets or so. Haven't had a chance to probe the board yet. Anyone else have any insights to the problem?



#38170 Low Latency Wireless Comms

Posted by Nobby on 29 October 2012 - 10:39 AM in General Discussion

You're going to find that most wireless comms use a burst approach for data transfer. The hardware protocol will usually try to send a data burst of a minimum to maximum size and at deterministic intervals. This is because free-space(air) is an indeterministic transmission medium which causes time varying scew in the carrier and data(phase distortion) and all sorts of other nasties. It places a constraint on the continuous length of time you can transmit data before the probability of data error becomes too high. So essentially synchronised, continuous data streams between wireless devices is impossible without substantial overhead. There is also a fair amount of overhead for sending/receiving data in general, especially with multiple devices which places a constraint on optimal minimal packet size as well as burst interval. Having said all of this, it's still quite possible to achieve a ping of under 5ms. I have a wireless bridge in one of my outdoor systems which is line-of-sight and spans 400m with a ping of no more than 1ms. -It runs at 5GHz instead of the 2.45GHz band -The devices don't use a proprietary protocol -They have adjustable high-gain antennae and high base power level -Can operate at up to 75km appart Those are the kind of extents you have to go to in order to meet requirements. You're going to have to dodge 2.45GHz devices unless you know your operating environment is going to be well shielded from other terrestrial noise. If you live in america, they're laws permit 2-3 times the maximum broadcast power of 2.45GHz transmitters than a lot of other countries so your signal-to-noise ratio(SNR) can suffer a lot more increasing overall latency. Once you've got a decent wireless architecture then you can start looking at .Net runtime overheads etc etc.



#32850 Take a dirty picture for me

Posted by Nobby on 28 July 2012 - 01:48 PM in Netduino Plus 2 (and Netduino Plus 1)

sorry, the topic is not going to be that interesting. :lol:

I've got my NP hooked up to a serial camera and i want to take a pic and then push it on a webserver.

By the looks of it im getting a outofmemory exception. Is there any efficient way of do this with out using lots of memory?


Is the camera data compressed into JPEG or is it full-frame RGB/YUV pixel data? Either way, image resolution of most cameras these days will exceed the runtime RAM of the Netduino. To test the full functionality of your project(i.e. take pic, get data from camera, post to webserver), try and set the camera to its lowest resolution if possible.

If you don't have those kind of configuration options for your camera, you'll have to go the whole-hog from the beggining. Adopt a block-data processing model. Take the picture and read small amounts of data from the camera at a time. You'll have to send or store(SD card) that data then leave it for the GC to pick up or force the GC to free the memory. Read the next block of data, rinse and repeat.

Are you using a POST method to a web URL? If so, you can define the Content-Length HTTP header property before you stream the data to the webserver(only if you know the datasize of the image before-hand). This will allow you to block process the data, as long as you don't exceed the webserver's timeout. If you can't determine the size of the pic data before you read it from the camera, stream it to a file on an SD card in the Netduino and then read the file-size.

Good luck



#34082 InterruptPort, NativeEventHandler & data1

Posted by Nobby on 23 August 2012 - 03:25 AM in General Discussion

I'm putting together a simple class to handle multiple port interrupts through a single event handler. .Net microframework says that data1 can be the port number. I setup an experiement to evaluate data1 with two different buttons. I used D6 & D10(PWM1 & PWM3). PWM3 came up as data1=54 and PWM1 came up as data1=52. Comparing those to the Netduino schematic, the difference in the two numbers matches the difference in pin numbers(diff of 2) but the numbers don't match the schematic pinout. PWM3 is 67 and PWM1 is 65. Regardless of whether this is an error or not, I still need to build a relationship table. I would like to know if these are going to change in the future though for whatever reason. Is there an error in the designation of pin numbers/labelling on the ARM7 netduino schematic?



#34083 InterruptPort, NativeEventHandler & data1

Posted by Nobby on 23 August 2012 - 03:39 AM in General Discussion

Nevermind, I figured out that I can just use the NetduinoPlus.Pins struct.



#32675 Does Netduino Software software getting cleared over time?

Posted by Nobby on 26 July 2012 - 12:21 AM in General Discussion

The program is stored in non-volatile Flash memory(EEPROM). I haven't looked the modern longevity but you can expect roughly fifty years of reliable program storage in the device under desirable environmental conditions. Static electricity causing a wipe is a lot less likely with today's microcontrollers but still possible. It's more likely physical damage would occur before program erasure. The only controlled method of non-software executed erasure is from connecting a positive voltage(3.3V+) to the little gold square on the board. This configures the board for firmware operations until you repower the device. I'm not sure if this actually erases the program Flash though.



#36993 Runtime Memory Usage

Posted by Nobby on 10 October 2012 - 11:45 PM in General Discussion

Hey guys, Is there a method to check runtime memory usage and possibly get the total memory of the device through micro framework? With the regular .Net Framework you have to do it through a process object but this doesn't apply to .Net Microframework. I've had a skim through all the namespaces for 4.2 and can't find anything relevant.



#34469 Probelms In Sockets??

Posted by Nobby on 30 August 2012 - 10:28 PM in Netduino Plus 2 (and Netduino Plus 1)

The first thing to change on the PC end is your calls to Socket.Recieve(). Since you aren't specifying how much data to read on each call, it will try to read enough data to fill the array and will block until it does unless

  • You close the socket
  • Have a ReadTimeout value set on the socket

Either way, an exception will be thrown on the PC application. Make the buffer smaller to match the length of the data or provide an amount to read. In your case, the PC application will try to read 1000 bytes all-up.

On the Netduino side of things, I never simply use Socket.Send(). I always tell it was data range to use from the array so that I know I have full control over safe execution. This doesn't mean that the Netduino exception is being caused by this.



#35267 Interfacing netduino with an alarm clock

Posted by Nobby on 15 September 2012 - 08:22 AM in General Discussion

Technically you can do this. The first problem I thought of that would make me abandon the project would be that setting the alarm time would be a pain in the butt. Changes to the time are always relative to the previous alarm time so unless your netduino knows the previous alarm time, it is impossible to set a new alarm time. Unless of course you reset the power to the clock before the alarm time is set. Unfortunately, you'd have to setup the clock time as well as the alarm time. Secondly, you might have rate and synchronisation issues. For example, you know that if you mash the buttons as fast as you can, the clock will only change the values so quickly. The clock circuitry most likely polls for button presses as well and it's likely that you will occasionally have an adjustment pulse missed and the time you set will be incorrect. These are problems that I came up with before even considering the rediculous amount of electrical interfacing you need to do with the clock. If you're doing it for fun or learning, I reckon it would be great but practically, it would be a nightmare.



#32652 SD card trouble

Posted by Nobby on 25 July 2012 - 08:20 AM in Netduino Plus 2 (and Netduino Plus 1)

Your file creation and streamwriter code looks fine. The code will throw an exception though if

  • The file test.txt already exists on the SD card
  • The name of the root directory isn't \SD\

It may seem long-winded but I always query

VolumeInfo[] drives = VolumeInfo.GetVolumes();

It serves to ensure there is an SD card inserted(there are also other ways to check this). The objects also indicate the name of the root directory.

I haven't looked up the reference to Directory.GetCurrentDirectory for Micro Framework. It's standard usage is to return the current working directory which only applies to application domains running normal .Net Framework applications on a PC etc. Since the Netduino executes code from Flash rather than a virtualised application domain run from media, it doesn't use working directories.



#32165 Netduino Plus Network Interface Controller

Posted by Nobby on 18 July 2012 - 02:33 AM in Netduino Plus 2 (and Netduino Plus 1)

Not sure if this is an issue or not but I'm looking at trying to get around a certain type of behaviour with the NIC. -If I boot/power up the device with the netduino connected to a switch/router everything is fine -If I boot/power up the device with the netduino initially unplugged, I run into issues. -Currently using static IP Plugging the device into a network after startup negotiates fine with the hardware. I cannot ping the netduino at its IP address though. I can ping it if I hit the reset button or re-power the netduino My software binds a listener which constantly throws socket exceptions when calling Socket.Accept() while it is disconnected(as expected). When the exception occurs, I close the listener, rebind the socket(using IPAddress.Any) and retry to called Socket.Accept(). When I plug the netdunio into a switch, the socket rebinds and stops throwing socket exceptions from calls to Accept(). I still can't ping the Netduino or make a TCP connection to the device unless I reboot/re-power the netduino with the network cable plugged into a switch. I've tried various things such as reseting the static IP settings once the netduino is plugged into a switch, before and after binding the listener to 0.0.0.0:portNum. Anyone else had similar behaviour?



#38704 Visual Studio 2012 & Netduino Projects

Posted by Nobby on 08 November 2012 - 06:00 AM in General Discussion

With the release of the .Net MF 4.3 Beta, we've all had the pleasure of Netduino development under VS2012. Since there isn't a Netduino SDK for 2012 yet, you can't make new Netduino, Netduino+ etc projects under VS2012. Are there registry hacks which are fairly painless to create Netduino project templates for VS2012?



#38284 Tenda 3G611R+ 3G router issues

Posted by Nobby on 31 October 2012 - 09:19 AM in Netduino Plus 2 (and Netduino Plus 1)

Does the call to s.Send() block indefinitely or does an exception get thrown? It's odd that the router permits the outbound socket connection but not the underlying data. I'm 50/50 about Tenda. I've bought quite a few different products of theirs. I use a 16 port gigabit switch at home but I've bought wireless gear as well in the past and thrown it in the bin out of frustration.



#37011 Runtime Memory Usage

Posted by Nobby on 11 October 2012 - 04:32 AM in General Discussion

Hi Nobby,

Try:
int freemem = Microsoft.SPOT.Debug.GC(...);

You can optionally pass in true, forcing a garbage collection, giving you the full amount of memory available.

Chris


That worked a treat, thanks Chris :o)



#32642 Netduino Plus Network Interface Controller

Posted by Nobby on 25 July 2012 - 02:23 AM in Netduino Plus 2 (and Netduino Plus 1)

I finally found some time to create analysis tools to investigate NIC behaviour. The initial results were fairly conclusive.

---Netduino Software---

A threaded socket listener accepting TCP connection requests. It's a non-blocking approach utilising Socket.Poll to check for pending connection requests before calling Socket.Accept. Detection of NIC being up or down is monitored using the WinSock socket exception code 10050. Once the network status is up, I tried two methods that involve either retaining the existing listening socket object or recreating the listening socket.

  • Netduino is using static IP and gateway (192.168.1.95, 255.255.255.0, 192.168.1.1)
  • Experiment involved starting a debugger on the netduino with the network cable plugged in or unplugged
  • A separate thread does a Debug.Print of the current IP address and default gateway of the Netduino every three seconds

---PC Software---

A simple app which allows you to enter an ip address and port number. A "Connect" button which attempts to create a TCP connection to the remote host at the defined address and port. A "Ping" button which broadcasts an IMCP echo request to the defined address. All connection and ping results displayed in a listBox.

---Results---

Starting the debugger with the network cable initially plugged in produces positive results. The device is pingable and TCP connections can be made. Unplugging the device from the network results in WinSock 10050 exceptions on Socket.Poll as expected. Plugging the Netduino back into the network and recreating the listener socket resumes desirable behaviour. The device is pingable and TCP connections can be made.

Starting the debugger with the network cable initially unplugged is where it all goes wrong. The frequently displayed IP address of the Netduino is correct. After any length of time, the netduino is plugged in, all related link/activity etc lights come on. WinSock 10050 errors cease to occur when calling Socket.Poll as expected. However, the device is unpingable and TCP connections cannot be made to 192.168.1.95. No amount of time changes the conditions of connectivity without restarting the device.

Is anybody familiar with the inner workings of the .Net Microframework runtime startup in the Netduino and how NICs are affected by it? Fortunately, the only vulnerability of the product I'm developing is that it must be plugged in and active at both ends of the network cable before the product is powered up. I would like that to not be a requirement.

This thread http://forums.netdui...?showtopic=3420 alerted me that sometimes the Netduino needs to be rebooted. Is there any other functionality that isn't as brutal as a reboot?

I'm now using Socket.Poll to detect the initial NIC connection state and rebooting the device upon the NIC status changing to up, if it was originally down. I can't exactly do this if the product is in the middle of being used.



#32510 Netduino Plus Network Interface Controller

Posted by Nobby on 23 July 2012 - 08:02 AM in Netduino Plus 2 (and Netduino Plus 1)

I saw this issue with an attached debugger in this thread http://forums.netdui...tartup-problem/ .



#32090 GPS shield odd results. Novice user.

Posted by Nobby on 17 July 2012 - 06:30 AM in Netduino Plus 2 (and Netduino Plus 1)

I use the DFRobot GPS shield based on the UBlox GPS unit but interfacing is the same. The first change you'll want to make is how you read the data. The GPS unit will constantly send NMEA and UBX packets to you. It could also send packets of other GPS protocols. With UBX in particular, the packets start with a deterministic pattern.

Sometimes the data can contain characters which are non punctuation, letters, numbers etc because certain bytes are acutally bit-fields of configuration and satelite data. String constructors might return NULL based on these non-alpha numeric characters. Instead, make a string, use a for/foreach loop and append each byte onto the string but cast it as a char.

change this
Debug.Print(new string(Encoding.UTF8.GetChars(buffer)));

to this
string dataString = "";
foreach(byte b in buffer) dataString+=(char)b;
Debug.Print(dataString);

Good luck



#38211 Wireless contact switch

Posted by Nobby on 30 October 2012 - 12:31 AM in General Discussion

There's no protocols(in the traditional sense) or encryption with devices like this. They're brutally simple. The three key bits of info there are carrier freq, freq tolerance and modulation type. The modulation type is ASK. Ideally you'd use an ASK demodulator with a center frequency of 319.5MHz(the carrier freq) which will give you the analog envelope as an output. You then process the signal here which could be nasty. The device obviously transmits a serial/unqiue ID number but the PDF indicates that you need to hook it up to an ITI security panel(whatever that is). You'd be hard-pressed getting the information to interpret the signals sent by the device but if you've got a good CRO/scope and a lot of time, you could figure it out.... or just find a generic product if they exist.



#32851 Ping works for 2min that quits working (4.2 RC5)

Posted by Nobby on 28 July 2012 - 01:51 PM in Netduino Plus 2 (and Netduino Plus 1)

Have you tried to power the Netduino with a DC power pack? Does the light turn off with a power pack plugged in and no USB?



#32163 Multiple questions from someone thinking about picking up a netduino

Posted by Nobby on 18 July 2012 - 02:21 AM in General Discussion

The most notable contrast between Netduino and Arduino is that the Netduino's arcitecture is based around the Microsoft .Net Microframework where as Arduino's are programmed with machine-code(C code interpreted then compiled) targetted at the cpu instruction set of the Arduino. Essentially the Netduino and Arduino are the same connectivity-wise, they just have different development platforms. The biggest issue you are having with LCD stuff usually stems from bandwidth limitations of the bus technology you use to communicate with the LCD. For example -I2C/TWI is limited to 100kHz -SPI is somewhat similar -7/11 Pin interfaces to LCD controllers. These are usually text LCDs though -UART/TTL/RS232 have good bandwidth but devices are rare Most LCDs are SPI or I2C/TWI. For large numbers of pixels, clearing a screen, pixel-by-pixel, is slowed down by the bandwidth of your interface. That's why most devices have a single instruction for clearing a screen with an optional colour. If you need to do large rectangle fills etc, it's painfull. You could look at the Gameduino which is designed for doing complex/detailed video operations on a severely band-limited interface. It only has a VGA output on it though and it's pretty much useless for anything but making video games. I tried to use one for displaying a GUI but the API is too high level to do simple things outside the scope of sprite rendering. Another option to consider is the emergence of many colour LCD controllers. They're intermediate devices that have larger bandiwdth but consume quite a few pins on the AVR. With the way these consumer development platforms are diversifying these days, you have so many options. Unfortunately, unless you have experience with the devices and their APIs, it takes a very long time to find what you want through research without having to spend money. In your case, I could heavily recommend the Netduino plus for your LCD, SD card and other needs. The only problem is you might find .Net framework/C# development a pain in the arse compared to AVR studio, Codevision AVR or some other ANSI C compiler and IDE.



#32184 StreamReader detect end of file

Posted by Nobby on 18 July 2012 - 11:07 AM in Netduino Plus 2 (and Netduino Plus 1)

another nice trick is the following

string fileLine = "";
while((line=sr.ReadLine())!=null)
{
     Debug.Print(fileLine);
}
sr.Close();



#32491 Multiple questions from someone thinking about picking up a netduino

Posted by Nobby on 23 July 2012 - 01:50 AM in General Discussion

Having a look at that LCD, it is indeed a parallel interface and requires a butt-load of pins. It does afford the ability to drive the display faster than TWI/SPI. There are available devices called LCD Backpacks. They're designed to connect to parallel LCDs like this and you can interface with the backpack via UART/TWI/SPI depending on the archtecture of the backpack. The other option you have is something like Codevision AVR. I starting using this about ten years ago as it was probably the best prototyping IDE around at the time(productivity-wise). They have lots of advanced LCD libraries now and broad support for various LCD models. The code generation engine can create a base-code project for you to get started quickly with your LCD. You can designate the ports you want to use on the AVR either for direct connection or connection via a backpack. They even have an IDE for creating bitmaps, controls and icons to embed in your projects. Even though I still use Codevision AVR for various small things, I've moved all prototyping for commercial products to Netduino products. It's cheaper for me to buy netduino and spend a fraction of the time developing. You might want to check out the Netduino Go as well. They designed it with the purpose of exposing more connectivity and memory than the Netduino Plus. Once they have developed the RJ-45 module I'll most likely move to that platform.



#32651 start multi-projetc's on netduino

Posted by Nobby on 25 July 2012 - 08:04 AM in Netduino Plus 2 (and Netduino Plus 1)

If you mean you would like to create projects which are code libraries you would like to use in other projects, that's pretty easy.

  • Add a new project to solution
  • Choose "Class Library" instead of "Netduino Plus Application" under Visual C# -> Micro Framework. This what you mean by DLL?
  • Write the code in your class library
  • Go to your Netduino Plus application project, choose to add a reference
  • In the projects tab, choose your new class library as the reference
  • You can now use your class library in the Netduino Plus application!!



#32970 Ping works for 2min that quits working (4.2 RC5)

Posted by Nobby on 01 August 2012 - 07:24 AM in Netduino Plus 2 (and Netduino Plus 1)

I hadn't up until you suggested it. I thought I could power it with simply the USB connection. Now that I have added the external power source, the board seems to behaving as expected.

Is there a 'theory of operation' or any documentation around how the systems works together? I seems like the blue led on the board corresponds to the time when the bootloader is available vs when the CLR is running.

Thank you for the suggestion!


According to the Netduino schematic, the USB socket is essentially electrically and logically isolated from the button and LED. My best guess is that you possibly have the Netduino plugged into a standard USB port and there is some sort of power management policy under windows or possibly your BIOS that is cutting power to the Netduino for being idle or some other reason.

Although, I've never come across this problem before except with some models of USB powered hard disc drives. I also connect my Netduino to my PC via a self-powered USB hub and I also have no power management enabled under windows except for turning my screen off after 10 minutes(Performance power profile with hibernation/sleep disabled).




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.