Skip to content

Commit

Permalink
Add support for YiXingDianZiKeJi YX-DSO (MSDO)
Browse files Browse the repository at this point in the history
Signed-off-by: Martin <Ho-Ro@users.noreply.github.com>
  • Loading branch information
Ho-Ro committed Apr 2, 2023
2 parents 8006348 + e151829 commit f24ec34
Show file tree
Hide file tree
Showing 6 changed files with 368 additions and 0 deletions.
209 changes: 209 additions & 0 deletions openhantek/res/firmware/mdso-firmware.hex
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
:203D000012010002FFFFFF40501D8E600400010203010A0600020000004001000902890004
:203D200001010080370904000001FF000000070586020002000904000101FF00010007050C
:203D400082010014010904000201FF00010007058201000C010904000301FF000100070502
:203D600082010004010904000401FF000100070582010004020904000501FF0001000705F5
:203D800082010004030904000601FF000100070582010004040904000701FF0001000705CD
:053DA000820100020495
:203DA6000902390002010080370904000001FF000000070586024000000904000101FF0010
:193DC600010007058201FF03010904000201FF00010007058201000201AF
:203DE000040309040E0373006900670072006F006B0010036600780032006C0061006600B9
:203E00007700240359006900580069006E0067004400690061006E005A00690020004D0000
:083E2000440053004F000000B4
:040000000201B9320E
:01000B0032C2
:0100130032BA
:01001B0032B2
:0100230032AA
:03002B000203527B
:030033000202893D
:01003B003292
:01004300328A
:01004B003282
:01005300327A
:01005B003272
:01006300326A
:03006B0002028C02
:03007300020BD0AD
:03007B000207E198
:0300830002033A3B
:03008B000202A4CA
:030093000202EF77
:03009B000207DE7B
:0300A300020BFA53
:0300AB00020BFB4A
:0300B300020BFC41
:0300BB00020BFF36
:0300C300020BCF5E
:0300CB00020BEC39
:0300D300020BED30
:0300DB00020BEF26
:0300E3000207E32E
:0300EB00020C7391
:0300F3000207DF22
:0300FB000207E019
:030103000207E20E
:03010B000207E404
:030113000207E5FB
:03011B00020C567D
:03012300020BF8D4
:03012B00020BFDC7
:03013300020C00BB
:03013B00020C02B1
:03014300020BF9B3
:03014B00020BFEA6
:03015300020C019A
:03015B00020C0390
:03016300020C5536
:03016B00020BF094
:03017300020BF28A
:03017B00020BF480
:03018300020BF676
:03018B00020BF173
:03019300020BF369
:03019B00020BF55F
:0301A300020BF755
:0301AB00020BEE56
:0301B300020BCE6E
:0C021200750800E4F509F50AC200C201FD
:030230000201B612
:0301B6000206EA54
:20023300AF827401B51302801C7402B5130280197405B513028016740AB51302801374108E
:20025300B51312800C7E2480107E12800C7E0080087E36800475820022EF60067D707F00BF
:2002730080047D0E7F00EDF4FFE5805207ED5E4FF58075820122C2DC32C0E0C082C083D24F
:20029300005391EF90E65D7401F0D083D082D0E032C021C0E0C0F0C082C083C007C006C0B6
:2002B30005C004C003C002C001C000C0D075D000758200120ACC5391EF90E65D7410F0D0BE
:2002D300D0D000D001D002D003D004D005D006D007D083D082D0F0D0E0D02132C021C0E0E6
:2002F300C0F0C082C083C007C006C005C004C003C002C001C000C0D075D000758201120AB1
:20031300CC5391EF90E65D7420F0D0D0D000D001D002D003D004D005D006D007D083D082F3
:20033300D0F0D0E0D02132C0E0C082C083D2015391EF90E65D7408F0D083D082D0E032C0C6
:20035300E0C007C006C0D075D000E509450A6013E50924FFFEE50A34FFFF8E098F0AEE4FFB
:20037300700100C2CFD0D0D006D007D0E032E582FF30E00543B108800353B1F7EF30E4043D
:2003930043B1012253B1FE22AF82BF01028003BF021174072FFF90E618F090E61AEFF075BC
:2003B3008201227582002290E6F574FFF000000090E6047480F000000090E6047482F000E0
:2003D300000090E6047486F000000090E604E4F02290E6F574FFF0000000E50870057E0682
:2003F300FF80047E027F0090E648EEF0221203BA7EE87F031EBEFF011FEE4F70F7E5BB3084
:20041300E7FB00000090E6D07428F000000090E6D1E4F0E50870057E06FF80047E047F0090
:200433008EBB00E4F509F50A22AF8290E680E030E7067D1C7E3D80047DA67E3D8F03E4CB42
:20045300C4CB6BCB54F0CB6BFC74162BFBE43CFCEB2DFDEC3EFC7E80EFF508703590E61230
:20047300E4F090E61474E0F090E6E27401F08D828C838EF0120C5790E625F074012DFAE4EE
:200493003CFB8E078A828B838FF0120C5790E624F02290E61274D8F090E614E4F090E6D259
:2004B30004F08D828C838EF0120C5790E621F00DBD00010C8D828C838EF0120C57FF90E640
:2004D3002074075FF08D828C838EF0120C57C423541F90E64004F022AF827E00EE75F007DF
:2004F300A4FCADF02478F582ED340CF583E493FBB5070280080EBE0CE375820022EC2478E0
:20051300FCED340CFD74062CF582E43DF583E49390E601F075AF07759DE4759E008C828D3F
:2005330083A3E49390E67CF08C828D83A3A3E49390E67CF07401F0E4F0F0F0F0F08C828DD8
:2005530083A3A3A39390E67CF08C828D83A3A3A3A3E49390E67CF07401F0E4F0F0F0F0F0AB
:200573008C828D83A3A3A3A3A39390E67CF07411F0F0E4F0F0F0F0F0F0F0F0F0F0F0F0F02D
:200593007F0090E67CE4F00FBF600040F575820122AF82BF0002800FBF01028014BF0A02E4
:2005B3008019BF322A801E75CAF075CBD87582012275CA1875CBFC7582012275CA9C75CBAD
:2005D300FF7582012275CAEC75CBFF7582012275820022AD13AE14AF158D828E838FF0E588
:2005F30008120BD175820122E5827006850B8212043C758201227582002275820122AF8219
:20061300C0071203E4D007007509E8750A03BFE0004015EF2419401090E68AE4F090E68B03
:20063300F090E6A0E020E1F9BFE00050030206A3EF2419405BEF2420FE2E90065173800C1E
:20065300800A801B80268033803E8040EF2420FF90E740E0F5138F821202337582012290B8
:20067300E740E0F5821204EB7582012290E740E0FFBF01031204007582012290E740E0F5B9
:200693008212039B7582012275820122758201227582002290E613E4F090E615F090E6C29E
:2006B300F090E6C37480F090E6C0E4F090E6F4F01203E475130175820012023375130175F8
:2006D30082011202337582011204EB75820212039B75820002043C90E600E053E0E7F012F0
:2006F30006A7E500D2E890E668E043E008F090E65CE043E001F090E65CE043E010F090E6B1
:200713005CE043E020F090E65CE043E008F0D2DDD2AF75CA0C75CBFE75C800D2ADD2CA90E9
:20073300E680E043E00AF09005DC120C0490E680E053E0F7F090E672E4F090E671F090E6B7
:2007530070F075B6FF75B4FF75B2FF10000280031207E610010280F390E682E043E0C0F0E9
:2007730090E6817401F043870100000000000000E50E701C90E682E030E60790E682E020D3
:20079300E0D690E682E030E70790E682E020E1C890E682E030E60790E682E020E00E90E6A8
:2007B30082E030E7A690E682E030E19F900005120C0490E680E043E001F090000F120C041D
:0B07D30090E680E053E0FEF002075EBD
:200C7800308000030000EA1E8000030000AA180100020110CA100101020010CA0C0201027F
:200C98000010CA080302020010CA040605020010CA020C0B020010CA011817020010CA325B
:140CB800302F020010CA147877020010CA0AF0EF020010CA49
:0107DE0032E8
:0107DF0032E7
:0107E00032E6
:0107E10032E5
:0107E20032E4
:0107E30032E3
:0107E40032E2
:0107E50032E1
:0601E800E478FFF6D8FDEB
:12021E00750D00750E00750FA675103D75111C75123D77
:2007E60090E6B9E0FF24F450030208DCEF240A83F582EF241083F583E473182DDC42DCDCED
:2008060057DC5D748BBE080808080808080808080808120952E58260030208F190E6A0E0FD
:2008260043E001F00208F11209E6E58260030208F190E6A0E043E001F00208F1120A34E5A3
:200846008260030208F190E6A0E043E001F00208F1120AF70208F1120609AF8290E740EFA7
:20086600F090E68AE4F090E68B04F00208F190E6BAE0F58212060DE582707090E6A0E04392
:20088600E001F0806690E6BCE0FF75130C7514007515408F821205E6E582700A90E6A0E0BE
:2008A60043E001F0804590E740E50CF090E68AE4F090E68B04F0803390E6BCE0FF90E6BA04
:2008C600E0F50B8F821205FBE582701F90E6A0E043E001F0801590E6B9E0F582120611E5E6
:2008E60082700890E6A0E043E001F090E6A0E043E080F022AF82747F5FFE24F75003020949
:200906004EEE240A83F582EE240D83F583E473272B3E4E424E464E4A090909090909090968
:200926000990E6A022EF30E7067EA27FE680047EA17FE68E828F832290E6A32290E6A4221C
:2009460090E6A52290E6A6229000002290E6B8E0FFBF80028022BF81028008BF82028037B0
:200966000209DE90E740E4F090E741F090E68AF090E68B7402F08064E50E25E0FFE50D42EF
:200986000790E740EFF090E741E4F090E68AF090E68B7402F0804590E6BCE0F5821208FA6F
:2009A600AE82AF838E048F05EE4F7003F582228C828D83E0FC30E0067E017F0080047E0050
:2009C6007F0090E740EEF090E741E4F090E68AF090E68B7402F08004758200227582012263
:2009E60090E6B8E0FF6005BF0237801190E6BAE0FFBF0105750E0080317582002290E6BAA5
:200A0600E0701A90E6BCE0F5821208FAAE82AF83E0FD5305FE8E828F83EDF0800D758200B1
:200A26002290E6B9E0F5820206117582012290E6B8E0FF6008BF02028020020ABF90E6BA02
:200A4600E0FFBF0203020AC890E6BAE0FFBF0106750E01020AC87582002290E6BAE07055FE
:200A660090E6BCE0F5821208FAAE82AF83EE4F7003F582228E828F83E0FD4305018E828F41
:200A860083EDF090E6BCE0FF53070F90E6BCE0FE530680E4C423CEC423541F6ECE541FCE1D
:200AA6006ECE30E40244E0FD90E683EE2FF0E043E020F0800D7582002290E6B9E0F5820276
:200AC600061175820122AF82D20210AF02C202EF600E750F1C75103D7511A675123D800C1A
:200AE600750FA675103D75111C75123DA20292AF2290E6BBE0FFBF01028019BF02028024C5
:200B0600BF0302802CBF0603020BA8BF0703020BB8020BC57E007F3D90E6B3EFF090E6B416
:200B26007400F02290E6B3E510F090E6B4E50FF0227DE07E3D7F8090E6BAE0F5137B00EB56
:200B4600B5130280430B8D008E018F028D828E838FF0120C5728F8E439F9880589068A0753
:200B660074012DF9E43EFA8F0489828A838CF0120C57F9B9030280067D007E007F00ED4E2A
:200B86006006C3E5139B50B7ED4E600D8E0490E6B3ECF090E6B4EDF02290E6A0E043E0010A
:200BA600F0227E127F3D90E6B3EFF090E6B47412F02290E6B3E512F090E6B4E511F0229035
:080BC600E6A0E043E001F0228B
:2001C6007900E94400601B7A00900CCC780075923CE493F2A308B800020592D9F4DAF275E8
:0201E60092FF86
:010BCE0032F4
:010BCF0032F3
:010BD00032F2
:1B0BD10020F71130F6138883A88220F509F6A8837583002280FEF280F5F02223
:010BEC0032D6
:010BED0032D5
:010BEE0032D4
:010BEF0032D3
:03004300023F0079
:203F000002028C00020BD0000207E10002033A000202A4000202EF000207DE00020BF90083
:203F2000020BFA00020BFB00020BFC00020BFF00020BCF00020BEC00020BED00020BEF0092
:203F40000207E300020BF900020C73000207DF000207E0000207E2000207E4000207E50057
:203F6000020C5600020BF900020BF900020BF900020BF800020BFD00020C0000020C02009E
:203F8000020BFE00020C0100020C0300020C5500020BF000020BF200020BF400020BF60093
:183FA000020BF100020BF300020BF500020BF700020BEE00020BCE002F
:010BF00032D2
:010BF10032D1
:2001EE007800E84400600A790075923CE4F309D8FC7800E84400600C7900903C00E4F0A3A7
:04020E00D8FCD9FA45
:010BF20032D0
:010BF30032CF
:010BF40032CE
:010BF50032CD
:010BF60032CC
:010BF70032CB
:010BF80032CA
:010BF90032C9
:010BFA0032C8
:010BFB0032C7
:010BFC0032C6
:010BFD0032C5
:010BFE0032C4
:010BFF0032C3
:010C000032C1
:010C010032C0
:010C020032BF
:010C030032BE
:200C0400AE82AF8390E600E05418C423541F70057CB1FD801C90E600E05418C423541FFB00
:200C2400BB01067A617B0180047AC27B028A048B058C138D14E51324FFFAE51434FFFB8A36
:110C4400138B14EA4B70EE1EBEFF011FEE4F70E122AF
:010C5500326C
:010C5600326B
:0D01B900758121120C74E58260030201B60D
:1C0C570020F71430F6148883A88220F507E6A88375830022E280F7E49322E022AC
:010C7300324E
:040C74007582002263
:00000001FF
1 change: 1 addition & 0 deletions openhantek/res/firmwares.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
<file>firmware/dso6022be-firmware.hex</file>
<file>firmware/dso6022bl-firmware.hex</file>
<file>firmware/dds120-firmware.hex</file>
<file>firmware/mdso-firmware.hex</file>
</qresource>
</RCC>
101 changes: 101 additions & 0 deletions openhantek/src/hantekdso/models/modelMDSO.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
// SPDX-License-Identifier: GPL-2.0-or-later

#include "modelMDSO.h"
#include "hantekdsocontrol.h"
#include "hantekprotocol/controlStructs.h"
#include "usb/scopedevice.h"
#include <QDebug>
#include <QDir>
#include <QSettings>

#define VERBOSE 0

using namespace Hantek;

static ModelMDSO modelInstance_1D50;

static void initSpecifications( Dso::ControlSpecification &specification ) {
// we drop 2K + 480 sample values due to unreliable start of stream
// 20000 samples at 100kS/s = 200 ms gives enough to fill
// the screen two times (for pre/post trigger) at 10ms/div = 100ms/screen
// SAMPLESIZE defined in hantekdsocontrol.h
// adapt accordingly in HantekDsoControl::convertRawDataToSamples()

// HW gain, voltage steps in V/div (ranges 20,50,100,200,500,1000,2000,5000 mV)
specification.gain = { { 10, 20e-3 }, { 10, 50e-3 }, { 10, 100e-3 }, { 5, 200e-3 },
{ 2, 500e-3 }, { 1, 1.00 }, { 1, 2.00 }, { 1, 5.00 } };


// Define the scaling between ADC sample values and real input voltage
// Everything is scaled on the full screen height (8 divs)
// The voltage/div setting: 20m 50m 100m 200m 500m 1V 2V 5V
// Equivalent input voltage: 0.16V 0.4V 0.8V 1.6V 4V 8V 16V 40V
// Theoretical gain setting: x10 x10 x10 x5 x2 x1 x1 x1
// mV / digit: 4 4 4 8 20 40 40 40
specification.voltageScale[ 0 ] = { 250, 250, 250, 126.25, 49.50, 24.75, 24.75, 24.75 };
specification.voltageScale[ 1 ] = { 250, 250, 250, 126.25, 49.50, 24.75, 24.75, 24.75 };
// Gain and offset can be corrected by individual config values from file (device has no calibration EEPROM)



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

// 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)

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.hasACcoupling = false; // MDSO has AC coupling
specification.triggerModes = {
Dso::TriggerMode::AUTO,
Dso::TriggerMode::NORMAL,
Dso::TriggerMode::SINGLE,
Dso::TriggerMode::ROLL,
};
specification.fixedUSBinLength = 0;
// 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 ) {
dsoControl->addCommand( new ControlSetGain_CH1() ); // 0xE0
dsoControl->addCommand( new ControlSetGain_CH2() ); // 0xE1
dsoControl->addCommand( new ControlSetSamplerate() ); // 0xE2
dsoControl->addCommand( new ControlStartSampling() ); // 0xE3
dsoControl->addCommand( new ControlSetNumChannels() ); // 0xE4
dsoControl->addCommand( new ControlSetCoupling() ); // 0xE5
dsoControl->addCommand( new ControlSetCalFreq() ); // 0xE6
}

// VID/PID active VID/PID no FW FW ver FW name Scope name
// |------------| |------------| |----| |------| |------|
ModelMDSO::ModelMDSO()
: DSOModel( ID, 0x1d50, 0x608e, 0xd4a2, 0x5660, 0x0001, "mdso", "MDSO", Dso::ControlSpecification( 2 ) ) {
initSpecifications( specification );
}

void ModelMDSO::applyRequirements( HantekDsoControl *dsoControl ) const { applyRequirements_( dsoControl ); }
15 changes: 15 additions & 0 deletions openhantek/src/hantekdso/models/modelMDSO.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include "dsomodel.h"

class HantekDsoControl;
using namespace Hantek;


struct ModelMDSO : public DSOModel {
static const int ID = 0x1D50;
ModelMDSO();
void applyRequirements( HantekDsoControl *dsoControl ) const override;
};
38 changes: 38 additions & 0 deletions openhantek/src/hantekdso/models/modelMDSO.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[eeprom]
replace_eeprom=true

[gain]
ch0\1000mV=1
ch0\100mV=1
ch0\2000mV=1
ch0\200mV=1
ch0\20mV=1
ch0\5000mV=1
ch0\500mV=1
ch0\50mV=1
ch1\1000mV=1
ch1\100mV=1
ch1\2000mV=1
ch1\200mV=1
ch1\20mV=1
ch1\5000mV=1
ch1\500mV=1
ch1\50mV=1

[offset]
ch0\1000mV=4.82
ch0\100mV=0
ch0\2000mV=4.84
ch0\200mV=5.11
ch0\20mV=7.64
ch0\5000mV=4.81
ch0\500mV=4.95
ch0\50mV=7.58
ch1\1000mV=4.05
ch1\100mV=1.09
ch1\2000mV=4.04
ch1\200mV=3.66
ch1\20mV=1.09
ch1\5000mV=4.05
ch1\500mV=4.01
ch1\50mV=1.1
4 changes: 4 additions & 0 deletions utils/udev_rules/60-openhantek.rules
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@ ATTRS{idVendor}=="04b5", ATTRS{idProduct}=="0120", TAG+="uaccess", TAG+="udev-ac
ATTRS{idVendor}=="04b4", ATTRS{idProduct}=="6021", TAG+="uaccess", TAG+="udev-acl", MODE="660", GROUP="plugdev"
ATTRS{idVendor}=="04b5", ATTRS{idProduct}=="6021", TAG+="uaccess", TAG+="udev-acl", MODE="660", GROUP="plugdev"

# YiXingDianZiKeJi MDSO, without FW, with FW
ATTRS{idVendor}=="d4a2", ATTRS{idProduct}=="5660", TAG+="uaccess", TAG+="udev-acl", MODE="660", GROUP="plugdev"
ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="608e", TAG+="uaccess", TAG+="udev-acl", MODE="660", GROUP="plugdev"

LABEL="openhantek_rules_end"

0 comments on commit f24ec34

Please sign in to comment.