A. It’s defintely some sort of downlaod issue. In VS I get the following:
1>------ Deploy started: Project: MeadowApplication23, Configuration: Debug Any CPU ------
1>
1>Connecting to Meadow on COM9
After several minutes I give up an unplug the lead. In a short while the mesage:
1>[16/09/2023 2:33:04 PM] Deploy failed: A device has not been selected. Please attach a device, then select it from the Device list.
1>StackTrace:
This reproduceable. Same outcome if I wait longer times.
So it most know about COM9, in particular its in the dropdown list and knows its been unplugged (ithink)!
B. Similar outcome with this:
PS C:\Users\david\Documents\meadow> meadow use port com9
Setting port to com9
Done!
PS C:\Users\david\Documents\meadow> meadow mono disable
Connecting to Meadow on com9
Give up and unplug:
Unable to find Meadow.
PS C:\Users\david\Documents\meadow>
C. But if I do same but start with it unplugged:
PS C:\Users\david\Documents\meadow> meadow mono disable
Connecting to Meadow on com9
Unable to find Meadow.
PS C:\Users\david\Documents\meadow
So my conclusion is that it does know about the device on COM9 with the device connected (and knows there is no device when not connected) but fails to interact with it!
meadow wouldn’t run on the RPi. Kept saying .NET wasn’t installed
Downloaded tool src from GitHub
Built Release-ARM64 version
Publish to a folder
Copied to RPi
In that folder:
meadow still reported .NET not installed when attempt to run
dotnet meadow.dll works though
The os install now runs:
djaus@raspberrypi:/media/djaus/C020-1602/meadow $ dotnet meadow.dll flash os
Flashing OS with /home/djaus/.local/share/WildernessLabs/Firmware/1.3.0.0/Meadow.OS.bin
dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 0483:df11
Run-time device DFU version 011a
Claiming USB DFU Interface...
Setting Alternate Setting #0 ...
Determining device status: state = dfuERROR, status = 10
dfuERROR, clearing status
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 011a
Device returned transfer size 2048
DfuSe interface name: "Internal Flash "
Downloading to address = 0x08000000, size = 2097152
Download done. [=========================] 100% 2097152 bytes
File downloaded successfully
Transitioning to dfuMANIFEST state
[null]
Connecting to Meadow on /dev/ttyACM0
And again it just hangs!
My conclusion is the same as previous: The problem IS at the device end.
Is it possible to do some sort of FACTORY RESET of the device?
Back on my PC. Running the meadow app from Visdual Studio in debug mode:
meadow download OS runs OK
meadow flash OS hangs again ;(
In the code when it runs it gets to the Connecting to Meadow on line of code as below:
logger.LogInformation($"{Environment.NewLine}Connecting to Meadow on {serialPort}{Environment.NewLine}");
var createTask = Task.Run(() => meadow = new MeadowSerialDevice(serialPort, logger));
var completedTask = await Task.WhenAny(createTask, Task.Delay(1000));
if (completedTask != createTask || meadow == null)
{
logger.LogTrace("Timeout while creating Meadow");
try
{
await createTask;
… but the completedTask returns as runToCompletion when it should be CreateTask which means it is running. And meadow is null.
It then procedes to the await createTask line of code and does not return.
Drilled in further. This LOC fails to open the serial port which now has switched from DFU mode to COM9
var port = new SerialPort
{
}
....
port.Open();
Nb: COM9 is nlisted at this stage in some code that gets a list of COM ports.
The problem is that port.Open(); never returns.
Just noticed in the Port class instantian // This value is ignored when using ACM
Does this mean that at this stage the port should still be DFU/ACM mode and that is what shuld be being openned?
Trapping the port.Open() (in a loop) in try - catch ex.Message:
Exception thrown: 'System.IO.IOException' in System.IO.Ports.dll
The semaphore timeout period has expired.
Timeout takes 4000 seconds, the read timeout.
In next loop get:
System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'
Footnote: If, in the catch code just above, the port is disposed of and reinstatiated, it doesn’t have the access violation, Just in a neverending loop!
My intepretation of that code is incorrent. the completedTask is the CreateTask so all is OK.
The problem is that that task returns with meadow null hence that reason is the reason it goes into that following loop. CreateTask in teh loop does not return. So it is the call … meadow = new MeadowSerialDevice(serialPort, logger));
… that is supposed instantiate the MeadowSerialDevice which fails.