Setting aside my Shield Base...for now
#1
Posted 20 April 2012 - 07:03 PM
Every deployment of the code ends up with a different result which makes it insanely difficult to debug. In frustration I have to restart my computer numerous times after a debug fails or hangs, then to my surprise the Shield Base lights up with excitement as soon as I plug the USB cable after the restart (heaven forbid keeping it plugged in during reboot). With having to restart so often on my Win 7, 64 bit machine running 4.2 QFE1 and the latest SDK, and as a follicly challenged guy, I just can't justify the all the hair pulling and lost time.
On a good note, the shield base seems very promising and I hope that soon more advanced users will begin to wade through the murky waters of beta testing. I do have all of the Netduino Go modules and the Nwazet display which have been working perfectly. I am having loads of fun creating simple interfaces on the display to turn on/off the rgb led, changing the brightness via the pot, etc, etc. As my first display unit the Nwazet display has been fairly easy to use and a great set of demo code to keep me busy for a while. My relay module shipped today, so I'll be back to annoying my family by turning appliances and off via my Display panel in a short bit. Oh the simple joys!
So, until we get some more Sheild Base early adopters I will be eagerly waiting in the forums for some progress updates and sample code to test.
Regards,
Steve
Twiiter: https://twitter.com/Gutworks
#2
Posted 20 April 2012 - 08:03 PM
#3
Posted 20 April 2012 - 08:18 PM
-Eric
#4
Posted 20 April 2012 - 08:42 PM
Twiiter: https://twitter.com/Gutworks
#5
Posted 20 April 2012 - 09:15 PM
#6
Posted 20 April 2012 - 09:36 PM
Twiiter: https://twitter.com/Gutworks
#7
Posted 20 April 2012 - 09:40 PM
Thank you very much. We left the NetduinoGo.ShieldBase.dll out of the SDK since it's beta...but this also means that it's much easier to update for beta purposesAs for the Blinky example, it was my last test, and no it didn't work consistently. At times it would throw errors, and other times it would compile. Later this evening I'll try and get some screenshots and create some testing scenarios.
Chris
#8
Posted 20 April 2012 - 10:13 PM
I am using the SDK from this morning, 4.2 QFE1, and am running Win7. The Shield Base is attached to socket 1 and there are no other modules attached.
Perhaps I have an ID 10 T issue?
using System; using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware.NetduinoGo; namespace NetduinoGo_ShieldBaseBlinky { public class Program { static NetduinoGo.ShieldBase shieldBase = new NetduinoGo.ShieldBase(GoSockets.Socket8); static OutputPort led = new OutputPort(shieldBase.Pins.GPIO_PIN_D2, false); public static void Main() { while (true) { led.Write(true); Thread.Sleep(1000); led.Write(false); Thread.Sleep(1000); } } } }
blinky.gif 84.28KB 27 downloads
Twiiter: https://twitter.com/Gutworks
#9
Posted 20 April 2012 - 10:46 PM
The very first time I try this example, after a computer reboot, the servo continually rotates and stops at the end of the code. The LED also flashes for every iteration. However, the servo does not rotate back to a beginning position as expected.
The really odd behaviour is that if I stop the debugger, and try again, the servo has a bit of a spike, and then stops, but the LED does continually flash. No matter how many times I retry, the servo will not rotate, unless I restart my computer. After the restart, I can plug the Go! back into the USB port, and the flashed code sample will run, and the servo will rotate completely.
using System; //use base classes using System.Threading; //use threading classes using Microsoft.SPOT; //use smart personal objects technology classes using Microsoft.SPOT.Hardware; //use hardware related SPOT classes using SecretLabs.NETMF.Hardware.NetduinoGo; namespace NGo_ShieldBaseLEDandServo { public class Program { public static void Main() { NetduinoGo.ShieldBase shieldBase = new NetduinoGo.ShieldBase(GoSockets.Socket1); Microsoft.SPOT.Hardware.OutputPort led = new Microsoft.SPOT.Hardware.OutputPort(shieldBase.Pins.GPIO_PIN_A5, false); Microsoft.SPOT.Hardware.PWM servo = new Microsoft.SPOT.Hardware.PWM(shieldBase.PWMChannels.PWM_3, 20000, 1500, Microsoft.SPOT.Hardware.PWM.ScaleFactor.Microseconds, false); led.Write(false); //Turn LED off uint firstPosition = 1000; //Minimum pulse width of 1ms uint lastPosition = 2000; //Maximum pulse width of 2ms // move through the full range of positions for (uint currentPosition = firstPosition; currentPosition <= lastPosition; currentPosition += 10) { Debug.Print("currentPosition: " + currentPosition); // move the servo to the new position. servo.Duration = currentPosition; //Set Duration to the last known value from 1ms to 2ms servo.Period = 20000; //Set Period to 20ms servo.Start(); led.Write(!led.Read()); //Flash the LED on every position change Thread.Sleep(20); //refresh the pulse every 20 milliseconds } servo.Duration = firstPosition; // return to first position servo.Period = 20000; servo.Start(); Debug.Print("firstPosition: " + firstPosition); led.Write(false); //turn LED off servo.Stop(); Thread.Sleep(Timeout.Infinite); } } }
Twiiter: https://twitter.com/Gutworks
#10
Posted 20 April 2012 - 10:51 PM
Okay, that's guaranteed not to work Can you change the Shield Base to socket 8 -- or change "GoSockets.Socket8" to "GoSockets.Socket1" in your code?For this example I have created new project and have created a simple Blinky test with the code sample below. As you can see when I run it I get the following error "An unhandled exception of type 'System.Exception' occurred in NetduinoGo.ShieldBase.dll".
I am using the SDK from this morning, 4.2 QFE1, and am running Win7. The Shield Base is attached to socket 1 and there are no other modules attached.
static NetduinoGo.ShieldBase shieldBase = new NetduinoGo.ShieldBase(GoSockets.Socket8);
Chris
#11
Posted 20 April 2012 - 10:53 PM
Okay, it's possible that there's a glitch in the PWM implementation. Let me wire up a servo and test this out here. [Stefan -- did you also test this?]The really odd behaviour is that if I stop the debugger, and try again, the servo has a bit of a spike, and then stops, but the LED does continually flash. No matter how many times I retry, the servo will not rotate, unless I restart my computer. After the restart, I can plug the Go! back into the USB port, and the flashed code sample will run, and the servo will rotate completely.
It sounds like the OutputPort feature is working then...but PWM is giving you intermittent results?
Chris
#12
Posted 21 April 2012 - 01:52 AM
Go, on you can say it. I know it must have been killing you not to say it. I would have called it an ID 10 T errorHi Gutworks,
Okay, that's guaranteed not to work Can you change the Shield Base to socket 8 -- or change "GoSockets.Socket8" to "GoSockets.Socket1" in your code?
Chris
So I changed my the Socket to Socket1 (still can't believe I did that), but I still get the same error.
Attached Files
Twiiter: https://twitter.com/Gutworks
#13
Posted 21 April 2012 - 02:48 AM
Just trying to help get you up and runningGo, on you can say it. I know it must have been killing you not to say it. I would have called it an ID 10 T error
So I changed my the Socket to Socket1 (still can't believe I did that), but I still get the same error.
Can you try moving the object creation inside your Main function? It's possible that NETMF is creating dependent objects out of order by creating these at the static class level...
Chris
#14
Posted 21 April 2012 - 03:29 AM
Brilliant. That seemed to do the trick. I now have a blinky LED!Hi Gutworks,
Just trying to help get you up and running
Can you try moving the object creation inside your Main function? It's possible that NETMF is creating dependent objects out of order by creating these at the static class level...
Chris
I was trying to set the duty cycle of the led a few moments ago but I don't fully understand the new constructor - not sure what frequency to use.
PWM led2 = new PWM(shieldBase.PWMChannels.PWM_3, 50, 100, false);After the initialization I tried to Start() the led, but that didn't work alone. Then I tried to set the Duty and Frequency separate but that also didn't have any effect. I also tried 10hz for the freq, but that was just a shot in the dark. Anyway, this is progress, and I love progress. Thanks for the help!
Twiiter: https://twitter.com/Gutworks
#15
Posted 22 April 2012 - 01:23 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users