Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow ESP32 boards to work with Visual studio extension #108

Merged
merged 5 commits into from
Jan 4, 2018
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,7 @@ public async Task<bool> OpenDeviceAsync(DeviceInformation deviceInfo, string dev

// adjust settings for serial port
_device.BaudRate = 115200;

/////////////////////////////////////////////////////////////
// need to FORCE the parity setting to _NONE_ because
// the default on the current ST Link is different causing
// the communication to fail
/////////////////////////////////////////////////////////////
_device.DataBits = 8;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add back the comment block that was there. It seems harmless but it has cost a lot of time finding the root cause for the issue and that comment documents that. 😉

_device.Parity = SerialParity.None;

_device.WriteTimeout = TimeSpan.FromMilliseconds(1000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public bool IsEnabledAutoReconnect

private void Device_ErrorReceived(SerialDevice sender, ErrorReceivedEventArgs args)
{
throw new NotImplementedException();
//throw new NotImplementedException();
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,11 +441,23 @@ private async Task<bool> CheckValidNanoFrameworkSerialDeviceAsync(SerialDeviceIn
var name = deviceInformation.DeviceInformation.Name;
var serialNumber = GetSerialNumber(deviceInformation.DeviceInformation.Id);

// acceptable names and that are know valid nanoFramework devices
if (
// STM32 COM port on on-board ST Link found in most NUCLEO boards
(name == "STM32 STLink")
)
if (serialNumber != null && serialNumber.Contains("NANO_"))
{
var device = FindNanoFrameworkDevice(deviceInformation.DeviceInformation.Id);

if (device != null)
{
device.Description = serialNumber + " @ " + device.Description;

// should be a valid nanoFramework device, done here
return true;
}
else
{
Debug.WriteLine($"Couldn't find nano device {EventHandlerForSerialDevice.Current.DeviceInformation.Id} with serial {serialNumber}");
}
}
else
{
// need an extra check on this because this can be 'just' a regular COM port without any nanoFramework device behind

Expand All @@ -470,26 +482,7 @@ private async Task<bool> CheckValidNanoFrameworkSerialDeviceAsync(SerialDeviceIn
}

}
else if (serialNumber != null)
{
if (serialNumber.Contains("NANO_"))
{
var device = FindNanoFrameworkDevice(deviceInformation.DeviceInformation.Id);

if (device != null)
{
device.Description = serialNumber + " @ " + device.Description;

// should be a valid nanoFramework device, done here
return true;
}
else
{
Debug.WriteLine($"Couldn't find nano device {EventHandlerForSerialDevice.Current.DeviceInformation.Id} with serial {serialNumber}");
}
}
}


// default to false
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,7 @@ public async Task<bool> OpenDeviceAsync(DeviceInformation deviceInfo, string dev

// adjust settings for serial port
_device.BaudRate = 115200;

/////////////////////////////////////////////////////////////
// need to FORCE the parity setting to _NONE_ because
// the default on the current ST Link is different causing
// the communication to fail
/////////////////////////////////////////////////////////////
_device.DataBits = 8;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add back the comment block that was there. It seems harmless but it has cost a lot of time finding the root cause for the issue and that comment documents that. 😉

_device.Parity = SerialParity.None;

_device.WriteTimeout = TimeSpan.FromMilliseconds(1000);
Expand Down