@ PetaByte - Visual Studio may be regenerating the Gadgeteer friendly name after a reset, or a detachment of the debugger. This would cause a minute gap in communication forcing Visual Studio to regenerate the name as the generic USB:Gadgeteer because your device did not respond soon enough for Visual Studio. Under the Project Settings tab, and then under Microframework, just click the dropdown for Device, and the name should change from USB:Gadgeteer to something like EMX_EMX (for spider). Redeploy after switching this. If this is not the case, then the next logical culprit is a tight loop as Architect suggested.
BTW: sometimes it doesnāt take more than seconds while āPreparing to deploy assemblies to the deviceā for same code
Any way, here is the code which record GPS NMEA raw data to SD Card
// This code is grapping RAW NMEA data from GPS module,
// and store it into SD card...
// Last modification 1/1/2013, Tue, 8:18PM
using System.Collections;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Touch;
using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;
using System;
using System.IO;
using Microsoft.SPOT.IO;
namespace GadgeteerApp2
{
public partial class Program
{
private GT.Timer _timer;
private string _root;
void ProgramStarted()
{
GHI.OSHW.Hardware.StorageDev.MountSD();
if (VolumeInfo.GetVolumes()[0].IsFormatted)
{
_root = VolumeInfo.GetVolumes()[0].RootDirectory;
_timer = new GT.Timer(5000);
_timer.Tick += new GT.Timer.TickEventHandler(TimerTick);
_timer.Start();
}
// Serial Reading
usbSerial.Configure(9600,
GT.Interfaces.Serial.SerialParity.None,
GT.Interfaces.Serial.SerialStopBits.One,
8);
usbSerial.SerialLine.Open();
usbSerial.SerialLine.DataReceived += new
GT.Interfaces.Serial.DataReceivedEventHandler(SerialLine_DataReceived);
// ***
}
void TimerTick(GT.Timer timer)
{
string fileName = Path.Combine(_root, "DONETracksLogNMEA.txt");
Stream stream;
// GPS Reading
int NumberOfBytesToRead = usbSerial.SerialLine.BytesToRead;
byte[] readInputBuffer = new byte[NumberOfBytesToRead];
usbSerial.SerialLine.Read(readInputBuffer, 0, NumberOfBytesToRead);
// ***********
if(File.Exists(fileName))
{
stream = File.OpenWrite(fileName);
stream.Position = stream.Length; //FM Not To Overwrite
}
else
{
stream = File.Create(fileName);
}
using(var writer = new StreamWriter(stream))
{
// GPS writing to SD
for (int j = 0; j < NumberOfBytesToRead; j++)
{
char a = (char)readInputBuffer[j];
writer.Write(a.ToString());
}
// ***
writer.WriteLine("***");
}
stream.Dispose();
}
void SerialLine_DataReceived(GT.Interfaces.Serial sender, System.IO.Ports.SerialData data)
{
}
}
}
I have the same issue on my Mountaineer Eth with NETMF 4.2 QFE2 and VS 2010.
I deployed the following āstupidā test program one time, and it is still running (LEDs blinking and serial port rattling). Since that, VS canāt connect any more, and also MFDeploy.exe canāt ping or erase the device.
I thought I could simply erase the flash memory using the ST DFU Tester. Selecting āEraseā and then clicking āGoā displays āsuccessā immediately, but after that, when I release the boot pin and restart the board, the old program still starts to run. How do I properly erase the flash memory?
Thanks so much for your help! I am still pretty new at thisā¦
ļ»æusing System;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using System.Threading;
namespace MainboardTest1
{
public class Program
{
public static void Main()
{
Debug.Print(
Resources.GetString(Resources.StringResources.String1));
var tm = new System.Threading.Timer(timerF, null, 0, 5000);
System.IO.Ports.SerialPort s = new System.IO.Ports.SerialPort("COM1", 9600);
s.Open();
while (true)
{
s.Write(new byte[] { (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'\n' }, 0, 5);
}
}
private static void timerF(object state)
{
OutputPort redLed = new OutputPort((Cpu.Pin)77, false);
OutputPort greenLed = new OutputPort((Cpu.Pin)75, false);
OutputPort blueLed = new OutputPort((Cpu.Pin)78, false);
//br
redLed.Write(true);
System.Threading.Thread.Sleep(200);
//r
blueLed.Write(false);
System.Threading.Thread.Sleep(200);
//rg
greenLed.Write(true);
System.Threading.Thread.Sleep(200);
//g
redLed.Write(false);
System.Threading.Thread.Sleep(200);
//gb
blueLed.Write(true);
System.Threading.Thread.Sleep(200);
//b
greenLed.Write(false);
System.Threading.Thread.Sleep(200);
}
}
}
ā¦or start the timer might also allow some scheduler time and debugger to get in. But the āstupidā comment led me to believe that it was known what they did wrong
Agreed. Yet my board is preventing me from deploying a new program in the first place, so I canāt apply that fix now.
I only realized that afterwards, obviously. I assumed that the firmware itself would reserve some scheduler time to cater for the debugging/deployment interfaceā¦
I donāt have a mountaineer board, although I do have a Cerb (uses same chip) but have little experience in tight loop issues except in USBizi. It is possible that the firmware update process leaves an application intact, but I canāt be sure - it doesnāt in USBizi, you erase and it erases everything.
Can I suggest that you give MFDeploy a try? Connect the board to the PC, have MFDeploy open and set to USB, then hit reset on the board and hit F5 in MFDeploy to connect? If thatās successful, then ERASE the application from MFDeploy. Might need to try a number of timesā¦
As a last resort I connected a JTAG adapter (see picture). Luckily this worked, so I could erase the flash via JTAG. So, the board is not really bricked
After erasing, I could re-install the firmware, run a (proper) sample program, and connect MFDeploy alright.
I still do not understand why ST DFU Tester does not erase anything, though. That would be much simpler than connecting JTAG this way.