Skip to content

Commit

Permalink
revert to sigrok based FW for DDS120
Browse files Browse the repository at this point in the history
Signed-off-by: Martin <[email protected]>
  • Loading branch information
Ho-Ro committed Apr 6, 2020
1 parent b2c5492 commit 476b78d
Show file tree
Hide file tree
Showing 7 changed files with 246 additions and 309 deletions.
468 changes: 213 additions & 255 deletions openhantek/res/firmware/dds120-firmware.hex

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion openhantek/src/OH_BUILD.h
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// Do not edit, will be re-created at each commit!
#define OH_BUILD "20200406 build 636"
#define OH_BUILD "20200406 build 637"
7 changes: 3 additions & 4 deletions openhantek/src/hantekdso/controlspecification.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@ using namespace Hantek;
struct ControlSamplerateLimits {
double base; ///< The base for sample rate calculations
double max; ///< The maximum sample rate
unsigned int maxDownsampler; ///< The maximum downsampling ratio
std::vector<unsigned> recordLengths; ///< Available record lengths, UINT_MAX means rolling
};

/// \brief Stores the samplerate limits.
struct ControlSpecificationSamplerate {
ControlSamplerateLimits single = {50e6, 50e6, 0, std::vector<unsigned>()}; ///< The limits for single channel mode
ControlSamplerateLimits multi = {100e6, 100e6, 0, std::vector<unsigned>()}; ///< The limits for multi channel mode
ControlSamplerateLimits single = {50e6, 50e6, std::vector<unsigned>()}; ///< The limits for single channel mode
ControlSamplerateLimits multi = {100e6, 100e6, std::vector<unsigned>()}; ///< The limits for multi channel mode
};

struct ControlSpecificationGainLevel {
Expand Down Expand Up @@ -52,7 +51,7 @@ struct ControlSpecification {

// Calibration
/// DSO6022 has calibration in small EEPROM, DDS120 has big fw EEPROM
bool hasCalibrationStorage = true;
bool hasCalibrationEEPROM = true;
/// The sample values at the top of the screen
typedef std::vector<int> VoltageScale;
std::vector<VoltageScale> voltageScale; // Per channel
Expand Down
2 changes: 1 addition & 1 deletion openhantek/src/hantekdso/hantekdsocontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ Dso::ErrorCode HantekDsoControl::retrieveChannelLevelData() {
// Get calibration data from EEPROM
//printf( "retrieveChannelLevelData()\n" );
int errorCode = -1;
if ( specification->hasCalibrationStorage )
if ( specification->hasCalibrationEEPROM )
errorCode = device->controlRead(&controlsettings.cmdGetLimits);
if ( errorCode < 0) {
// invalidate the calibration values.
Expand Down
70 changes: 26 additions & 44 deletions openhantek/src/hantekdso/models/modelDDS120.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ static void initSpecifications(Dso::ControlSpecification& specification) {
// the screen two times (for pre/post trigger) at 10ms/div = 100ms/screen
// SAMPLESIZE defined in modelDDS120.h
// adapt accordingly in HantekDsoControl::convertRawDataToSamples()
specification.samplerate.single.base = 1e6;
specification.samplerate.single.max = 30e6;
specification.samplerate.single.maxDownsampler = 100;
specification.samplerate.single.recordLengths = { UINT_MAX };
specification.samplerate.multi.base = 1e6;
specification.samplerate.multi.max = 15e6;
specification.samplerate.multi.maxDownsampler = 100;
specification.samplerate.multi.recordLengths = { UINT_MAX };
specification.bufferDividers = { 1000 , 1 , 1 };
// This data was based on testing and depends on divider.
// The sample value at the top of the screen with gain error correction
Expand Down Expand Up @@ -89,54 +81,44 @@ static void initSpecifications(Dso::ControlSpecification& specification) {
};


// Possible raw sample rates with custom fw from https://github.com/Ho-Ro/Hantek6022API
// 20k, 50k, 64k, 100k, 200k, 500k, 1M, 2M, 3M, 4M, 5M, 6M, 8M, 10M, 12M, 15M, 16M, 24M, 30M (, 48M)
// 48M is unusable in 1 channel mode due to massive USB overrun
// 24M, 30M and 48M are unusable in 2 channel mode
// these unstable settings are disabled
// Lower effective sample rates < 10 MS/s use oversampling to increase the SNR

specification.samplerate.single.base = 1e6;
specification.samplerate.single.max = 30e6;
specification.samplerate.single.maxDownsampler = 10;
specification.samplerate.single.recordLengths = { UINT_MAX };
specification.samplerate.multi.base = 1e6;
specification.samplerate.multi.max = 15e6;
specification.samplerate.multi.maxDownsampler = 10;
specification.samplerate.multi.recordLengths = { UINT_MAX };

// define VERY_SLOW_SAMPLES to get timebase up to 1s/div at the expense of very slow reaction time (up to 20 s)
//#define VERY_SLOW_SAMPLES
specification.fixedSampleRates = { // samplerate, sampleId, downsampling
#ifdef VERY_SLOW_SAMPLES
{ 1e3, 110, 100}, // 100x downsampling from 100, 200, 500 kS/s!
{ 2e3, 120, 100}, //
{ 5e3, 150, 100}, //
#endif
{ 10e3, 1, 100}, // 100x downsampling from 1, 2, 5, 10 MS/s!
{ 20e3, 2, 100}, //
{ 50e3, 5, 100}, //
{100e3, 10, 100}, //
{200e3, 10, 50}, // 50x, 20x 10x, 5x, 2x downsampling from 10 MS/s
{500e3, 10, 20}, //
{ 1e6, 10, 10}, //
{ 2e6, 10, 5}, //
{ 5e6, 10, 2}, //
{ 10e6, 10, 1}, // no oversampling
{ 12e6, 12, 1}, //
{ 15e6, 15, 1}, //
{ 24e6, 24, 1}, //
{ 30e6, 30, 1}, //
{ 48e6, 48, 1} //
// This model uses the sigrok firmware that has a slightly different coding for the sample rate than my Hantek6022API version.
// 10=100k, 20=200k, 50=500k, 11=10M (Hantek: 110=100k, 120=200k, 150=500k, 10=10M)

// 48M is unstable in 1 channel mode
// 24M, 30M and 48M are unstable in 2 channel mode

specification.fixedSampleRates = {
// samplerate, sampleId, downsampling
{ 10e3, 1, 100}, // 100x downsampling from 1 MS/s!
{ 20e3, 2, 100}, // 100x downsampling from 2 MS/s!
{ 50e3, 5, 100}, // 100x downsampling from 5 MS/s!
{100e3, 8, 80}, // 80x downsampling from 8 MS/s
{200e3, 8, 40}, // 40x downsampling from 8 MS/s
{500e3, 8, 16}, // 16x downsampling from 8 MS/s
{ 1e6, 8, 8}, // 8x downsampling from 8 MS/s
{ 2e6, 8, 4}, // 4x downsampling from 8 MS/s
{ 5e6, 15, 3}, // 3x downsampling from 15 MS/s
{ 10e6, 11, 1}, // no downsampling, 11 means 10 MS/s
{ 15e6, 15, 1}, // no downsampling
{ 24e6, 24, 1}, // no downsampling
{ 30e6, 30, 1}, // no downsampling
{ 48e6, 48, 1} // no downsampling
};


specification.couplings = {Dso::Coupling::DC, Dso::Coupling::AC};
specification.triggerModes = {Dso::TriggerMode::AUTO, Dso::TriggerMode::NORMAL, Dso::TriggerMode::SINGLE};
specification.fixedUSBinLength = 0;
// calibration frequency (requires >FW0206)
specification.calfreqSteps = { 50, 60, 100, 200, 500, 1e3, 2e3, 5e3, 10e3, 20e3, 50e3, 100e3 };
specification.hasCalibrationStorage = false;
// use calibration frequency steps of modified sigrok FW (<= 20 kHz)
specification.calfreqSteps = { 50, 60, 100, 200, 500, 1000, 2000, 5000, 10000, 20000 };
specification.hasCalibrationEEPROM = false;
}

static void applyRequirements_(HantekDsoControl *dsoControl) {
Expand All @@ -151,7 +133,7 @@ static void applyRequirements_(HantekDsoControl *dsoControl) {

// VID/PID active VID/PID no FW FW ver FW name Scope name
// |------------| |------------| |----| |------| |------|
ModelDDS120::ModelDDS120() : DSOModel(ID, 0x04b5, 0x0120, 0x8102, 0x8102, 0x0206, "dds120", "DDS120",
ModelDDS120::ModelDDS120() : DSOModel(ID, 0x04b5, 0x0120, 0x8102, 0x8102, 0x0100, "dds120", "DDS120",
Dso::ControlSpecification(2)) {
initSpecifications(specification);
}
Expand Down
4 changes: 1 addition & 3 deletions openhantek/src/hantekdso/models/modelDSO6022.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,9 @@ static void initSpecifications(Dso::ControlSpecification& specification) {

specification.samplerate.single.base = 1e6;
specification.samplerate.single.max = 30e6;
specification.samplerate.single.maxDownsampler = 10;
specification.samplerate.single.recordLengths = { UINT_MAX };
specification.samplerate.multi.base = 1e6;
specification.samplerate.multi.max = 15e6;
specification.samplerate.multi.maxDownsampler = 10;
specification.samplerate.multi.recordLengths = { UINT_MAX };

// define VERY_SLOW_SAMPLES to get timebase up to 1s/div at the expense of very slow reaction time (up to 20 s)
Expand Down Expand Up @@ -138,7 +136,7 @@ static void initSpecifications(Dso::ControlSpecification& specification) {

// calibration frequency (requires >FW0206)
specification.calfreqSteps = { 50, 60, 100, 200, 500, 1e3, 2e3, 5e3, 10e3, 20e3, 50e3, 100e3 };
specification.hasCalibrationStorage = true;
specification.hasCalibrationEEPROM = true;
}

static void applyRequirements_(HantekDsoControl *dsoControl) {
Expand Down
2 changes: 1 addition & 1 deletion utils/udev_rules/60-hantek.rules
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="0

# BUUDAI DDS120
SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="8102", ATTRS{idProduct}=="8102", TAG+="uaccess", TAG+="udev-acl"
SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="608e", TAG+="uaccess", TAG+="udev-acl"
SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", ATTRS{idVendor}=="04b5", ATTRS{idProduct}=="0120", TAG+="uaccess", TAG+="udev-acl"

0 comments on commit 476b78d

Please sign in to comment.