Bugfixes
- Firmware update device reattachment - Disconnect/connect with multiple devices - udev rule extended
This commit is contained in:
parent
2d44201de7
commit
44124bc09e
@ -1 +1,2 @@
|
|||||||
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="564e", MODE:="0666"
|
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="564e", MODE:="0666"
|
||||||
|
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="4121", MODE:="0666"
|
||||||
|
Binary file not shown.
@ -8,6 +8,15 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
using USBID = struct {
|
||||||
|
int VID;
|
||||||
|
int PID;
|
||||||
|
};
|
||||||
|
static constexpr USBID IDs[] = {
|
||||||
|
{0x0483, 0x564e},
|
||||||
|
{0x0483, 0x4121},
|
||||||
|
};
|
||||||
|
|
||||||
USBInBuffer::USBInBuffer(libusb_device_handle *handle, unsigned char endpoint, int buffer_size) :
|
USBInBuffer::USBInBuffer(libusb_device_handle *handle, unsigned char endpoint, int buffer_size) :
|
||||||
buffer_size(buffer_size),
|
buffer_size(buffer_size),
|
||||||
received_size(0),
|
received_size(0),
|
||||||
@ -22,13 +31,11 @@ USBInBuffer::USBInBuffer(libusb_device_handle *handle, unsigned char endpoint, i
|
|||||||
USBInBuffer::~USBInBuffer()
|
USBInBuffer::~USBInBuffer()
|
||||||
{
|
{
|
||||||
if(transfer) {
|
if(transfer) {
|
||||||
qDebug() << "Start cancellation";
|
|
||||||
libusb_cancel_transfer(transfer);
|
libusb_cancel_transfer(transfer);
|
||||||
// wait for cancellation to complete
|
// wait for cancellation to complete
|
||||||
mutex mtx;
|
mutex mtx;
|
||||||
unique_lock<mutex> lck(mtx);
|
unique_lock<mutex> lck(mtx);
|
||||||
cv.wait(lck);
|
cv.wait(lck);
|
||||||
qDebug() << "Cancellation complete";
|
|
||||||
}
|
}
|
||||||
delete buffer;
|
delete buffer;
|
||||||
}
|
}
|
||||||
|
@ -82,14 +82,6 @@ private slots:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using USBID = struct {
|
|
||||||
int VID;
|
|
||||||
int PID;
|
|
||||||
};
|
|
||||||
static constexpr USBID IDs[] = {
|
|
||||||
{0x0483, 0x5640},
|
|
||||||
{0x0483, 0x4121},
|
|
||||||
};
|
|
||||||
static constexpr int EP_Data_Out_Addr = 0x01;
|
static constexpr int EP_Data_Out_Addr = 0x01;
|
||||||
static constexpr int EP_Data_In_Addr = 0x81;
|
static constexpr int EP_Data_In_Addr = 0x81;
|
||||||
static constexpr int EP_Log_In_Addr = 0x82;
|
static constexpr int EP_Log_In_Addr = 0x82;
|
||||||
|
@ -26,9 +26,9 @@ void DeviceLog::addLine(QString line)
|
|||||||
if(line.contains(",CRT]")) {
|
if(line.contains(",CRT]")) {
|
||||||
color = Qt::red;
|
color = Qt::red;
|
||||||
} else if(line.contains(",ERR]")) {
|
} else if(line.contains(",ERR]")) {
|
||||||
color = QColor("orange");
|
color = QColor(255, 94, 0);
|
||||||
} else if(line.contains(",WRN]")) {
|
} else if(line.contains(",WRN]")) {
|
||||||
color = Qt::darkYellow;
|
color = QColor(255, 174, 26);
|
||||||
} else if(line.contains(",DBG")) {
|
} else if(line.contains(",DBG")) {
|
||||||
color = Qt::gray;
|
color = Qt::gray;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include "ui_firmwareupdatedialog.h"
|
#include "ui_firmwareupdatedialog.h"
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
|
||||||
FirmwareUpdateDialog::FirmwareUpdateDialog(Device *&dev, QWidget *parent) :
|
FirmwareUpdateDialog::FirmwareUpdateDialog(Device *dev, QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::FirmwareUpdateDialog),
|
ui(new Ui::FirmwareUpdateDialog),
|
||||||
dev(dev),
|
dev(dev),
|
||||||
@ -98,12 +98,9 @@ void FirmwareUpdateDialog::timerCallback()
|
|||||||
auto devices = Device::GetDevices();
|
auto devices = Device::GetDevices();
|
||||||
if(devices.find(serialnumber) != devices.end()) {
|
if(devices.find(serialnumber) != devices.end()) {
|
||||||
// the device rebooted and is available again
|
// the device rebooted and is available again
|
||||||
dev = new Device(serialnumber);
|
addStatus("...device enumerated, update complete");
|
||||||
addStatus("...device reattached, update complete");
|
|
||||||
timer.stop();
|
timer.stop();
|
||||||
ui->bStart->setEnabled(true);
|
emit DeviceRebooted(serialnumber);
|
||||||
disconnect(dev, &Device::AckReceived, this, &FirmwareUpdateDialog::receivedAck);
|
|
||||||
disconnect(dev, &Device::NackReceived, this, &FirmwareUpdateDialog::receivedNack);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -139,11 +136,10 @@ void FirmwareUpdateDialog::receivedAck()
|
|||||||
case State::TriggeringUpdate:
|
case State::TriggeringUpdate:
|
||||||
addStatus("Rebooting device...");
|
addStatus("Rebooting device...");
|
||||||
serialnumber = dev->serial();
|
serialnumber = dev->serial();
|
||||||
delete dev;
|
emit DeviceRebooting();
|
||||||
dev = nullptr;
|
|
||||||
state = State::WaitingForReboot;
|
state = State::WaitingForReboot;
|
||||||
timer.setSingleShot(false);
|
timer.setSingleShot(false);
|
||||||
timer.start(1000);
|
timer.start(2000);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -22,9 +22,13 @@ public:
|
|||||||
* - If the update fails during device reboot, the device pointer is set to zero and the device deleted
|
* - If the update fails during device reboot, the device pointer is set to zero and the device deleted
|
||||||
* - If the update succeeds, the device pointer will be set to the new device instance
|
* - If the update succeeds, the device pointer will be set to the new device instance
|
||||||
*/
|
*/
|
||||||
explicit FirmwareUpdateDialog(Device *&dev, QWidget *parent = nullptr);
|
explicit FirmwareUpdateDialog(Device *dev, QWidget *parent = nullptr);
|
||||||
~FirmwareUpdateDialog();
|
~FirmwareUpdateDialog();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void DeviceRebooting(); // emitted when the update process is triggered, the device should be disconnected
|
||||||
|
void DeviceRebooted(QString serial); // emitted when an updated device is enumerated after the update
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_bFile_clicked();
|
void on_bFile_clicked();
|
||||||
void on_bStart_clicked();
|
void on_bStart_clicked();
|
||||||
@ -37,7 +41,7 @@ private:
|
|||||||
void abortWithError(QString error);
|
void abortWithError(QString error);
|
||||||
void sendNextFirmwareChunk();
|
void sendNextFirmwareChunk();
|
||||||
Ui::FirmwareUpdateDialog *ui;
|
Ui::FirmwareUpdateDialog *ui;
|
||||||
Device *&dev;
|
Device *dev;
|
||||||
QFile *file;
|
QFile *file;
|
||||||
QTimer timer;
|
QTimer timer;
|
||||||
|
|
||||||
|
@ -523,13 +523,13 @@
|
|||||||
<number>128</number>
|
<number>128</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>131072</number>
|
<number>130944</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="singleStep">
|
<property name="singleStep">
|
||||||
<number>128</number>
|
<number>128</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<number>131072</number>
|
<number>130944</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -99,6 +99,8 @@ AppWindow::AppWindow(QWidget *parent)
|
|||||||
connect(ui->actionFirmware_Update, &QAction::triggered, [=](){
|
connect(ui->actionFirmware_Update, &QAction::triggered, [=](){
|
||||||
if(device) {
|
if(device) {
|
||||||
auto fw_update = new FirmwareUpdateDialog(device);
|
auto fw_update = new FirmwareUpdateDialog(device);
|
||||||
|
connect(fw_update, &FirmwareUpdateDialog::DeviceRebooting, this, &AppWindow::DisconnectDevice);
|
||||||
|
connect(fw_update, &FirmwareUpdateDialog::DeviceRebooted, this, &AppWindow::ConnectToDevice);
|
||||||
fw_update->exec();
|
fw_update->exec();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -196,12 +198,16 @@ void AppWindow::DisconnectDevice()
|
|||||||
ui->actionDisconnect->setEnabled(false);
|
ui->actionDisconnect->setEnabled(false);
|
||||||
ui->actionManual_Control->setEnabled(false);
|
ui->actionManual_Control->setEnabled(false);
|
||||||
ui->actionFirmware_Update->setEnabled(false);
|
ui->actionFirmware_Update->setEnabled(false);
|
||||||
|
for(auto a : deviceActionGroup->actions()) {
|
||||||
|
a->setChecked(false);
|
||||||
|
}
|
||||||
if(deviceActionGroup->checkedAction()) {
|
if(deviceActionGroup->checkedAction()) {
|
||||||
deviceActionGroup->checkedAction()->setChecked(false);
|
deviceActionGroup->checkedAction()->setChecked(false);
|
||||||
}
|
}
|
||||||
lConnectionStatus.setText("No device connected");
|
lConnectionStatus.setText("No device connected");
|
||||||
lDeviceInfo.setText("No device information available yet");
|
lDeviceInfo.setText("No device information available yet");
|
||||||
Mode::getActiveMode()->deviceDisconnected();
|
Mode::getActiveMode()->deviceDisconnected();
|
||||||
|
qDebug() << "Disconnected device";
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppWindow::DeviceConnectionLost()
|
void AppWindow::DeviceConnectionLost()
|
||||||
@ -244,22 +250,19 @@ void AppWindow::CreateToolbars()
|
|||||||
|
|
||||||
int AppWindow::UpdateDeviceList()
|
int AppWindow::UpdateDeviceList()
|
||||||
{
|
{
|
||||||
|
deviceActionGroup->setExclusive(true);
|
||||||
ui->menuConnect_to->clear();
|
ui->menuConnect_to->clear();
|
||||||
auto devices = Device::GetDevices();
|
auto devices = Device::GetDevices();
|
||||||
if(devices.size()) {
|
if(devices.size()) {
|
||||||
for(auto d : devices) {
|
for(auto d : devices) {
|
||||||
auto connectAction = ui->menuConnect_to->addAction(d);
|
auto connectAction = ui->menuConnect_to->addAction(d);
|
||||||
deviceActionGroup->addAction(connectAction);
|
|
||||||
connectAction->setCheckable(true);
|
connectAction->setCheckable(true);
|
||||||
|
connectAction->setActionGroup(deviceActionGroup);
|
||||||
if(device && d == device->serial()) {
|
if(device && d == device->serial()) {
|
||||||
connectAction->setChecked(true);
|
connectAction->setChecked(true);
|
||||||
}
|
}
|
||||||
connect(connectAction, &QAction::triggered, [this, connectAction, d]() {
|
connect(connectAction, &QAction::triggered, [this, d]() {
|
||||||
ConnectToDevice(d);
|
ConnectToDevice(d);
|
||||||
if(device) {
|
|
||||||
// connectAction might have been unchecked if it was a reconnect to the already connected device
|
|
||||||
connectAction->setChecked(true);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
ui->menuConnect_to->setEnabled(true);
|
ui->menuConnect_to->setEnabled(true);
|
||||||
|
@ -1,25 +1,48 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<project>
|
<project>
|
||||||
<configuration id="fr.ac6.managedbuild.config.gnu.cross.exe.debug.1502405410" name="Debug">
|
|
||||||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
<configuration id="fr.ac6.managedbuild.config.gnu.cross.exe.debug.1502405410" name="Debug">
|
||||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
|
||||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
|
||||||
<provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="-866672051809137248" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
|
||||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
</provider>
|
|
||||||
</extension>
|
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
</configuration>
|
|
||||||
<configuration id="fr.ac6.managedbuild.config.gnu.cross.exe.release.1788779437" name="Release">
|
<provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="1307432939745961523" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
|
||||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
|
||||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||||
<provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="-866672051809137248" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
|
||||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
</provider>
|
||||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
|
||||||
</provider>
|
</extension>
|
||||||
</extension>
|
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
||||||
|
<configuration id="fr.ac6.managedbuild.config.gnu.cross.exe.release.1788779437" name="Release">
|
||||||
|
|
||||||
|
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||||
|
|
||||||
|
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||||
|
|
||||||
|
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
|
|
||||||
|
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
|
|
||||||
|
<provider class="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" console="false" env-hash="1307432939745961523" id="fr.ac6.mcu.ide.build.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="Ac6 SW4 STM32 MCU Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||||
|
|
||||||
|
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||||
|
|
||||||
|
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||||
|
|
||||||
|
</provider>
|
||||||
|
|
||||||
|
</extension>
|
||||||
|
|
||||||
|
</configuration>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -229,11 +229,9 @@ void App_Start() {
|
|||||||
LOG_INFO("Firmware update process triggered");
|
LOG_INFO("Firmware update process triggered");
|
||||||
auto fw_info = Firmware::GetFlashContentInfo(&flash);
|
auto fw_info = Firmware::GetFlashContentInfo(&flash);
|
||||||
if(fw_info.valid) {
|
if(fw_info.valid) {
|
||||||
Protocol::PacketInfo p;
|
Communication::SendWithoutPayload(Protocol::PacketType::Ack);
|
||||||
p.type = Protocol::PacketType::Ack;
|
|
||||||
Communication::Send(p);
|
|
||||||
// Some delay to allow communication to finish
|
// Some delay to allow communication to finish
|
||||||
vTaskDelay(1000);
|
vTaskDelay(100);
|
||||||
Firmware::PerformUpdate(&flash, fw_info);
|
Firmware::PerformUpdate(&flash, fw_info);
|
||||||
// should never get here
|
// should never get here
|
||||||
Communication::SendWithoutPayload(Protocol::PacketType::Nack);
|
Communication::SendWithoutPayload(Protocol::PacketType::Nack);
|
||||||
|
@ -117,7 +117,9 @@ void FPGA::SetSamplesPerPoint(uint32_t nsamples) {
|
|||||||
// register is in multiples of 128
|
// register is in multiples of 128
|
||||||
nsamples /= 128;
|
nsamples /= 128;
|
||||||
// constrain to maximum value
|
// constrain to maximum value
|
||||||
nsamples &= 0x03FF;
|
if(nsamples >= 1024) {
|
||||||
|
nsamples = 1023;
|
||||||
|
}
|
||||||
WriteRegister(Reg::SamplesPerPoint, nsamples);
|
WriteRegister(Reg::SamplesPerPoint, nsamples);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ Firmware::Info Firmware::GetFlashContentInfo(Flash *f) {
|
|||||||
}
|
}
|
||||||
f->read(h.CPU_start + checked_size, read_size, buf);
|
f->read(h.CPU_start + checked_size, read_size, buf);
|
||||||
if(memcmp(buf, (void*)(0x8000000+checked_size), read_size)) {
|
if(memcmp(buf, (void*)(0x8000000+checked_size), read_size)) {
|
||||||
LOG_WARN("Difference to CPU firmware in external FLASH detected, update required");
|
LOG_INFO("Difference to CPU firmware in external FLASH detected, update required");
|
||||||
ret.CPU_need_update = true;
|
ret.CPU_need_update = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -493,6 +493,11 @@ bool VNA::Ref::applySettings(Protocol::ReferenceSettings s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool VNA::ConfigureGenerator(Protocol::GeneratorSettings g) {
|
bool VNA::ConfigureGenerator(Protocol::GeneratorSettings g) {
|
||||||
|
if(g.activePort == 0) {
|
||||||
|
// both ports disabled, no need to configure PLLs
|
||||||
|
SetIdle();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
Protocol::ManualControl m;
|
Protocol::ManualControl m;
|
||||||
// LOs not required
|
// LOs not required
|
||||||
m.LO1CE = 0;
|
m.LO1CE = 0;
|
||||||
@ -533,13 +538,6 @@ bool VNA::ConfigureGenerator(Protocol::GeneratorSettings g) {
|
|||||||
m.SourceHighband = true;
|
m.SourceHighband = true;
|
||||||
}
|
}
|
||||||
switch(g.activePort) {
|
switch(g.activePort) {
|
||||||
case 0:
|
|
||||||
// no output signal, disable
|
|
||||||
m.AmplifierEN = 0;
|
|
||||||
m.SourceHighCE = 0;
|
|
||||||
m.SourceHighRFEN = 0;
|
|
||||||
m.SourceLowEN = 0;
|
|
||||||
break;
|
|
||||||
case 1:
|
case 1:
|
||||||
m.AmplifierEN = 1;
|
m.AmplifierEN = 1;
|
||||||
m.PortSwitch = 0;
|
m.PortSwitch = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user