Spiked'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.

Spiked's Content

There have been 129 items by Spiked (Search limited from 05-June 23)


By content type

See this member's


Sort by                Order  

#60275 How to avoid 'static'

Posted by Spiked on 28 September 2014 - 03:43 PM in Netduino 2 (and Netduino 1)

I'm lazy, I hate typing more than I have to. As a result, I have adapted a method that avoids having to add 'static' to every function and variable, and follows the Arduino model a little closer. I insert the following code in just about every project I start.

 

I hope this prevents some carpel tunnel syndrome for someone;

namespace Junk2
{
    public class Program
    {
        bool instanceDone = false;
        DateTime lastTick;
        EncodedMotor M0;

        public static void Main()
        {
            var p = new Program();
            p.Setup();
            while (!p.instanceDone)
                p.Loop();
        }

        void Setup()
        {
            // do initialize things here

            // pwm, phA, phB, reversed
            M0 = new EncodedMotor(PWMChannels.PWM_PIN_D5, Pins.GPIO_PIN_D9, Pins.GPIO_PIN_D10, true);
 
            lastTick = DateTime.Now;
        }

        void Loop()
        {
            DateTime thisTick = DateTime.Now;
            TimeSpan dt = thisTick - lastTick;

            //.... more stuff

            Thread.Sleep(1000 / 20); // update N times per sec
            lastTick = thisTick;
        }
    }
}




#58303 XTEA

Posted by Spiked on 21 May 2014 - 12:38 AM in General Discussion

I had to look up what it was, and right there on the wiki page is code.

 

http://en.wikipedia.org/wiki/XTEA

 

what is it you are looking for?




#60515 Multiple reboots

Posted by Spiked on 23 October 2014 - 07:02 AM in Netduino Plus 2 (and Netduino Plus 1)

So, My first netduino completely quit talking to the robot.  So I was trying to hook it up to the desktop PC when I had the 12v incident and totally fried it.

But I always did wonder why it behaved differently (and usually worse) than the newer netduino lab board I had (same model).

 

Then todays story on clone ftdi chips getting bricked intentionally by driver updates - hmmm, things are starting to make more sense. Why it behaved poorly, why it stopped working.

 

With my luck though the newer will die in a day or 2 :(




#60813 Serial Exception

Posted by Spiked on 29 November 2014 - 08:39 AM in Netduino Plus 2 (and Netduino Plus 1)

I have never been real clear on the serial port thing with the Netduino. I had some discussion earlier, that probably explained it, but I was a total newb at the time, so I jumped to ethernet since it was the quickest way to get what I wanted working (MQTT type messaging).

 

I am led to believe that the USB serial port is used for deploying and debugging, and therefore you can not mix your serial traffic on that port if it is in use by visual studio.  The proposed solution I believe was to use an FTDI serial cable attached to com2 on the Netduino, and tell visual studio to use that. Then USB com1 is freed up for your serial traffic.

 

Is this also your understanding, and how you went about it?  I need to come back to this someday. As it is, when I need to demo something I usually just use an arduino because of this. http://www.spiked3.com/?p=1731




#61038 Bit Torrent with the Plus

Posted by Spiked on 21 December 2014 - 06:03 PM in Netduino Plus 2 (and Netduino Plus 1)

I know of no software that does this, so the short answer is no.

 

The long answer depends on what you mean by 'handle bit torrenting files'  

Can it copy the files and leave them encrypted? yes.

Can it decrypt the files from a stream?  probably, if you write the code.

Can it coordinate multiple port connections to optimize bit torrent throughput? probably not.

Can it generate keys and encrypt outgoing files on the fly? Maybe (but see previous restriction), how is your STM32 Assembly language and ability to generate your own firmware (do you have access to an expensive toolchain, I have not seen anything about building the current firmware any other way)? The chip can do it, can you?

 

Bottom line; not something the device is likely to do well, if at all.




#60512 Micro USB port not working, after drawing +5v.

Posted by Spiked on 23 October 2014 - 12:24 AM in Netduino Plus 2 (and Netduino Plus 1)

So yesterday, I needed to hook up my robot in a new way, including using a USB hub. The only power supply I found near the device that fit was 12V and I thought "what the heck, it has a regulator inside right?"  Wrong, 1 second power light was on, next it was out, for good.

 

Simple fix, $60 and order another one.




#59803 Multiple reboots

Posted by Spiked on 20 August 2014 - 07:26 PM in Netduino Plus 2 (and Netduino Plus 1)

Is there anything that can be done to reduce the multiple reboots that occur when debugging?

 

My netduino sometimes reboots 12-15 times before the debugger load symbol tables and begins debugging.

 

Then there are those rare occasions (1 in 50?) that it works with just one reboot.

 

I generally have control and can force some sort of orderly shutdown if that helps start the next session, I just have no idea what it would be to do that.




#59515 Need help with Rotary Encoder COM-11102

Posted by Spiked on 02 August 2014 - 03:44 AM in Netduino Plus 2 (and Netduino Plus 1)

Just tried it myself.  

First there is a bug in the code; I believe the line 

 

if (pinB != Pins.GPIO_NONE)

 

should have been

 

if (pinButton != Pins.GPIO_NONE)

 

but I don't see that causing the error you encountered (but maybe).

 

In my case I can rotate an encoded motor 90 degrees, and get no counts. After that, it seems to be fine, I will do some more testing.




#61031 Unable to deply project, device not found or cannot be opened

Posted by Spiked on 20 December 2014 - 04:19 PM in General Discussion

I had one just quit working, right around the time the driver was released that bricked clone chips.

 

I thought they replaced that driver now, but in any case, I otherwise destroyed that one (power incident) so I just go another one and it is still fine.  If it used to work, and no longer does, keep this in mind as a possibility.

 

Otherwise, the normal troubleshooting routines; hold down the reset while attaching to USB, should show up as something else (not netduino) in device manager.  Use mf deploy to update the firmware, should now show as 'netduino' in device manager.  I find every once and while the firmware goes MIA, and I have to reflash occasionally. 




#59584 Serial port issues

Posted by Spiked on 06 August 2014 - 05:34 PM in Netduino 2 (and Netduino 1)

And you need to use a separate serial usb cable/converter. Other than that, all the program does echo back any characters it receives.

 

There are a few spots in the code that bug me.  Why does he allocate a byte array of 1 byte?  just declare a byte, then use Serial readByte() and writeByte methods instead of read() and write().

 

I especially would not do a new byte every time I entered that delegate - very inefficient.




#60395 Netduino & Azure (push notifications)

Posted by Spiked on 12 October 2014 - 11:29 AM in Netduino Plus 2 (and Netduino Plus 1)

I always thought it was kind of a cool idea, but never had a reason to use it;

 

https://www.sparkfun.com/news/1527

 

Assuming you have internet connectivity, since you mentioned Azure, I suspect you do.

 

I use MQTT, which probably makes more sense, but not as much fun since I already know it :P

 

https://m2mqtt.codeplex.com/




#61144 Shield Module speed and HC-SR04

Posted by Spiked on 04 January 2015 - 03:31 PM in Netduino Go

...




#60026 Using NETMF SerialPort in NET 4.5 Application

Posted by Spiked on 07 September 2014 - 08:04 PM in Visual Studio

keep the serial port out of the common code or

surround it with #if MF_FRAMEWORK_VERSION_V4_3 #else

 

I thought serial port would be in System.IO?  

 

In any case, writing common code for a serial port between two different hosts may be pushing it, but I guess it could be done. I have mixed feelings on the utility of this. I would tend to write more robust code where resources are not constrained (error handling, longer messages, bigger buffers), but I have no idea as to your reasons to not want to do that.




#61032 Cant get an IP address

Posted by Spiked on 20 December 2014 - 04:32 PM in Netduino Plus 2 (and Netduino Plus 1)

I'd agree on using the hardware mac address first.

 

But if that is something you can not do, try setting it before you ask for a dhcp address.  Otherwisee mac '1234' ask for an IP address, then changed itself to '5678'  - it will never receive a reply.




#58965 Bitconverter class causing crash/irresponsiveness.

Posted by Spiked on 01 July 2014 - 02:42 PM in Netduino Plus 2 (and Netduino Plus 1)

Verified.  Same issue using bitconverter.tostring(). Have to reflash.
 
my quick workaround is;
 

const string hexChars = "0123456789ABCDEF";
static string BugWorkAroundToString(byte[] buf)
{
   string s = "0x";
            
   foreach (byte b in buf)
   {
       s += hexChars[b >> 4];
       s += hexChars[b & 0x0F];
   }
   return s;
}



#61064 N+2: Remote debugging over TCP/IP?

Posted by Spiked on 25 December 2014 - 08:40 AM in Netduino Plus 2 (and Netduino Plus 1)

I have never seen any mention of it. Nor is there any indication for support from within vs I can see.




#61051 Netduino+2 PWM for high resolution timing

Posted by Spiked on 23 December 2014 - 10:24 AM in Netduino Plus 2 (and Netduino Plus 1)

The biggest difference is one is the time now, the other is the time when the interrupt occurred (or closer to it), and the two are not related.




#61047 Netduino+2 PWM for high resolution timing

Posted by Spiked on 23 December 2014 - 12:03 AM in Netduino Plus 2 (and Netduino Plus 1)

For starters, an interrupt in a managed framework is not the same as an interrupt on a raw device.

 

Rather than look at MachineTime Ticks, look at the value of the DateTime timestamp argument passed to you.

 

But that is for future reference, it is not causing the errors you see.

 

I suspect you are just driving interrupts faster than the framework can handle.  As far as I know, the Netduino is NOT a good device for reading high speed signals, unless there was something added that I missed.

 

Even if your code is not doing anything for the interrupt, again, it is NOT like interrupts on an Arduino. It IS doing a lot of stuff under the covers. For one, it is passing you a timestamp. You can be sure that has to go through memory allocation at a minimum. Memory fragmented? Maybe the garbage collector HAD to run.  Then it gets placed in an event Queue, that might need to be expanded .... more memory management. Then it calls your code, that does nothing ... but the stack needs to be cleaned up, and unreferenced objects garbage collected.

 

Managed code is a different way of doing things. It has many advantages, and a few disadvantages.




#59220 Server to Client Communication

Posted by Spiked on 14 July 2014 - 08:18 PM in Netduino Plus 2 (and Netduino Plus 1)

You will not, by definition, be able to achieve a server to client communication without action by the client. So I will assume you meant something slightly different.

 

MQTT is a subscribe / publish protocol.  A client subscribes to messages via a broker.  A server publishes messages via the same broker. In my case, the broker runs on the PC, but both the PC and Netduino act as clients AND servers. The PC publishes a request to do something, the Netduino listens for that and acts accordingly. And the Netduino publishes sensor telemetry, and the PC listens for that. 

 

Since MQTT is ethernet based, your broker would need to be internet facing in order to send messages from WAN (assuming that means internet). The broker to Netduino connection would not need to be internet facing.

 

I have used 

http://code.msdn.mic...ibrary-ac6d3858

https://m2mqtt.codeplex.com/

http://knolleary.net...lient-for-mqtt/  (arduino)

 

and for a broker 

http://mosquitto.org/

 

All have been very easy to use.




#60968 Communicating to dac through netduino

Posted by Spiked on 13 December 2014 - 09:16 PM in Netduino Plus 2 (and Netduino Plus 1)

His registerValues  is exactly the same as data , since they are both created the same way. I suspect it is left over unused testing code.

 

The main function, does not loop. It simply Sleeps 1/2 second and ends, I guess to give time for the i2c transaction to complete?. I am unsure what the device you are using does when the i2c line closes.

 

I have always had to use an i2c kickstart in my code;

            // required i2c kick
            OutputPort p = new OutputPort(Pins.GPIO_PIN_SDA, true); p.Write(false); p.Dispose();
 
Don't you have to tell it what register you are writing to?
 
My code looks like this, but it has been a while since I've needed to use i2c
 
     I2CDevice.Configuration c = new I2CDevice.Configuration(0x53, 400);
     Byte[] POWER_CTL = new Byte[] {0x2D, 0x08};
     I2CDevice a = new I2CDevice(c);
     a.Execute(new I2CDevice.I2CTransaction[] { I2CDevice.CreateWriteTransaction(POWER_CTL) }, 100);



#59956 32-bit PWM

Posted by Spiked on 30 August 2014 - 07:24 PM in General Discussion

Good find! Something to try and keep in mind.




#60467 I2C with a display

Posted by Spiked on 20 October 2014 - 12:52 AM in Netduino Plus 2 (and Netduino Plus 1)

'Simple' is an subjective term. I hook up a saleae logic analyser and I quickly know if it is failing hardware, my code (99.99999%).

 

So to answer your question, yes very simple way to test it.  The only other way is to take code and a device you know that already works, and try that.

 

The third way is to find someone who has either of the first 2 ways.

 

If none of these are available to you, then no, there is no simple way.




#59955 Blinky won't blink

Posted by Spiked on 30 August 2014 - 07:15 PM in Netduino Plus 2 (and Netduino Plus 1)

You had my curiosity peaked so I tried your program (on 4.3.1).

 

It ran as expected .... but

 

I will say it acted weird(er) than other programs. I don't know if you triggered some bug with a variable name or what, but there is a big delay when it starts (4-5 seconds).

 

I have 2 N2+ now, and they work differently as far as debugging, how many times they reboot when starting. The newest one consistently usb disconnects 3 times, then starts loading symbol tables. The previous one was a random number how many disconnects/reconnects it goes through.  The moral is I doubt if there is consistency among units at the moment.

 

I'll contrast this with the Galileo which feels rock solid as far as debugging (which also uses the ethernet connection not USB). 




#60967 DTMF with netduino plus 2

Posted by Spiked on 13 December 2014 - 08:56 PM in Project Showcase

My 'I have never done it' guess would be you need to use a FFT to get the frequency of the tones.

 

http://www.arduinoos...-transform-fft/ 

 

has 11 pages explaining how to do it on an Arduino. I don't even know if the Managed Netduino is capable.

 

Give it a quick look, then go get a chip previously mentioned :)




#60759 DateTime in NativeEventHandler()

Posted by Spiked on 19 November 2014 - 04:53 PM in Netduino Plus 2 (and Netduino Plus 1)

I remember finding it somewhere and it was 3µs . I don't remember where, or I could be remembering it completely wrong, so take it with a grain of salt.





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.