├── .github
└── workflows
│ └── Build.yml
├── .gitignore
├── AssembleFirmware.py
├── Documentation
├── .gitignore
├── DeveloperInfo
│ ├── .gitignore
│ ├── BuildAndFlash.md
│ ├── DigitalBlockdiagram.pdf
│ ├── DigitalBlockdiagram.svg
│ ├── DigitalBlockdiagram.tex
│ ├── FPGA_protocol.pdf
│ ├── FPGA_protocol.tex
│ ├── PowerBlockdiagram.pdf
│ ├── PowerBlockdiagram.svg
│ ├── PowerBlockdiagram.tex
│ ├── RFBlockdiagram.pdf
│ ├── RFBlockdiagram.svg
│ ├── RFBlockdiagram.tex
│ ├── VersionsAndModifications.md
│ └── circuitikzgit.sty
├── FAQ.md
├── Measurements
│ ├── Measurements.md
│ ├── Mini-circuits_VAT-10+.png
│ ├── Mini-circuits_VAT-10+.s2p
│ ├── Mini-circuits_VAT-6+.png
│ ├── Mini-circuits_VAT-6+.s2p
│ ├── Murata_RF1419D.png
│ ├── Murata_RF1419D.s2p
│ ├── Prototype_Isolation_SOLT+iso.png
│ ├── Prototype_Isolation_SOLT+iso.s2p
│ ├── Prototype_Isolation_SOLT.png
│ ├── Prototype_Isolation_SOLT.s2p
│ ├── SA_1GHz_SignalIDOff.png
│ └── SA_1GHz_SignalIDOn.png
├── Pictures
│ ├── .gitignore
│ ├── firstPrototypeAdditionalHoles.JPG
│ ├── firstPrototypeBottom.JPG
│ ├── firstPrototypeMod1.JPG
│ ├── firstPrototypeMod2.JPG
│ ├── firstPrototypeTop.jpg
│ ├── secondPrototypeBottom.JPG
│ └── secondPrototypeTop.JPG
└── UserManual
│ ├── Screenshots
│ ├── ApplicationOverview.png
│ ├── CalKitOpenMeasurement.png
│ ├── CalKitSolt.png
│ ├── CalKitTRL.png
│ ├── CalibrationMeasurements.png
│ ├── CalibrationMeasurementsSOLT.png
│ ├── DialogFirmwareUpdate.png
│ ├── DialogManualControl.png
│ ├── DockDeviceLog.png
│ ├── MenuActivateSOLT.png
│ ├── SASignalIDOff.png
│ ├── SASignalIDOn.png
│ ├── Signalgenerator.png
│ ├── SourceCalibration.png
│ ├── ToolbarActivateSOLT.png
│ ├── ToolbarReference.png
│ ├── ToolbarSAAcquisition.png
│ ├── ToolbarSweep.png
│ ├── ToolbarTrackingGenerator.png
│ ├── ToolbarVNAAcquisition.png
│ ├── VNACalibratedThrough.png
│ └── VNAUncalibratedThrough.png
│ ├── TopDrawing.pdf
│ ├── manual.pdf
│ └── manual.tex
├── FPGA
├── .gitignore
├── VNA
│ ├── DFT.vhd
│ ├── Flattop.dat
│ ├── Hann.dat
│ ├── Kaiser.dat
│ ├── MAX2871.vhd
│ ├── MCP33131.vhd
│ ├── ResetDelay.vhd
│ ├── SPIConfig.vhd
│ ├── Sampling.vhd
│ ├── Sweep.vhd
│ ├── Synchronizer.vhd
│ ├── Test_DFT.vhd
│ ├── Test_MAX2871.vhd
│ ├── Test_MCP33131.vhd
│ ├── Test_PLL.vhd
│ ├── Test_SPI.vhd
│ ├── Test_SPICommands.vhd
│ ├── Test_Sampling.vhd
│ ├── Test_SinCos.vhd
│ ├── Test_Window.vhd
│ ├── Test_Windowing.vhd
│ ├── VNA.gise
│ ├── VNA.xise
│ ├── Windowing.vhd
│ ├── ipcore_dir
│ │ ├── .gitignore
│ │ ├── DSP48.xco
│ │ ├── DSP48.xise
│ │ ├── DSP_SLICE.xco
│ │ ├── DSP_SLICE.xise
│ │ ├── PLL.xco
│ │ ├── PLL.xise
│ │ ├── SinCos.xco
│ │ ├── SinCos.xise
│ │ ├── SweepConfigMem.xco
│ │ ├── SweepConfigMem.xise
│ │ ├── result_bram.xco
│ │ └── result_bram.xise
│ ├── spi_slave.vhd
│ ├── top.bin
│ ├── top.ucf
│ ├── top.vhd
│ └── window.vhd
└── WindowCoefficientGenerator.py
├── Hardware
├── BOM.ods
├── BottomShield.step
├── PCBtop.png
├── Schematic.pdf
├── TopShield.step
├── VNA.brd
├── VNA.sch
└── VNARendering.png
├── LICENSE
├── README.md
└── Software
├── .gitignore
├── HelperTools
└── SignalIDSamplerates
│ ├── .cproject
│ ├── .gitignore
│ ├── .project
│ ├── .settings
│ └── language.settings.xml
│ └── src
│ └── SignalIDSamplerates.cpp
├── PC_Application
├── .gitignore
├── 51-vna.rules
├── Application.pro
├── Calibration
│ ├── addamplitudepointsdialog.ui
│ ├── amplitudecaldialog.cpp
│ ├── amplitudecaldialog.h
│ ├── amplitudecaldialog.ui
│ ├── automaticamplitudedialog.ui
│ ├── calibration.cpp
│ ├── calibration.h
│ ├── calibrationtracedialog.cpp
│ ├── calibrationtracedialog.h
│ ├── calibrationtracedialog.ui
│ ├── calkit.cpp
│ ├── calkit.h
│ ├── calkitdialog.cpp
│ ├── calkitdialog.h
│ ├── calkitdialog.ui
│ ├── measurementmodel.cpp
│ ├── measurementmodel.h
│ ├── receivercaldialog.cpp
│ ├── receivercaldialog.h
│ ├── sourcecaldialog.cpp
│ └── sourcecaldialog.h
├── CustomWidgets
│ ├── colorpickerbutton.cpp
│ ├── colorpickerbutton.h
│ ├── informationbox.cpp
│ ├── informationbox.h
│ ├── siunitedit.cpp
│ ├── siunitedit.h
│ ├── tilewidget.cpp
│ ├── tilewidget.h
│ ├── tilewidget.ui
│ ├── toggleswitch.cpp
│ ├── toggleswitch.h
│ ├── touchstoneimport.cpp
│ ├── touchstoneimport.h
│ └── touchstoneimport.ui
├── Device
│ ├── device.cpp
│ ├── device.h
│ ├── devicelog.cpp
│ ├── devicelog.h
│ ├── devicelog.ui
│ ├── firmwareupdatedialog.cpp
│ ├── firmwareupdatedialog.h
│ ├── firmwareupdatedialog.ui
│ ├── manualcontroldialog.cpp
│ ├── manualcontroldialog.h
│ └── manualcontroldialog.ui
├── Generator
│ ├── generator.cpp
│ ├── generator.h
│ ├── signalgenwidget.cpp
│ ├── signalgenwidget.h
│ └── signalgenwidget.ui
├── SpectrumAnalyzer
│ ├── spectrumanalyzer.cpp
│ ├── spectrumanalyzer.h
│ ├── tracewidgetsa.cpp
│ └── tracewidgetsa.h
├── Tools
│ ├── eseries.cpp
│ ├── eseries.h
│ ├── impedancematchdialog.cpp
│ ├── impedancematchdialog.h
│ ├── impedancematchdialog.ui
│ ├── parameters.cpp
│ └── parameters.h
├── TraceSetup
├── Traces
│ ├── Math
│ │ ├── dft.cpp
│ │ ├── dft.h
│ │ ├── dftdialog.ui
│ │ ├── dftexplanationwidget.ui
│ │ ├── expression.cpp
│ │ ├── expression.h
│ │ ├── expressiondialog.ui
│ │ ├── expressionexplanationwidget.ui
│ │ ├── medianexplanationwidget.ui
│ │ ├── medianfilter.cpp
│ │ ├── medianfilter.h
│ │ ├── medianfilterdialog.ui
│ │ ├── newtracemathdialog.ui
│ │ ├── parser
│ │ │ ├── mpCompat.h
│ │ │ ├── mpDefines.h
│ │ │ ├── mpError.cpp
│ │ │ ├── mpError.h
│ │ │ ├── mpFuncCmplx.cpp
│ │ │ ├── mpFuncCmplx.h
│ │ │ ├── mpFuncCommon.cpp
│ │ │ ├── mpFuncCommon.h
│ │ │ ├── mpFuncMatrix.cpp
│ │ │ ├── mpFuncMatrix.h
│ │ │ ├── mpFuncNonCmplx.cpp
│ │ │ ├── mpFuncNonCmplx.h
│ │ │ ├── mpFuncStr.cpp
│ │ │ ├── mpFuncStr.h
│ │ │ ├── mpFwdDecl.h
│ │ │ ├── mpICallback.cpp
│ │ │ ├── mpICallback.h
│ │ │ ├── mpIOprt.cpp
│ │ │ ├── mpIOprt.h
│ │ │ ├── mpIPackage.cpp
│ │ │ ├── mpIPackage.h
│ │ │ ├── mpIPrecedence.h
│ │ │ ├── mpIToken.cpp
│ │ │ ├── mpIToken.h
│ │ │ ├── mpIValReader.cpp
│ │ │ ├── mpIValReader.h
│ │ │ ├── mpIValue.cpp
│ │ │ ├── mpIValue.h
│ │ │ ├── mpIfThenElse.cpp
│ │ │ ├── mpIfThenElse.h
│ │ │ ├── mpMatrix.h
│ │ │ ├── mpMatrixError.h
│ │ │ ├── mpOprtBinAssign.cpp
│ │ │ ├── mpOprtBinAssign.h
│ │ │ ├── mpOprtBinCommon.cpp
│ │ │ ├── mpOprtBinCommon.h
│ │ │ ├── mpOprtCmplx.cpp
│ │ │ ├── mpOprtCmplx.h
│ │ │ ├── mpOprtIndex.cpp
│ │ │ ├── mpOprtIndex.h
│ │ │ ├── mpOprtMatrix.cpp
│ │ │ ├── mpOprtMatrix.h
│ │ │ ├── mpOprtNonCmplx.cpp
│ │ │ ├── mpOprtNonCmplx.h
│ │ │ ├── mpOprtPostfixCommon.cpp
│ │ │ ├── mpOprtPostfixCommon.h
│ │ │ ├── mpPackageCmplx.cpp
│ │ │ ├── mpPackageCmplx.h
│ │ │ ├── mpPackageCommon.cpp
│ │ │ ├── mpPackageCommon.h
│ │ │ ├── mpPackageMatrix.cpp
│ │ │ ├── mpPackageMatrix.h
│ │ │ ├── mpPackageNonCmplx.cpp
│ │ │ ├── mpPackageNonCmplx.h
│ │ │ ├── mpPackageStr.cpp
│ │ │ ├── mpPackageStr.h
│ │ │ ├── mpPackageUnit.cpp
│ │ │ ├── mpPackageUnit.h
│ │ │ ├── mpParser.cpp
│ │ │ ├── mpParser.h
│ │ │ ├── mpParserBase.cpp
│ │ │ ├── mpParserBase.h
│ │ │ ├── mpParserMessageProvider.cpp
│ │ │ ├── mpParserMessageProvider.h
│ │ │ ├── mpRPN.cpp
│ │ │ ├── mpRPN.h
│ │ │ ├── mpScriptTokens.cpp
│ │ │ ├── mpScriptTokens.h
│ │ │ ├── mpStack.h
│ │ │ ├── mpTest.cpp
│ │ │ ├── mpTest.h
│ │ │ ├── mpTokenReader.cpp
│ │ │ ├── mpTokenReader.h
│ │ │ ├── mpTypes.h
│ │ │ ├── mpValReader.cpp
│ │ │ ├── mpValReader.h
│ │ │ ├── mpValue.cpp
│ │ │ ├── mpValue.h
│ │ │ ├── mpValueCache.cpp
│ │ │ ├── mpValueCache.h
│ │ │ ├── mpVariable.cpp
│ │ │ ├── mpVariable.h
│ │ │ ├── suSortPred.h
│ │ │ ├── suStringTokens.h
│ │ │ └── utGeneric.h
│ │ ├── tdr.cpp
│ │ ├── tdr.h
│ │ ├── tdrdialog.ui
│ │ ├── tdrexplanationwidget.ui
│ │ ├── tracemath.cpp
│ │ ├── tracemath.h
│ │ ├── tracematheditdialog.cpp
│ │ ├── tracematheditdialog.h
│ │ ├── tracematheditdialog.ui
│ │ ├── windowfunction.cpp
│ │ └── windowfunction.h
│ ├── fftcomplex.cpp
│ ├── fftcomplex.h
│ ├── markerwidget.cpp
│ ├── markerwidget.h
│ ├── markerwidget.ui
│ ├── smithchartdialog.ui
│ ├── trace.cpp
│ ├── trace.h
│ ├── tracecsvexport.cpp
│ ├── tracecsvexport.h
│ ├── tracecsvexport.ui
│ ├── traceeditdialog.cpp
│ ├── traceeditdialog.h
│ ├── traceeditdialog.ui
│ ├── traceimportdialog.cpp
│ ├── traceimportdialog.h
│ ├── traceimportdialog.ui
│ ├── tracemarker.cpp
│ ├── tracemarker.h
│ ├── tracemarkermodel.cpp
│ ├── tracemarkermodel.h
│ ├── tracemodel.cpp
│ ├── tracemodel.h
│ ├── traceplot.cpp
│ ├── traceplot.h
│ ├── tracesmithchart.cpp
│ ├── tracesmithchart.h
│ ├── tracetouchstoneexport.cpp
│ ├── tracetouchstoneexport.h
│ ├── tracetouchstoneexport.ui
│ ├── tracewidget.cpp
│ ├── tracewidget.h
│ ├── tracewidget.ui
│ ├── tracexyplot.cpp
│ ├── tracexyplot.h
│ ├── xyplotaxisdialog.cpp
│ ├── xyplotaxisdialog.h
│ └── xyplotaxisdialog.ui
├── Util
│ ├── qpointervariant.h
│ └── util.h
├── VNA
│ ├── Deembedding
│ │ ├── deembedding.cpp
│ │ ├── deembedding.h
│ │ ├── deembeddingdialog.cpp
│ │ ├── deembeddingdialog.h
│ │ ├── deembeddingdialog.ui
│ │ ├── deembeddingoption.cpp
│ │ ├── deembeddingoption.h
│ │ ├── form.ui
│ │ ├── matchingnetwork.cpp
│ │ ├── matchingnetwork.h
│ │ ├── matchingnetworkdialog.ui
│ │ ├── portextension.cpp
│ │ ├── portextension.h
│ │ ├── portextensioneditdialog.ui
│ │ ├── twothru.cpp
│ │ ├── twothru.h
│ │ └── twothrudialog.ui
│ ├── portextensiondialog.h
│ ├── tracewidgetvna.cpp
│ ├── tracewidgetvna.h
│ ├── vna.cpp
│ └── vna.h
├── appwindow.cpp
├── appwindow.h
├── averaging.cpp
├── averaging.h
├── csv.cpp
├── csv.h
├── icons.qrc
├── icons
│ ├── .gitignore
│ ├── DUT.png
│ ├── DUT.svg
│ ├── add.png
│ ├── cancel.png
│ ├── clear.png
│ ├── close.svg
│ ├── edit.png
│ ├── export.png
│ ├── horizontal.svg
│ ├── import.png
│ ├── invisible.svg
│ ├── math_disabled.svg
│ ├── math_enabled.svg
│ ├── ok.png
│ ├── open.png
│ ├── pCsC.png
│ ├── pCsC_small.png
│ ├── pCsL.png
│ ├── pCsL_small.png
│ ├── pLsC.png
│ ├── pLsC_small.png
│ ├── pLsL.png
│ ├── pLsL_small.png
│ ├── parallelC.svg
│ ├── parallelL.svg
│ ├── parallelR.svg
│ ├── pause.svg
│ ├── play.png
│ ├── play.svg
│ ├── plus.svg
│ ├── port1.png
│ ├── port1.svg
│ ├── port2.png
│ ├── port2.svg
│ ├── refresh.png
│ ├── remove.png
│ ├── sCpC.png
│ ├── sCpC_small.png
│ ├── sCpL.png
│ ├── sCpL_small.png
│ ├── sLpC.png
│ ├── sLpC_small.png
│ ├── sLpL.png
│ ├── sLpL_small.png
│ ├── save.png
│ ├── seriesC.svg
│ ├── seriesL.svg
│ ├── seriesR.svg
│ ├── trash.png
│ ├── vertical.svg
│ ├── visible.svg
│ ├── zoom-fit.png
│ ├── zoom-in.png
│ └── zoom-out.png
├── json.hpp
├── main.cpp
├── main.ui
├── mode.cpp
├── mode.h
├── preferences.cpp
├── preferences.h
├── preferencesdialog.ui
├── resources.qrc
├── savable.h
├── test.setup
├── touchstone.cpp
├── touchstone.h
├── unit.cpp
└── unit.h
└── VNA_embedded
├── .cproject
├── .gitignore
├── .mxproject
├── .project
├── .settings
└── language.settings.xml
├── Application
├── AmplitudeCal.cpp
├── AmplitudeCal.hpp
├── App.cpp
├── App.h
├── Communication
│ ├── Communication.cpp
│ ├── Communication.h
│ ├── Protocol.cpp
│ └── Protocol.hpp
├── Drivers
│ ├── Exti.cpp
│ ├── Exti.hpp
│ ├── FPGA
│ │ ├── FPGA.cpp
│ │ ├── FPGA.hpp
│ │ └── FPGA_HAL.hpp
│ ├── Flash.cpp
│ ├── Flash.hpp
│ ├── Log.cpp
│ ├── Log.h
│ ├── Si5351C.cpp
│ ├── Si5351C.hpp
│ ├── USB
│ │ ├── Core
│ │ │ ├── Inc
│ │ │ │ ├── usbd_conf.h
│ │ │ │ ├── usbd_core.h
│ │ │ │ ├── usbd_ctlreq.h
│ │ │ │ ├── usbd_def.h
│ │ │ │ ├── usbd_desc.h
│ │ │ │ └── usbd_ioreq.h
│ │ │ └── Src
│ │ │ │ ├── usbd_conf.c
│ │ │ │ ├── usbd_core.c
│ │ │ │ ├── usbd_ctlreq.c
│ │ │ │ ├── usbd_desc.c
│ │ │ │ └── usbd_ioreq.c
│ │ ├── usb.c
│ │ └── usb.h
│ ├── algorithm.cpp
│ ├── algorithm.hpp
│ ├── delay.cpp
│ ├── delay.hpp
│ ├── max2871.cpp
│ ├── max2871.hpp
│ ├── stm.cpp
│ └── stm.hpp
├── Firmware.cpp
├── Firmware.hpp
├── Generator.cpp
├── Generator.hpp
├── HW_HAL.cpp
├── HW_HAL.hpp
├── Hardware.cpp
├── Hardware.hpp
├── Led.cpp
├── Led.hpp
├── Manual.cpp
├── Manual.hpp
├── SpectrumAnalyzer.cpp
├── SpectrumAnalyzer.hpp
├── Util.cpp
├── Util.hpp
├── VNA.cpp
└── VNA.hpp
├── Drivers
├── CMSIS
│ ├── Device
│ │ └── ST
│ │ │ └── STM32G4xx
│ │ │ └── Include
│ │ │ ├── stm32g431xx.h
│ │ │ ├── stm32g4xx.h
│ │ │ └── system_stm32g4xx.h
│ └── Include
│ │ ├── cmsis_armcc.h
│ │ ├── cmsis_armclang.h
│ │ ├── cmsis_compiler.h
│ │ ├── cmsis_gcc.h
│ │ ├── cmsis_iccarm.h
│ │ ├── cmsis_version.h
│ │ ├── core_armv8mbl.h
│ │ ├── core_armv8mml.h
│ │ ├── core_cm0.h
│ │ ├── core_cm0plus.h
│ │ ├── core_cm1.h
│ │ ├── core_cm23.h
│ │ ├── core_cm3.h
│ │ ├── core_cm33.h
│ │ ├── core_cm4.h
│ │ ├── core_cm7.h
│ │ ├── core_sc000.h
│ │ ├── core_sc300.h
│ │ ├── mpu_armv7.h
│ │ ├── mpu_armv8.h
│ │ └── tz_context.h
└── STM32G4xx_HAL_Driver
│ ├── Inc
│ ├── Legacy
│ │ └── stm32_hal_legacy.h
│ ├── stm32g4xx_hal.h
│ ├── stm32g4xx_hal_adc.h
│ ├── stm32g4xx_hal_adc_ex.h
│ ├── stm32g4xx_hal_cortex.h
│ ├── stm32g4xx_hal_def.h
│ ├── stm32g4xx_hal_dma.h
│ ├── stm32g4xx_hal_dma_ex.h
│ ├── stm32g4xx_hal_exti.h
│ ├── stm32g4xx_hal_flash.h
│ ├── stm32g4xx_hal_flash_ex.h
│ ├── stm32g4xx_hal_flash_ramfunc.h
│ ├── stm32g4xx_hal_gpio.h
│ ├── stm32g4xx_hal_gpio_ex.h
│ ├── stm32g4xx_hal_i2c.h
│ ├── stm32g4xx_hal_i2c_ex.h
│ ├── stm32g4xx_hal_pcd.h
│ ├── stm32g4xx_hal_pcd_ex.h
│ ├── stm32g4xx_hal_pwr.h
│ ├── stm32g4xx_hal_pwr_ex.h
│ ├── stm32g4xx_hal_rcc.h
│ ├── stm32g4xx_hal_rcc_ex.h
│ ├── stm32g4xx_hal_spi.h
│ ├── stm32g4xx_hal_spi_ex.h
│ ├── stm32g4xx_hal_tim.h
│ ├── stm32g4xx_hal_tim_ex.h
│ ├── stm32g4xx_hal_uart.h
│ ├── stm32g4xx_hal_uart_ex.h
│ ├── stm32g4xx_ll_adc.h
│ ├── stm32g4xx_ll_bus.h
│ ├── stm32g4xx_ll_cortex.h
│ ├── stm32g4xx_ll_crs.h
│ ├── stm32g4xx_ll_dma.h
│ ├── stm32g4xx_ll_dmamux.h
│ ├── stm32g4xx_ll_exti.h
│ ├── stm32g4xx_ll_gpio.h
│ ├── stm32g4xx_ll_pwr.h
│ ├── stm32g4xx_ll_rcc.h
│ ├── stm32g4xx_ll_system.h
│ ├── stm32g4xx_ll_tim.h
│ ├── stm32g4xx_ll_ucpd.h
│ ├── stm32g4xx_ll_usb.h
│ └── stm32g4xx_ll_utils.h
│ └── Src
│ ├── stm32g4xx_hal.c
│ ├── stm32g4xx_hal_adc.c
│ ├── stm32g4xx_hal_adc_ex.c
│ ├── stm32g4xx_hal_cortex.c
│ ├── stm32g4xx_hal_dma.c
│ ├── stm32g4xx_hal_dma_ex.c
│ ├── stm32g4xx_hal_exti.c
│ ├── stm32g4xx_hal_flash.c
│ ├── stm32g4xx_hal_flash_ex.c
│ ├── stm32g4xx_hal_flash_ramfunc.c
│ ├── stm32g4xx_hal_gpio.c
│ ├── stm32g4xx_hal_i2c.c
│ ├── stm32g4xx_hal_i2c_ex.c
│ ├── stm32g4xx_hal_pcd.c
│ ├── stm32g4xx_hal_pcd_ex.c
│ ├── stm32g4xx_hal_pwr.c
│ ├── stm32g4xx_hal_pwr_ex.c
│ ├── stm32g4xx_hal_rcc.c
│ ├── stm32g4xx_hal_rcc_ex.c
│ ├── stm32g4xx_hal_spi.c
│ ├── stm32g4xx_hal_spi_ex.c
│ ├── stm32g4xx_hal_tim.c
│ ├── stm32g4xx_hal_tim_ex.c
│ ├── stm32g4xx_hal_uart.c
│ ├── stm32g4xx_hal_uart_ex.c
│ ├── stm32g4xx_ll_adc.c
│ ├── stm32g4xx_ll_dma.c
│ ├── stm32g4xx_ll_exti.c
│ ├── stm32g4xx_ll_gpio.c
│ ├── stm32g4xx_ll_tim.c
│ ├── stm32g4xx_ll_ucpd.c
│ ├── stm32g4xx_ll_usb.c
│ └── stm32g4xx_ll_utils.c
├── Inc
├── FreeRTOSConfig.h
├── main.h
├── stm32_assert.h
├── stm32g4xx_hal_conf.h
├── stm32g4xx_it.h
├── usbpd.h
├── usbpd_devices_conf.h
├── usbpd_dpm_conf.h
├── usbpd_dpm_core.h
├── usbpd_dpm_user.h
├── usbpd_pdo_defs.h
├── usbpd_pwr_if.h
├── usbpd_pwr_user.h
└── usbpd_vdm_user.h
├── Makefile
├── Middlewares
├── ST
│ └── STM32_USBPD_Library
│ │ ├── Core
│ │ ├── inc
│ │ │ ├── usbpd_core.h
│ │ │ ├── usbpd_def.h
│ │ │ ├── usbpd_tcpm.h
│ │ │ └── usbpd_trace.h
│ │ ├── lib
│ │ │ └── USBPDCORE_PD3_FULL_CM4_wc32.a
│ │ └── src
│ │ │ └── usbpd_trace.c
│ │ └── Devices
│ │ └── STM32G4XX
│ │ ├── inc
│ │ ├── usbpd_cad_hw_if.h
│ │ ├── usbpd_hw.h
│ │ ├── usbpd_hw_if.h
│ │ ├── usbpd_phy.h
│ │ └── usbpd_timersserver.h
│ │ └── src
│ │ ├── usbpd_cad_hw_if.c
│ │ ├── usbpd_hw.c
│ │ ├── usbpd_hw_if_it.c
│ │ ├── usbpd_phy.c
│ │ ├── usbpd_phy_hw_if.c
│ │ ├── usbpd_pwr_hw_if.c
│ │ └── usbpd_timersserver.c
└── Third_Party
│ └── FreeRTOS
│ └── Source
│ ├── CMSIS_RTOS
│ ├── cmsis_os.c
│ └── cmsis_os.h
│ ├── croutine.c
│ ├── event_groups.c
│ ├── include
│ ├── FreeRTOS.h
│ ├── StackMacros.h
│ ├── croutine.h
│ ├── deprecated_definitions.h
│ ├── event_groups.h
│ ├── list.h
│ ├── message_buffer.h
│ ├── mpu_prototypes.h
│ ├── mpu_wrappers.h
│ ├── portable.h
│ ├── projdefs.h
│ ├── queue.h
│ ├── semphr.h
│ ├── stack_macros.h
│ ├── stream_buffer.h
│ ├── task.h
│ └── timers.h
│ ├── list.c
│ ├── portable
│ └── GCC
│ │ └── ARM_CM4F
│ │ ├── port.c
│ │ └── portmacro.h
│ ├── queue.c
│ ├── stream_buffer.c
│ ├── tasks.c
│ └── timers.c
├── New_configuration.cfg
├── STM32G431CBUx_FLASH.ld
├── Src
├── app_freertos.c
├── main.c
├── stm32g4xx_hal_msp.c
├── stm32g4xx_hal_timebase_tim.c
├── stm32g4xx_it.c
├── syscalls.c
├── system_stm32g4xx.c
├── usbpd.c
├── usbpd_dpm_core.c
├── usbpd_dpm_user.c
├── usbpd_pwr_if.c
├── usbpd_pwr_user.c
└── usbpd_vdm_user.c
├── VNA_embedded Debug.cfg
├── VNA_embedded.ioc
├── VNA_embedded.xml
└── startup
└── startup_stm32g431xx.s
/.gitignore:
--------------------------------------------------------------------------------
1 | *.s#*
2 | *.b#*
3 | *.log
4 | *.net
5 | *.op.raw
6 | *.raw
7 | *.vnafw
8 | Hardware/Renderings
9 |
--------------------------------------------------------------------------------
/AssembleFirmware.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import os
4 | import binascii
5 |
6 | FPGA_BITSTREAM = "FPGA/VNA/top.bin"
7 | MCU_FW = ["Software/VNA_embedded/Debug/VNA_embedded.bin", "Software/VNA_embedded/Release/VNA_embedded.bin", "Software/VNA_embedded/build/VNA_embedded.bin"]
8 |
9 | HEADER_SIZE = 24
10 |
11 | f = open("combined.vnafw", "wb")
12 | f.write(bytes("VNA!", 'utf-8'))
13 |
14 | bitstream = open(FPGA_BITSTREAM, "rb")
15 | latest_modification = 0
16 | newest_mcu = ""
17 | for path in MCU_FW:
18 | try:
19 | modified_time = os.path.getmtime(path)
20 | if modified_time >= latest_modification:
21 | latest_modification = modified_time
22 | newest_mcu = path
23 | except:
24 | pass
25 | if latest_modification == 0:
26 | print("Couldn't find MCU firmware file")
27 | exit(-1)
28 | print("Using "+newest_mcu+" as MCU firmware")
29 | firmware = open(newest_mcu, "rb")
30 |
31 | size_FPGA = os.path.getsize(FPGA_BITSTREAM)
32 | size_MCU = os.path.getsize(newest_mcu)
33 | print("Got FPGA bitstream of size "+str(size_FPGA))
34 | print("Got MCU firmware of size "+str(size_MCU))
35 |
36 | #Create header
37 | # Start address of FPGA bitstream
38 | f.write((HEADER_SIZE).to_bytes(4, byteorder='little'))
39 | # Size of FPGA bitstream
40 | f.write(size_FPGA.to_bytes(4, byteorder='little'))
41 | # Start address of MCU firmware
42 | f.write((HEADER_SIZE + size_FPGA).to_bytes(4, byteorder='little'))
43 | # Size of MCU firmware
44 | f.write(size_MCU.to_bytes(4, byteorder='little'))
45 |
46 | # Calculate CRC
47 | def CRC32_from_file(filename, initial_CRC):
48 | buf = open(filename,'rb').read()
49 | buf = (binascii.crc32(buf, initial_CRC) & 0xFFFFFFFF)
50 | return buf
51 |
52 | print("Calculating CRC...", end="")
53 | CRC = CRC32_from_file(FPGA_BITSTREAM, 0xFFFFFFFF)
54 | CRC = CRC32_from_file(newest_mcu, CRC)
55 | print(":"+hex(CRC))
56 | f.write(CRC.to_bytes(4, byteorder='little'))
57 |
58 | # Check that we used the correct header size
59 | if f.tell() != HEADER_SIZE:
60 | print("Incorrect header size (defined as "+str(HEADER_SIZE)+" but actual header is of size "+str(f.tell())+")")
61 | exit(-1)
62 |
63 | f.write(bitstream.read())
64 | f.write(firmware.read())
65 |
66 | if f.tell() % 256 != 0:
67 | padding = 256 - f.tell() % 256
68 | f.write(bytearray(padding))
69 |
70 | print("Created combined firmware file of size "+str(f.tell()))
71 |
72 |
--------------------------------------------------------------------------------
/Documentation/.gitignore:
--------------------------------------------------------------------------------
1 | *.aux
2 | *.log
3 | *.synctex.gz
4 | *.xcf
5 | *.out
6 | *.toc
7 |
8 |
--------------------------------------------------------------------------------
/Documentation/DeveloperInfo/.gitignore:
--------------------------------------------------------------------------------
1 | RFBlockdiagram.pdf
2 | DigitalBlockdiagram.pdf
3 | PowerBlockdiagram.pdf
4 |
5 |
--------------------------------------------------------------------------------
/Documentation/DeveloperInfo/DigitalBlockdiagram.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/DeveloperInfo/DigitalBlockdiagram.pdf
--------------------------------------------------------------------------------
/Documentation/DeveloperInfo/FPGA_protocol.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/DeveloperInfo/FPGA_protocol.pdf
--------------------------------------------------------------------------------
/Documentation/DeveloperInfo/PowerBlockdiagram.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/DeveloperInfo/PowerBlockdiagram.pdf
--------------------------------------------------------------------------------
/Documentation/DeveloperInfo/RFBlockdiagram.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/DeveloperInfo/RFBlockdiagram.pdf
--------------------------------------------------------------------------------
/Documentation/Measurements/Measurements.md:
--------------------------------------------------------------------------------
1 | # Example Measurements
2 |
3 | The VNA is still in a prototyping stage but some measurements have been done. The performance might still change slightly in future versions.
4 |
5 | ## VNA Measurements
6 | Unless otherwise noted, all measurements have been taken after a SOLT calibration. The exported touchstone data for all measurements is included in this directory. In the screenshots, the colors of the S-parameters are:
7 | * S11: yellow
8 | * S12: blue
9 | * S21: green
10 | * S22: red
11 |
12 |
13 |
14 | ### Prototype_Isolation_SOLT
15 | Both ports terminated into 50Ohm, SOLT calibration without isolation measurement. Up to about 3GHz the isolation is fairly good (with some difference between S12/S21 due to the layout). At frequencies higher than 3GHz it gets quite a bit worse.
16 | 
17 |
18 | ### Prototype_Isolation_SOLT+iso
19 | Both ports terminated into 50Ohm, SOLT calibration with optional isolation measurement. This obviously improves isolation, but as soon as the setup is even slightly changed, most of the gained dynamic range is lost again.
20 | 
21 |
22 | ### Mini-circuits_VAT-10+
23 | Mini-circuit 10db attenuator connected between the ports.
24 | 
25 |
26 | ### Mini-circuits_VAT-6+
27 | Mini-circuit 6db attenuator connected between the ports.
28 | 
29 |
30 | ### Murata_RF1419D
31 | 403MHz bandpass-filter on small breakout-board connected between the ports.
32 | 
33 |
34 | ## Spectrum Analyzer Measurements
35 | **This device is designed as a VNA, not a spectrum analyzer. See user manual for limitations on spectrum analyzer measurements.**
36 |
37 | ### The effect of signal identification
38 | The setup for the following two measurements is identical, except for the signal ID functionality:
39 | * Center: 1GHz
40 | * Span: 300MHz
41 | * RBW: 10kHz
42 | * Applied signal: Reasonable clean 1GHz CW tone with about 0dbm
43 |
44 | With signal ID turned off, the resulting sweep looks pretty bad (only the 1GHz tone is really there, everything else is coming from the device itself, mostly due to aliasing):
45 | 
46 |
47 | When signal ID is enabled, most of the tones disappear. The result is still not perfect, but it should work for quickly checking whether a signal is there and getting a rough idea about its power.
48 | 
49 |
--------------------------------------------------------------------------------
/Documentation/Measurements/Mini-circuits_VAT-10+.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/Measurements/Mini-circuits_VAT-10+.png
--------------------------------------------------------------------------------
/Documentation/Measurements/Mini-circuits_VAT-6+.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/Measurements/Mini-circuits_VAT-6+.png
--------------------------------------------------------------------------------
/Documentation/Measurements/Murata_RF1419D.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/Measurements/Murata_RF1419D.png
--------------------------------------------------------------------------------
/Documentation/Measurements/Prototype_Isolation_SOLT+iso.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/Measurements/Prototype_Isolation_SOLT+iso.png
--------------------------------------------------------------------------------
/Documentation/Measurements/Prototype_Isolation_SOLT.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/Measurements/Prototype_Isolation_SOLT.png
--------------------------------------------------------------------------------
/Documentation/Measurements/SA_1GHz_SignalIDOff.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/Measurements/SA_1GHz_SignalIDOff.png
--------------------------------------------------------------------------------
/Documentation/Measurements/SA_1GHz_SignalIDOn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/Measurements/SA_1GHz_SignalIDOn.png
--------------------------------------------------------------------------------
/Documentation/Pictures/.gitignore:
--------------------------------------------------------------------------------
1 | *.xcf
2 |
3 |
--------------------------------------------------------------------------------
/Documentation/Pictures/firstPrototypeAdditionalHoles.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/Pictures/firstPrototypeAdditionalHoles.JPG
--------------------------------------------------------------------------------
/Documentation/Pictures/firstPrototypeBottom.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/Pictures/firstPrototypeBottom.JPG
--------------------------------------------------------------------------------
/Documentation/Pictures/firstPrototypeMod1.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/Pictures/firstPrototypeMod1.JPG
--------------------------------------------------------------------------------
/Documentation/Pictures/firstPrototypeMod2.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/Pictures/firstPrototypeMod2.JPG
--------------------------------------------------------------------------------
/Documentation/Pictures/firstPrototypeTop.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/Pictures/firstPrototypeTop.jpg
--------------------------------------------------------------------------------
/Documentation/Pictures/secondPrototypeBottom.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/Pictures/secondPrototypeBottom.JPG
--------------------------------------------------------------------------------
/Documentation/Pictures/secondPrototypeTop.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/Pictures/secondPrototypeTop.JPG
--------------------------------------------------------------------------------
/Documentation/UserManual/Screenshots/ApplicationOverview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/UserManual/Screenshots/ApplicationOverview.png
--------------------------------------------------------------------------------
/Documentation/UserManual/Screenshots/CalKitOpenMeasurement.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/UserManual/Screenshots/CalKitOpenMeasurement.png
--------------------------------------------------------------------------------
/Documentation/UserManual/Screenshots/CalKitSolt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/UserManual/Screenshots/CalKitSolt.png
--------------------------------------------------------------------------------
/Documentation/UserManual/Screenshots/CalKitTRL.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/UserManual/Screenshots/CalKitTRL.png
--------------------------------------------------------------------------------
/Documentation/UserManual/Screenshots/CalibrationMeasurements.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/UserManual/Screenshots/CalibrationMeasurements.png
--------------------------------------------------------------------------------
/Documentation/UserManual/Screenshots/CalibrationMeasurementsSOLT.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/UserManual/Screenshots/CalibrationMeasurementsSOLT.png
--------------------------------------------------------------------------------
/Documentation/UserManual/Screenshots/DialogFirmwareUpdate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/UserManual/Screenshots/DialogFirmwareUpdate.png
--------------------------------------------------------------------------------
/Documentation/UserManual/Screenshots/DialogManualControl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/UserManual/Screenshots/DialogManualControl.png
--------------------------------------------------------------------------------
/Documentation/UserManual/Screenshots/DockDeviceLog.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/UserManual/Screenshots/DockDeviceLog.png
--------------------------------------------------------------------------------
/Documentation/UserManual/Screenshots/MenuActivateSOLT.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/UserManual/Screenshots/MenuActivateSOLT.png
--------------------------------------------------------------------------------
/Documentation/UserManual/Screenshots/SASignalIDOff.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/UserManual/Screenshots/SASignalIDOff.png
--------------------------------------------------------------------------------
/Documentation/UserManual/Screenshots/SASignalIDOn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/UserManual/Screenshots/SASignalIDOn.png
--------------------------------------------------------------------------------
/Documentation/UserManual/Screenshots/Signalgenerator.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/UserManual/Screenshots/Signalgenerator.png
--------------------------------------------------------------------------------
/Documentation/UserManual/Screenshots/SourceCalibration.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/UserManual/Screenshots/SourceCalibration.png
--------------------------------------------------------------------------------
/Documentation/UserManual/Screenshots/ToolbarActivateSOLT.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/UserManual/Screenshots/ToolbarActivateSOLT.png
--------------------------------------------------------------------------------
/Documentation/UserManual/Screenshots/ToolbarReference.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/UserManual/Screenshots/ToolbarReference.png
--------------------------------------------------------------------------------
/Documentation/UserManual/Screenshots/ToolbarSAAcquisition.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/UserManual/Screenshots/ToolbarSAAcquisition.png
--------------------------------------------------------------------------------
/Documentation/UserManual/Screenshots/ToolbarSweep.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/UserManual/Screenshots/ToolbarSweep.png
--------------------------------------------------------------------------------
/Documentation/UserManual/Screenshots/ToolbarTrackingGenerator.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/UserManual/Screenshots/ToolbarTrackingGenerator.png
--------------------------------------------------------------------------------
/Documentation/UserManual/Screenshots/ToolbarVNAAcquisition.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/UserManual/Screenshots/ToolbarVNAAcquisition.png
--------------------------------------------------------------------------------
/Documentation/UserManual/Screenshots/VNACalibratedThrough.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/UserManual/Screenshots/VNACalibratedThrough.png
--------------------------------------------------------------------------------
/Documentation/UserManual/Screenshots/VNAUncalibratedThrough.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/UserManual/Screenshots/VNAUncalibratedThrough.png
--------------------------------------------------------------------------------
/Documentation/UserManual/TopDrawing.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/UserManual/TopDrawing.pdf
--------------------------------------------------------------------------------
/Documentation/UserManual/manual.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Documentation/UserManual/manual.pdf
--------------------------------------------------------------------------------
/FPGA/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 | !*/
4 | !*.vhd
5 | !*.ucf
6 | !*.ipf
7 | !*.gise
8 | !*.xise
9 | !*.py
10 | !*.bin
11 | !VNA/*.dat
12 |
13 |
--------------------------------------------------------------------------------
/FPGA/VNA/ResetDelay.vhd:
--------------------------------------------------------------------------------
1 | ----------------------------------------------------------------------------------
2 | -- Company:
3 | -- Engineer:
4 | --
5 | -- Create Date: 20:06:31 05/12/2020
6 | -- Design Name:
7 | -- Module Name: ResetDelay - Behavioral
8 | -- Project Name:
9 | -- Target Devices:
10 | -- Tool versions:
11 | -- Description:
12 | --
13 | -- Dependencies:
14 | --
15 | -- Revision:
16 | -- Revision 0.01 - File Created
17 | -- Additional Comments:
18 | --
19 | ----------------------------------------------------------------------------------
20 | library IEEE;
21 | use IEEE.STD_LOGIC_1164.ALL;
22 |
23 | -- Uncomment the following library declaration if using
24 | -- arithmetic functions with Signed or Unsigned values
25 | --use IEEE.NUMERIC_STD.ALL;
26 |
27 | -- Uncomment the following library declaration if instantiating
28 | -- any Xilinx primitives in this code.
29 | --library UNISIM;
30 | --use UNISIM.VComponents.all;
31 |
32 | entity ResetDelay is
33 | Generic(CLK_DELAY : integer);
34 | Port ( CLK : in STD_LOGIC;
35 | IN_RESET : in STD_LOGIC;
36 | OUT_RESET : out STD_LOGIC);
37 | end ResetDelay;
38 |
39 | architecture Behavioral of ResetDelay is
40 | signal clk_cnt : integer range 0 to CLK_DELAY-1;
41 | begin
42 |
43 | process(CLK, IN_RESET)
44 | begin
45 | if rising_edge(CLK) then
46 | if IN_RESET = '1' then
47 | clk_cnt <= 0;
48 | OUT_RESET <= '1';
49 | else
50 | if clk_cnt < CLK_DELAY-1 then
51 | clk_cnt <= clk_cnt + 1;
52 | else
53 | OUT_RESET <= '0';
54 | end if;
55 | end if;
56 | end if;
57 | end process;
58 |
59 |
60 | end Behavioral;
61 |
62 |
--------------------------------------------------------------------------------
/FPGA/VNA/Synchronizer.vhd:
--------------------------------------------------------------------------------
1 | ----------------------------------------------------------------------------------
2 | -- Company:
3 | -- Engineer:
4 | --
5 | -- Create Date: 23:31:10 05/15/2020
6 | -- Design Name:
7 | -- Module Name: Synchronizer - Behavioral
8 | -- Project Name:
9 | -- Target Devices:
10 | -- Tool versions:
11 | -- Description:
12 | --
13 | -- Dependencies:
14 | --
15 | -- Revision:
16 | -- Revision 0.01 - File Created
17 | -- Additional Comments:
18 | --
19 | ----------------------------------------------------------------------------------
20 | library IEEE;
21 | use IEEE.STD_LOGIC_1164.ALL;
22 |
23 | -- Uncomment the following library declaration if using
24 | -- arithmetic functions with Signed or Unsigned values
25 | --use IEEE.NUMERIC_STD.ALL;
26 |
27 | -- Uncomment the following library declaration if instantiating
28 | -- any Xilinx primitives in this code.
29 | --library UNISIM;
30 | --use UNISIM.VComponents.all;
31 |
32 | entity Synchronizer is
33 | Generic(stages : integer);
34 | Port ( CLK : in STD_LOGIC;
35 | SYNC_IN : in STD_LOGIC;
36 | SYNC_OUT : out STD_LOGIC);
37 | end Synchronizer;
38 |
39 | architecture Behavioral of Synchronizer is
40 | signal sync_line : std_logic_vector(stages downto 0);
41 | begin
42 |
43 | SYNC_OUT <= sync_line(stages);
44 |
45 | process(CLK)
46 | begin
47 | if rising_edge(CLK) then
48 | sync_line <= sync_line(stages-1 downto 0) & SYNC_IN;
49 | end if;
50 | end process;
51 |
52 | end Behavioral;
53 |
54 |
--------------------------------------------------------------------------------
/FPGA/VNA/ipcore_dir/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | */*
3 | !.gitignore
4 | !*.xco
5 | !*.xise
6 |
7 |
--------------------------------------------------------------------------------
/FPGA/VNA/top.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/FPGA/VNA/top.bin
--------------------------------------------------------------------------------
/FPGA/VNA/window.vhd:
--------------------------------------------------------------------------------
1 | ----------------------------------------------------------------------------------
2 | -- Company:
3 | -- Engineer:
4 | --
5 | -- Create Date: 13:28:54 09/16/2020
6 | -- Design Name:
7 | -- Module Name: window - Behavioral
8 | -- Project Name:
9 | -- Target Devices:
10 | -- Tool versions:
11 | -- Description:
12 | --
13 | -- Dependencies:
14 | --
15 | -- Revision:
16 | -- Revision 0.01 - File Created
17 | -- Additional Comments:
18 | --
19 | ----------------------------------------------------------------------------------
20 | library IEEE;
21 | use IEEE.STD_LOGIC_1164.ALL;
22 | use std.textio.all;
23 | use ieee.std_logic_textio.all;
24 |
25 | -- Uncomment the following library declaration if using
26 | -- arithmetic functions with Signed or Unsigned values
27 | use IEEE.NUMERIC_STD.ALL;
28 |
29 | -- Uncomment the following library declaration if instantiating
30 | -- any Xilinx primitives in this code.
31 | --library UNISIM;
32 | --use UNISIM.VComponents.all;
33 |
34 | entity window is
35 | Port ( CLK : in STD_LOGIC;
36 | INDEX : in STD_LOGIC_VECTOR (6 downto 0);
37 | WINDOW_TYPE : in STD_LOGIC_VECTOR (1 downto 0);
38 | VALUE : out STD_LOGIC_VECTOR (15 downto 0));
39 | end window;
40 |
41 | architecture Behavioral of window is
42 | type window_data is array(127 downto 0) of std_logic_vector(15 downto 0);
43 |
44 | impure function InitWindowDataFromFile (RomFileName : in string) return window_data is
45 | FILE romfile : text is in RomFileName;
46 | variable RomFileLine : line;
47 | variable rom : window_data;
48 | begin
49 | for i in window_data'range loop
50 | readline(romfile, RomFileLine);
51 | read(RomFileLine, rom(i));
52 | end loop;
53 | return rom;
54 | end function;
55 |
56 | constant hann : window_data := InitWindowDataFromFile("Hann.dat");
57 | constant kaiser : window_data := InitWindowDataFromFile("Kaiser.dat");
58 | constant flattop : window_data := InitWindowDataFromFile("Flattop.dat");
59 | signal i : integer range 0 to 127;
60 | begin
61 |
62 | i <= to_integer(unsigned(INDEX));
63 |
64 | process(CLK)
65 | begin
66 | if rising_edge(CLK) then
67 | case WINDOW_TYPE is
68 | when "00" => VALUE <= "0001000000000000";
69 | when "01" => VALUE <= kaiser(i);
70 | when "10" => VALUE <= hann(i);
71 | when "11" => VALUE <= flattop(i);
72 | when others => VALUE <= (others => '0');
73 | end case;
74 | end if;
75 | end process;
76 | end Behavioral;
77 |
78 |
--------------------------------------------------------------------------------
/Hardware/BOM.ods:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Hardware/BOM.ods
--------------------------------------------------------------------------------
/Hardware/PCBtop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Hardware/PCBtop.png
--------------------------------------------------------------------------------
/Hardware/Schematic.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Hardware/Schematic.pdf
--------------------------------------------------------------------------------
/Hardware/VNARendering.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Hardware/VNARendering.png
--------------------------------------------------------------------------------
/Software/.gitignore:
--------------------------------------------------------------------------------
1 | /.metadata/
2 | RemoteSystemsTempFiles
3 | build-*
4 |
--------------------------------------------------------------------------------
/Software/HelperTools/SignalIDSamplerates/.gitignore:
--------------------------------------------------------------------------------
1 | /Debug/
2 |
--------------------------------------------------------------------------------
/Software/HelperTools/SignalIDSamplerates/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | SignalIDSamplerates
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | org.eclipse.cdt.core.cnature
23 | org.eclipse.cdt.core.ccnature
24 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
25 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Software/PC_Application/.gitignore:
--------------------------------------------------------------------------------
1 | # This file is used to ignore files which are generated
2 | # ----------------------------------------------------------------------------
3 |
4 | *~
5 | *.autosave
6 | *.a
7 | *.core
8 | *.moc
9 | *.o
10 | *.obj
11 | *.orig
12 | *.rej
13 | *.so
14 | *.so.*
15 | *_pch.h.cpp
16 | *_resource.rc
17 | *.qm
18 | .#*
19 | *.*#
20 | core
21 | !core/
22 | tags
23 | .DS_Store
24 | .directory
25 | *.debug
26 | Makefile*
27 | *.prl
28 | *.app
29 | moc_*.cpp
30 | moc_*.h
31 | ui_*.h
32 | qrc_*.cpp
33 | Thumbs.db
34 | *.res
35 | *.rc
36 | /.qmake.cache
37 | /.qmake.stash
38 |
39 | # qtcreator generated files
40 | *.pro.user*
41 |
42 | # xemacs temporary files
43 | *.flc
44 |
45 | # Vim temporary files
46 | .*.swp
47 |
48 | # Visual Studio generated files
49 | *.ib_pdb_index
50 | *.idb
51 | *.ilk
52 | *.pdb
53 | *.sln
54 | *.suo
55 | *.vcproj
56 | *vcproj.*.*.user
57 | *.ncb
58 | *.sdf
59 | *.opensdf
60 | *.vcxproj
61 | *vcxproj.*
62 |
63 | # MinGW generated files
64 | *.Debug
65 | *.Release
66 |
67 | # Python byte code
68 | *.pyc
69 |
70 | # Binaries
71 | # --------
72 | *.dll
73 | *.exe
74 | Application
75 |
76 |
77 |
--------------------------------------------------------------------------------
/Software/PC_Application/51-vna.rules:
--------------------------------------------------------------------------------
1 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="564e", MODE:="0666"
2 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="4121", MODE:="0666"
3 |
--------------------------------------------------------------------------------
/Software/PC_Application/Calibration/calibrationtracedialog.h:
--------------------------------------------------------------------------------
1 | #ifndef CALIBRATIONTRACEDIALOG_H
2 | #define CALIBRATIONTRACEDIALOG_H
3 |
4 | #include
5 | #include "calibration.h"
6 | #include "measurementmodel.h"
7 | #include "Device/device.h"
8 |
9 | namespace Ui {
10 | class CalibrationTraceDialog;
11 | }
12 |
13 | class CalibrationTraceDialog : public QDialog
14 | {
15 | Q_OBJECT
16 |
17 | public:
18 | explicit CalibrationTraceDialog(Calibration *cal, Protocol::SweepSettings sweep, Calibration::Type type = Calibration::Type::None);
19 | ~CalibrationTraceDialog();
20 |
21 | public slots:
22 | void measurementComplete(Calibration::Measurement m);
23 | signals:
24 | void triggerMeasurement(Calibration::Measurement m);
25 | void applyCalibration(Calibration::Type type);
26 | void calibrationInvalidated();
27 |
28 | private slots:
29 | void on_bDelete_clicked();
30 | void on_bMeasure_clicked();
31 | void on_bApply_clicked();
32 |
33 | private:
34 | void UpdateCalibrationStatus();
35 | Ui::CalibrationTraceDialog *ui;
36 | Calibration *cal;
37 | Calibration::Type requestedType;
38 | std::vector measurements;
39 | MeasurementModel *model;
40 | };
41 |
42 | #endif // CALIBRATIONTRACEDIALOG_H
43 |
--------------------------------------------------------------------------------
/Software/PC_Application/Calibration/calkitdialog.h:
--------------------------------------------------------------------------------
1 | #ifndef CALKITDIALOG_H
2 | #define CALKITDIALOG_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include "calkit.h"
9 |
10 | namespace Ui {
11 | class CalkitDialog;
12 | }
13 |
14 | class CalkitDialog : public QDialog
15 | {
16 | Q_OBJECT
17 |
18 | public:
19 | explicit CalkitDialog(Calkit &c, QWidget *parent = nullptr);
20 | ~CalkitDialog();
21 |
22 | private:
23 | void parseEntries();
24 | void updateEntries();
25 | Ui::CalkitDialog *ui;
26 |
27 | bool open_ok, short_ok, load_ok, through_ok;
28 |
29 | Calkit ownKit;
30 | Calkit &editKit;
31 | };
32 |
33 | #endif // CALKITDIALOG_H
34 |
--------------------------------------------------------------------------------
/Software/PC_Application/Calibration/measurementmodel.h:
--------------------------------------------------------------------------------
1 | #ifndef MEASUREMENTMODEL_H
2 | #define MEASUREMENTMODEL_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include "calibration.h"
8 |
9 | class MeasurementModel : public QAbstractTableModel
10 | {
11 | Q_OBJECT
12 | public:
13 | MeasurementModel(Calibration *cal, std::vector measurements);
14 |
15 | int rowCount(const QModelIndex &parent = QModelIndex()) const override;
16 | int columnCount(const QModelIndex &parent = QModelIndex()) const override;
17 | QVariant data(const QModelIndex &index, int role) const override;
18 | QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
19 |
20 | public slots:
21 | void measurementUpdated(Calibration::Measurement m);
22 |
23 | private:
24 | enum {
25 | ColIndexName,
26 | ColIndexDescription,
27 | ColIndexData,
28 | ColIndexDate,
29 | ColIndexLast
30 | };
31 | Calibration *cal;
32 | std::vector measurements;
33 | };
34 |
35 | #endif // MEASUREMENTMODEL_H
36 |
--------------------------------------------------------------------------------
/Software/PC_Application/Calibration/receivercaldialog.cpp:
--------------------------------------------------------------------------------
1 | #include "receivercaldialog.h"
2 |
3 | ReceiverCalDialog::ReceiverCalDialog(Device *dev)
4 | : AmplitudeCalDialog(dev)
5 | {
6 | setWindowTitle("Receiver Calibration Dialog");
7 | LoadFromDevice();
8 | }
9 |
10 | void ReceiverCalDialog::SelectedPoint(double frequency, bool)
11 | {
12 | if(frequency > 0) {
13 | Protocol::PacketInfo p = {};
14 | p.type = Protocol::PacketType::SpectrumAnalyzerSettings;
15 | p.spectrumSettings.RBW = 10000;
16 | p.spectrumSettings.UseDFT = 0;
17 | // setup 3 points centered around the measurement frequency (zero span not supported yet)
18 | p.spectrumSettings.f_stop = frequency + 1.0;
19 | p.spectrumSettings.f_start = frequency - 1.0;
20 | p.spectrumSettings.pointNum = 3;
21 | p.spectrumSettings.Detector = 0;
22 | p.spectrumSettings.SignalID = 1;
23 | p.spectrumSettings.WindowType = 3;
24 | p.spectrumSettings.applyReceiverCorrection = 0;
25 | dev->SendPacket(p);
26 | } else {
27 | // invalid frequency, disable
28 | dev->SetIdle();
29 | }
30 | }
31 |
32 | void ReceiverCalDialog::AmplitudeChanged(AmplitudeCalDialog::CorrectionPoint &point, bool port2)
33 | {
34 | auto m = averageMeasurement();
35 | auto *factor = port2 ? &point.correctionPort2 : &point.correctionPort1;
36 | const auto *amplitude = port2 ? &point.amplitudePort2 : &point.amplitudePort1;
37 | const auto *measured = port2 ? &m.port2 : &m.port1;
38 | // calculate correction factor by comparing expected with measured amplitude
39 | *factor = (*amplitude - *measured) * 100.0;
40 | }
41 |
42 | void ReceiverCalDialog::UpdateAmplitude(AmplitudeCalDialog::CorrectionPoint &point)
43 | {
44 | // This point was just received from the device, it is not possible to know the actual amplitude because the
45 | // applied power level during the calibration is not saved (only the correction value). This is not a problem
46 | // because the correction value is still valid but the missing values look weird in the GUI
47 | // TODO change this?
48 | point.amplitudePort1 = std::numeric_limits::quiet_NaN();
49 | point.amplitudePort2 = std::numeric_limits::quiet_NaN();
50 | point.port1set = true;
51 | point.port2set = true;
52 | }
53 |
--------------------------------------------------------------------------------
/Software/PC_Application/Calibration/receivercaldialog.h:
--------------------------------------------------------------------------------
1 | #ifndef RECEIVERCALDIALOG_H
2 | #define RECEIVERCALDIALOG_H
3 |
4 | #include "amplitudecaldialog.h"
5 |
6 | class ReceiverCalDialog : public AmplitudeCalDialog
7 | {
8 | Q_OBJECT
9 | public:
10 | ReceiverCalDialog(Device *dev);
11 | protected:
12 | Protocol::PacketType requestCommand() override { return Protocol::PacketType::RequestReceiverCal; }
13 | Protocol::PacketType pointType() override { return Protocol::PacketType::ReceiverCalPoint; }
14 | void SelectedPoint(double frequency, bool port2) override;
15 | void AmplitudeChanged(CorrectionPoint &point, bool port2) override;
16 | void UpdateAmplitude(CorrectionPoint& point) override;
17 | };
18 |
19 | #endif // RECEIVERCALDIALOG_H
20 |
--------------------------------------------------------------------------------
/Software/PC_Application/Calibration/sourcecaldialog.cpp:
--------------------------------------------------------------------------------
1 | #include "sourcecaldialog.h"
2 |
3 | #include
4 |
5 | SourceCalDialog::SourceCalDialog(Device *dev)
6 | : AmplitudeCalDialog(dev)
7 | {
8 | setWindowTitle("Source Calibration Dialog");
9 | LoadFromDevice();
10 | }
11 |
12 | void SourceCalDialog::SelectedPoint(double frequency, bool port2)
13 | {
14 | Protocol::PacketInfo p;
15 | p.type = Protocol::PacketType::Generator;
16 |
17 | p.generator.frequency = frequency;
18 | p.generator.cdbm_level = excitationAmplitude * 100.0;
19 | if(frequency > 0) {
20 | if(port2) {
21 | p.generator.activePort = 2;
22 | } else {
23 | p.generator.activePort = 1;
24 | }
25 | } else {
26 | // invalid frequency, disable both ports
27 | p.generator.activePort = 0;
28 | }
29 | p.generator.applyAmplitudeCorrection = 0;
30 | dev->SendPacket(p);
31 | }
32 |
33 | void SourceCalDialog::AmplitudeChanged(AmplitudeCalDialog::CorrectionPoint &point, bool port2)
34 | {
35 | auto *factor = port2 ? &point.correctionPort2 : &point.correctionPort1;
36 | const auto *amplitude = port2 ? &point.amplitudePort2 : &point.amplitudePort1;
37 | // calculate correction factor by comparing expected with measured amplitude
38 | *factor = (excitationAmplitude - *amplitude) * 100.0;
39 | }
40 |
41 | void SourceCalDialog::UpdateAmplitude(AmplitudeCalDialog::CorrectionPoint &point)
42 | {
43 | point.amplitudePort1 = excitationAmplitude - (double) point.correctionPort1 / 100.0;
44 | point.amplitudePort2 = excitationAmplitude - (double) point.correctionPort2 / 100.0;
45 | point.port1set = true;
46 | point.port2set = true;
47 | }
48 |
--------------------------------------------------------------------------------
/Software/PC_Application/Calibration/sourcecaldialog.h:
--------------------------------------------------------------------------------
1 | #ifndef SOURCECALDIALOG_H
2 | #define SOURCECALDIALOG_H
3 |
4 | #include
5 | #include "amplitudecaldialog.h"
6 |
7 | class SourceCalDialog : public AmplitudeCalDialog
8 | {
9 | Q_OBJECT
10 | public:
11 | SourceCalDialog(Device *dev);
12 | protected:
13 | Protocol::PacketType requestCommand() override { return Protocol::PacketType::RequestSourceCal; }
14 | Protocol::PacketType pointType() override { return Protocol::PacketType::SourceCalPoint; }
15 | void SelectedPoint(double frequency, bool port2) override;
16 | void AmplitudeChanged(CorrectionPoint &point, bool port2) override;
17 | void UpdateAmplitude(CorrectionPoint& point) override;
18 | };
19 |
20 | #endif // SOURCECALDIALOG_H
21 |
--------------------------------------------------------------------------------
/Software/PC_Application/CustomWidgets/colorpickerbutton.cpp:
--------------------------------------------------------------------------------
1 | #include "colorpickerbutton.h"
2 | #include
3 |
4 | ColorPickerButton::ColorPickerButton(QWidget *parent)
5 | : QPushButton(parent)
6 | {
7 | color = Qt::white;
8 | connect(this, &ColorPickerButton::clicked, this, &ColorPickerButton::changeColor);
9 | updateBackground();
10 | }
11 |
12 | void ColorPickerButton::setColor(const QColor &color)
13 | {
14 | this->color = color;
15 | updateBackground();
16 | }
17 |
18 | const QColor &ColorPickerButton::getColor()
19 | {
20 | return color;
21 | }
22 |
23 | void ColorPickerButton::changeColor()
24 | {
25 | auto newColor = QColorDialog::getColor(color, parentWidget(), "Select color", QColorDialog::DontUseNativeDialog);
26 | if(newColor.isValid() && newColor != color) {
27 | setColor(newColor);
28 | emit colorChanged(newColor);
29 | }
30 | }
31 |
32 | void ColorPickerButton::updateBackground()
33 | {
34 | setStyleSheet("background-color:"+color.name());
35 | }
36 |
--------------------------------------------------------------------------------
/Software/PC_Application/CustomWidgets/colorpickerbutton.h:
--------------------------------------------------------------------------------
1 | #ifndef COLORPICKERBUTTON_H
2 | #define COLORPICKERBUTTON_H
3 |
4 | #include
5 |
6 | class ColorPickerButton : public QPushButton
7 | {
8 | Q_OBJECT
9 | public:
10 | ColorPickerButton(QWidget *parent = nullptr);
11 |
12 | void setColor(const QColor& color);
13 | const QColor& getColor();
14 | signals:
15 | void colorChanged(const QColor& color);
16 | private slots:
17 | void changeColor();
18 | private:
19 | void updateBackground();
20 | QColor color;
21 | };
22 |
23 | #endif // COLORPICKERBUTTON_H
24 |
--------------------------------------------------------------------------------
/Software/PC_Application/CustomWidgets/informationbox.cpp:
--------------------------------------------------------------------------------
1 | #include "informationbox.h"
2 | #include
3 | #include
4 | #include
5 |
6 | void InformationBox::ShowMessage(QString title, QString message, QString messageID)
7 | {
8 | // check if the user still wants to see this message
9 | unsigned int hash;
10 | if(messageID.isEmpty()) {
11 | hash = qHash(message);
12 | } else {
13 | hash = qHash(messageID);
14 | }
15 |
16 | QSettings s;
17 | if(!s.contains(hashToSettingsKey(hash))) {
18 | auto box = new InformationBox(title, message, hash, nullptr);
19 | box->exec();
20 | }
21 | }
22 |
23 | bool InformationBox::AskQuestion(QString title, QString question, bool defaultAnswer, QString messageID)
24 | {
25 | // check if the user still wants to see this message
26 | unsigned int hash;
27 | if(messageID.isEmpty()) {
28 | hash = qHash(question);
29 | } else {
30 | hash = qHash(messageID);
31 | }
32 |
33 | QSettings s;
34 | if(!s.contains(hashToSettingsKey(hash))) {
35 | auto box = new InformationBox(title, question, hash, nullptr);
36 | box->setStandardButtons(QMessageBox::Yes | QMessageBox::No);
37 | int ret = box->exec();
38 | if(ret == QMessageBox::Yes) {
39 | return true;
40 | } else {
41 | return false;
42 | }
43 | } else {
44 | // don't show this question anymore
45 | return defaultAnswer;
46 | }
47 | }
48 |
49 | InformationBox::InformationBox(QString title, QString message, unsigned int hash, QWidget *parent)
50 | : QMessageBox(parent),
51 | hash(hash)
52 | {
53 | setWindowTitle(title);
54 | setText(message);
55 | setAttribute(Qt::WA_DeleteOnClose, true);
56 | setIcon(QMessageBox::Information);
57 |
58 | auto cb = new QCheckBox("Do not show this message again");
59 | setCheckBox(cb);
60 | }
61 |
62 | InformationBox::~InformationBox()
63 | {
64 | auto cb = checkBox();
65 | if(cb->isChecked()) {
66 | QSettings s;
67 | s.setValue(hashToSettingsKey(hash), true);
68 | }
69 | }
70 |
71 | QString InformationBox::hashToSettingsKey(unsigned int hash)
72 | {
73 | return QString("DoNotShowDialog/") + QString::number(hash);
74 | }
75 |
--------------------------------------------------------------------------------
/Software/PC_Application/CustomWidgets/informationbox.h:
--------------------------------------------------------------------------------
1 | #ifndef INFORMATIONBOX_H
2 | #define INFORMATIONBOX_H
3 |
4 | #include
5 |
6 | class InformationBox : public QMessageBox
7 | {
8 | Q_OBJECT
9 | public:
10 | static void ShowMessage(QString title, QString message, QString messageID = QString());
11 | // Display a dialog with yes/no buttons. Returns true if yes is clicked, false otherwise. If the user has selected to never see this message again, defaultAnswer is returned instead
12 | static bool AskQuestion(QString title, QString question, bool defaultAnswer, QString messageID = QString());
13 | private:
14 | InformationBox(QString title, QString message, unsigned int hash, QWidget *parent);
15 | ~InformationBox();
16 | static QString hashToSettingsKey(unsigned int hash);
17 | unsigned int hash;
18 | };
19 |
20 | #endif // INFORMATIONBOX_H
21 |
--------------------------------------------------------------------------------
/Software/PC_Application/CustomWidgets/siunitedit.h:
--------------------------------------------------------------------------------
1 | #ifndef SIUNITEDIT_H
2 | #define SIUNITEDIT_H
3 |
4 | #include
5 |
6 | class SIUnitEdit : public QLineEdit
7 | {
8 | Q_OBJECT
9 | public:
10 | SIUnitEdit(QString unit = QString(), QString prefixes = " ", int precision = 0, QWidget *parent = nullptr);
11 | SIUnitEdit(QWidget *parent);
12 |
13 | void setUnit(QString unit) { this->unit = unit; setValueQuiet(_value); }
14 | void setPrefixes(QString prefixes) { this->prefixes = prefixes; setValueQuiet(_value); }
15 | void setPrecision(int precision) { this->precision = precision; setValueQuiet(_value); }
16 | double value() { return _value; }
17 | public slots:
18 | void setValue(double value);
19 | void setValueQuiet(double value);
20 | signals:
21 | void valueChanged(double newvalue);
22 | void valueUpdated(QWidget *w);
23 | void editingAborted();
24 | void focusLost();
25 | protected:
26 | bool eventFilter(QObject *obj, QEvent *event) override;
27 | private slots:
28 | void continueEditing();
29 | private:
30 | void parseNewValue(double factor);
31 | QString unit, prefixes;
32 | int precision;
33 | double _value;
34 | };
35 |
36 | #endif // SIUNITEDIT_H
37 |
--------------------------------------------------------------------------------
/Software/PC_Application/CustomWidgets/tilewidget.h:
--------------------------------------------------------------------------------
1 | #ifndef TILEWIDGET_H
2 | #define TILEWIDGET_H
3 |
4 | #include
5 | #include "Traces/traceplot.h"
6 | #include
7 | #include "Traces/tracemodel.h"
8 | #include "savable.h"
9 |
10 | namespace Ui {
11 | class TileWidget;
12 | }
13 |
14 | class TileWidget : public QWidget, public Savable
15 | {
16 | Q_OBJECT
17 |
18 | public:
19 | explicit TileWidget(TraceModel &model, QWidget *parent = nullptr);
20 | ~TileWidget();
21 |
22 | TileWidget *Child1() { return child1; };
23 | TileWidget *Child2() { return child2; };
24 |
25 | // closes all plots/childs, leaving only the tilewidget at the top
26 | void clear();
27 |
28 | virtual nlohmann::json toJSON() override;
29 | virtual void fromJSON(nlohmann::json j) override;
30 | public slots:
31 | void splitVertically();
32 | void splitHorizontally();
33 | void closeTile();
34 | void setPlot(TracePlot *plot);
35 |
36 | private slots:
37 | void on_bSmithchart_clicked();
38 | void on_bXYplot_clicked();
39 | void traceDeleted(TracePlot *t);
40 |
41 | private:
42 | TileWidget(TraceModel &model, TileWidget &parent);
43 | void split();
44 | void setContent(TracePlot *plot);
45 | void setChild();
46 | Ui::TileWidget *ui;
47 | QSplitter *splitter;
48 | bool isSplit;
49 | TileWidget *parent;
50 | TileWidget *child1, *child2;
51 | bool hasContent;
52 | TracePlot *content;
53 | TraceModel &model;
54 | };
55 |
56 | #endif // TILEWIDGET_H
57 |
--------------------------------------------------------------------------------
/Software/PC_Application/CustomWidgets/toggleswitch.cpp:
--------------------------------------------------------------------------------
1 | #include "toggleswitch.h"
2 |
3 | #include
4 | #include
5 |
6 | ToggleSwitch::ToggleSwitch(QWidget *parent, bool state) : QAbstractButton(parent),
7 | _height(24),
8 | _width(128),
9 | state(state)
10 | {
11 |
12 | }
13 |
14 | QSize ToggleSwitch::sizeHint() const
15 | {
16 | return QSize(_width, _height);
17 | }
18 |
19 | void ToggleSwitch::toggle()
20 | {
21 | state = !state;
22 | emit toggled(state);
23 | }
24 |
25 | void ToggleSwitch::setState(bool state)
26 | {
27 | if(this->state != state) {
28 | this->state = state;
29 | emit toggled(state);
30 | }
31 | }
32 |
33 | void ToggleSwitch::paintEvent(QPaintEvent *)
34 | {
35 | QPainter p(this);
36 | p.setPen(Qt::NoPen);
37 | p.setBrush(Qt::black);
38 | p.setOpacity(isEnabled() ? 0.38 : 0.12);
39 | p.setRenderHint(QPainter::Antialiasing, true);
40 | p.drawRoundedRect(QRect(0, 0, width(), height()), 8.0, 8.0);
41 | p.setOpacity(1.0);
42 | QRect rect;
43 | QString statename;
44 | if(state) {
45 | p.setBrush(isEnabled() ? Qt::darkGreen : Qt::gray);
46 | rect = QRect(width()/2, 0, width()/2, height());
47 | statename = "ON";
48 | } else {
49 | p.setBrush(isEnabled() ? QColor("#AA090E") : Qt::lightGray);
50 | rect = QRect(0, 0, width()/2, height());
51 | statename = "OFF";
52 | }
53 | p.drawRoundedRect(rect, 8.0, 8.0);
54 | QFont font = p.font();
55 | p.setPen(Qt::SolidLine);
56 | p.setPen(isEnabled() ? Qt::black : Qt::gray);
57 | p.drawText(rect, Qt::AlignCenter, statename);
58 | }
59 |
60 | void ToggleSwitch::mouseReleaseEvent(QMouseEvent *e)
61 | {
62 | if(e->button() & Qt::LeftButton) {
63 | toggle();
64 | }
65 | QAbstractButton::mouseReleaseEvent(e);
66 | }
67 |
--------------------------------------------------------------------------------
/Software/PC_Application/CustomWidgets/toggleswitch.h:
--------------------------------------------------------------------------------
1 | #ifndef TOGGLESWITCH_H
2 | #define TOGGLESWITCH_H
3 |
4 | #include
5 |
6 | class ToggleSwitch : public QAbstractButton
7 | {
8 | Q_OBJECT
9 | public:
10 | ToggleSwitch(QWidget* parent = nullptr, bool state = false);
11 |
12 | QSize sizeHint() const override;
13 | signals:
14 | void toggled(bool newstate);
15 | public slots:
16 | void toggle();
17 | void setState(bool state);
18 |
19 | protected:
20 | void paintEvent(QPaintEvent*) override;
21 | void mouseReleaseEvent(QMouseEvent*) override;
22 |
23 | private:
24 | int _height, _width;
25 | bool state;
26 | };
27 |
28 | #endif // TOGGLESWITCH_H
29 |
--------------------------------------------------------------------------------
/Software/PC_Application/CustomWidgets/touchstoneimport.h:
--------------------------------------------------------------------------------
1 | #ifndef TOUCHSTONEIMPORT_H
2 | #define TOUCHSTONEIMPORT_H
3 |
4 | #include
5 | #include "touchstone.h"
6 | #include
7 |
8 | namespace Ui {
9 | class TouchstoneImport;
10 | }
11 |
12 | class TouchstoneImport : public QWidget
13 | {
14 | Q_OBJECT
15 |
16 | public:
17 | explicit TouchstoneImport(QWidget *parent = nullptr, int ports = 0);
18 | ~TouchstoneImport();
19 |
20 | bool getStatus();
21 | Touchstone getTouchstone();
22 | void setPorts(int ports);
23 | QString getFilename();
24 | void selectPort(int destination, int source);
25 | std::vector getPorts();
26 |
27 | signals:
28 | void statusChanged(bool status);
29 | void filenameChanged(QString name);
30 |
31 | public slots:
32 | void setFile(QString filename);
33 |
34 | private slots:
35 | void on_browse_clicked();
36 |
37 | private:
38 | void evaluateFile();
39 | void preventCollisionWithGroup(QButtonGroup *group, int id);
40 | Ui::TouchstoneImport *ui;
41 | int required_ports;
42 | Touchstone touchstone;
43 | bool status;
44 | };
45 |
46 | #endif // TOUCHSTONEIMPORT_H
47 |
--------------------------------------------------------------------------------
/Software/PC_Application/Device/devicelog.cpp:
--------------------------------------------------------------------------------
1 | #include "devicelog.h"
2 | #include "ui_devicelog.h"
3 | #include
4 | #include
5 | #include
6 |
7 | using namespace std;
8 |
9 | DeviceLog::DeviceLog(QWidget *parent) :
10 | QWidget(parent),
11 | ui(new Ui::DeviceLog)
12 | {
13 | ui->setupUi(this);
14 | connect(ui->bClear, &QPushButton::clicked, this, &DeviceLog::clear);
15 | connect(ui->limitLines, &QCheckBox::toggled, [=](bool enabled){
16 | if(enabled) {
17 | ui->text->setMaximumBlockCount(ui->numLines->value());
18 | ui->numLines->setEnabled(true);
19 | } else {
20 | ui->text->setMaximumBlockCount(0);
21 | ui->numLines->setEnabled(false);
22 | }
23 | });
24 | ui->text->setMaximumBlockCount(ui->numLines->value());
25 | connect(ui->numLines, qOverload(&QSpinBox::valueChanged), [=](int lines) {
26 | ui->text->setMaximumBlockCount(lines);
27 | });
28 | }
29 |
30 | DeviceLog::~DeviceLog()
31 | {
32 | delete ui;
33 | }
34 |
35 | void DeviceLog::addLine(QString line)
36 | {
37 | // Set color depending on log level
38 | QColor color = Qt::black;
39 | if(line.contains(",CRT]")) {
40 | color = Qt::red;
41 | } else if(line.contains(",ERR]")) {
42 | color = QColor(255, 94, 0);
43 | } else if(line.contains(",WRN]")) {
44 | color = QColor(255, 174, 26);
45 | } else if(line.contains(",DBG")) {
46 | color = Qt::gray;
47 | }
48 | QTextCharFormat tf;
49 | tf = ui->text->currentCharFormat();
50 | tf.setForeground(QBrush(color));
51 | ui->text->setCurrentCharFormat(tf);
52 | ui->text->appendPlainText(line);
53 | if(ui->cbAutoscroll->isChecked()) {
54 | QScrollBar *sb = ui->text->verticalScrollBar();
55 | sb->setValue(sb->maximum());
56 | }
57 | }
58 |
59 | void DeviceLog::clear()
60 | {
61 | ui->text->clear();
62 | }
63 |
64 | void DeviceLog::on_bToFile_clicked()
65 | {
66 | auto filename = QFileDialog::getSaveFileName(this, "Select file for device log", "", "", nullptr, QFileDialog::DontUseNativeDialog);
67 | if(filename.length() > 0) {
68 | // create file
69 | ofstream file;
70 | file.open(filename.toStdString());
71 | file << ui->text->toPlainText().toStdString();
72 | file.close();
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/Software/PC_Application/Device/devicelog.h:
--------------------------------------------------------------------------------
1 | #ifndef DEVICELOG_H
2 | #define DEVICELOG_H
3 |
4 | #include
5 |
6 | namespace Ui {
7 | class DeviceLog;
8 | }
9 |
10 | class DeviceLog : public QWidget
11 | {
12 | Q_OBJECT
13 |
14 | public:
15 | explicit DeviceLog(QWidget *parent = nullptr);
16 | ~DeviceLog();
17 |
18 | public slots:
19 | void addLine(QString line);
20 | void clear();
21 |
22 | private slots:
23 | void on_bToFile_clicked();
24 |
25 | private:
26 | Ui::DeviceLog *ui;
27 | };
28 |
29 | #endif // DEVICELOG_H
30 |
--------------------------------------------------------------------------------
/Software/PC_Application/Device/firmwareupdatedialog.h:
--------------------------------------------------------------------------------
1 | #ifndef FIRMWAREUPDATEDIALOG_H
2 | #define FIRMWAREUPDATEDIALOG_H
3 |
4 | #include
5 | #include "device.h"
6 | #include
7 | #include
8 |
9 | namespace Ui {
10 | class FirmwareUpdateDialog;
11 | }
12 |
13 | class FirmwareUpdateDialog : public QDialog
14 | {
15 | Q_OBJECT
16 |
17 | public:
18 | /*
19 | * Depending on the result of the firmware update, the device pointer will be modified:
20 | * - In case of user-aborted firmware update, the device pointer will be unchanged
21 | * - If the update fails during transmission of firmware data, the device pointer will be unchanged
22 | * - If the update fails during device reboot, the device pointer is set to zero and the device deleted
23 | * - If the update succeeds, the device pointer will be set to the new device instance
24 | */
25 | explicit FirmwareUpdateDialog(Device *dev, QWidget *parent = nullptr);
26 | ~FirmwareUpdateDialog();
27 |
28 | signals:
29 | void DeviceRebooting(); // emitted when the update process is triggered, the device should be disconnected
30 | void DeviceRebooted(QString serial); // emitted when an updated device is enumerated after the update
31 |
32 | private slots:
33 | void on_bFile_clicked();
34 | void on_bStart_clicked();
35 | void timerCallback();
36 | void receivedAck();
37 | void receivedNack();
38 |
39 | private:
40 | void addStatus(QString line);
41 | void abortWithError(QString error);
42 | void sendNextFirmwareChunk();
43 | Ui::FirmwareUpdateDialog *ui;
44 | Device *dev;
45 | QFile *file;
46 | QTimer timer;
47 |
48 | enum class State {
49 | Idle,
50 | ErasingFLASH,
51 | TransferringData,
52 | TriggeringUpdate,
53 | WaitingForReboot,
54 | WaitBeforeInitializing,
55 | };
56 | State state;
57 | unsigned int transferredBytes;
58 | QString serialnumber;
59 | };
60 |
61 | #endif // FIRMWAREUPDATEDIALOG_H
62 |
--------------------------------------------------------------------------------
/Software/PC_Application/Device/manualcontroldialog.h:
--------------------------------------------------------------------------------
1 | #ifndef MANUALCONTROLDIALOG_H
2 | #define MANUALCONTROLDIALOG_H
3 |
4 | #include
5 | #include "device.h"
6 |
7 | namespace Ui {
8 | class ManualControlDialog;
9 | }
10 |
11 | class ManualControlDialog : public QDialog
12 | {
13 | Q_OBJECT
14 |
15 | public:
16 | explicit ManualControlDialog(Device &dev, QWidget *parent = nullptr);
17 | ~ManualControlDialog();
18 |
19 | public slots:
20 | void NewStatus(Protocol::ManualStatus status);
21 |
22 | private:
23 | void UpdateDevice();
24 | Ui::ManualControlDialog *ui;
25 | Device &dev;
26 | };
27 |
28 | #endif // MANUALCONTROLDIALOG_H
29 |
--------------------------------------------------------------------------------
/Software/PC_Application/Generator/generator.cpp:
--------------------------------------------------------------------------------
1 | #include "generator.h"
2 | #include
3 |
4 | Generator::Generator(AppWindow *window)
5 | : Mode(window, "Signal Generator")
6 | {
7 | central = new SignalgeneratorWidget(window);
8 |
9 | auto pref = Preferences::getInstance();
10 |
11 | // set initial values
12 | if(pref.Startup.RememberSweepSettings) {
13 | QSettings s;
14 | central->setFrequency(s.value("GeneratorFrequency", pref.Startup.Generator.frequency).toDouble());
15 | central->setLevel(s.value("GeneratorLevel", pref.Startup.Generator.level).toDouble());
16 | } else {
17 | central->setFrequency(pref.Startup.Generator.frequency);
18 | central->setLevel(pref.Startup.Generator.level);
19 | }
20 |
21 | finalize(central);
22 | connect(central, &SignalgeneratorWidget::SettingsChanged, this, &Generator::updateDevice);
23 | }
24 |
25 | void Generator::deactivate()
26 | {
27 | // store current settings
28 | QSettings s;
29 | auto settings = central->getDeviceStatus();
30 | s.setValue("GeneratorFrequency", static_cast(settings.frequency));
31 | s.setValue("GeneratorLevel", static_cast((double) settings.cdbm_level / 100.0));
32 | Mode::deactivate();
33 | }
34 |
35 | void Generator::initializeDevice()
36 | {
37 | updateDevice();
38 | }
39 |
40 | void Generator::updateDevice()
41 | {
42 | if(!window->getDevice()) {
43 | // can't update if not connected
44 | return;
45 | }
46 | Protocol::PacketInfo p;
47 | p.type = Protocol::PacketType::Generator;
48 | p.generator = central->getDeviceStatus();
49 | window->getDevice()->SendPacket(p);
50 | }
51 |
--------------------------------------------------------------------------------
/Software/PC_Application/Generator/generator.h:
--------------------------------------------------------------------------------
1 | #ifndef GENERATOR_H
2 | #define GENERATOR_H
3 |
4 | #include "mode.h"
5 | #include "signalgenwidget.h"
6 |
7 | class Generator : public Mode
8 | {
9 | public:
10 | Generator(AppWindow *window);
11 | void deactivate() override;
12 | void initializeDevice() override;
13 |
14 | // Nothing to do for now
15 | virtual nlohmann::json toJSON() override {return nlohmann::json();};
16 | virtual void fromJSON(nlohmann::json j) override {Q_UNUSED(j)};
17 | private slots:
18 | void updateDevice();
19 | private:
20 | SignalgeneratorWidget *central;
21 | };
22 |
23 | #endif // GENERATOR_H
24 |
--------------------------------------------------------------------------------
/Software/PC_Application/Generator/signalgenwidget.h:
--------------------------------------------------------------------------------
1 | #ifndef SIGNALGENERATOR_H
2 | #define SIGNALGENERATOR_H
3 |
4 | #include
5 | #include "Device/device.h"
6 |
7 | namespace Ui {
8 | class SignalgeneratorWidget;
9 | }
10 |
11 | class SignalgeneratorWidget : public QWidget
12 | {
13 | Q_OBJECT
14 |
15 | public:
16 | explicit SignalgeneratorWidget(QWidget *parent = nullptr);
17 | ~SignalgeneratorWidget();
18 |
19 | Protocol::GeneratorSettings getDeviceStatus();
20 |
21 | signals:
22 | void SettingsChanged();
23 |
24 | public slots:
25 | void setLevel(double level);
26 | void setFrequency(double frequency);
27 | private:
28 | Ui::SignalgeneratorWidget *ui;
29 | };
30 |
31 | #endif // SIGNALGENERATOR_H
32 |
--------------------------------------------------------------------------------
/Software/PC_Application/SpectrumAnalyzer/tracewidgetsa.cpp:
--------------------------------------------------------------------------------
1 | #include "tracewidgetsa.h"
2 | #include "Traces/tracecsvexport.h"
3 | #include
4 | #include "Traces/traceimportdialog.h"
5 |
6 | TraceWidgetSA::TraceWidgetSA(TraceModel &model, QWidget *parent)
7 | : TraceWidget(model, parent)
8 | {
9 |
10 | }
11 |
12 | void TraceWidgetSA::exportDialog()
13 | {
14 | auto csv = new TraceCSVExport(model);
15 | csv->show();
16 | }
17 |
18 | void TraceWidgetSA::importDialog()
19 | {
20 | auto filename = QFileDialog::getOpenFileName(nullptr, "Open measurement file", "", "CSV files (*.csv)", nullptr, QFileDialog::DontUseNativeDialog);
21 | if (!filename.isEmpty()) {
22 | std::vector traces;
23 | QString prefix = QString();
24 | auto csv = CSV::fromFile(filename);
25 | traces = Trace::createFromCSV(csv);
26 | // contruct prefix from filename
27 | prefix = filename;
28 | // remove any directory names (keep only the filename itself)
29 | int lastSlash = qMax(prefix.lastIndexOf('/'), prefix.lastIndexOf('\\'));
30 | if(lastSlash != -1) {
31 | prefix.remove(0, lastSlash + 1);
32 | }
33 | // remove file type
34 | prefix.truncate(prefix.indexOf('.'));
35 | prefix.append("_");
36 | auto i = new TraceImportDialog(model, traces, prefix);
37 | i->show();
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Software/PC_Application/SpectrumAnalyzer/tracewidgetsa.h:
--------------------------------------------------------------------------------
1 | #ifndef TRACEWIDGETSA_H
2 | #define TRACEWIDGETSA_H
3 |
4 | #include "Traces/tracewidget.h"
5 |
6 | class TraceWidgetSA : public TraceWidget
7 | {
8 | public:
9 | TraceWidgetSA(TraceModel &model, QWidget *parent = nullptr);
10 | protected slots:
11 | virtual void exportDialog() override;
12 | virtual void importDialog() override;
13 |
14 | protected:
15 | virtual Trace::LiveParameter defaultParameter() override {return Trace::LiveParameter::Port1;};
16 | };
17 |
18 | #endif // TRACEWIDGETSA_H
19 |
--------------------------------------------------------------------------------
/Software/PC_Application/Tools/eseries.h:
--------------------------------------------------------------------------------
1 | #ifndef ESERIES_H
2 | #define ESERIES_H
3 |
4 |
5 | class ESeries
6 | {
7 | public:
8 | enum class Series {
9 | Ideal = 0,
10 | E6 = 1,
11 | E12 = 2,
12 | E24 = 3,
13 | E48 = 4,
14 | E96 = 5,
15 | };
16 | enum class Type {
17 | BestMatch = 0,
18 | Lower = 1,
19 | Higher = 2,
20 | };
21 |
22 | static double ToESeries(double value, Series s, Type t = Type::BestMatch);
23 | };
24 |
25 | #endif // ESERIES_H
26 |
--------------------------------------------------------------------------------
/Software/PC_Application/Tools/impedancematchdialog.h:
--------------------------------------------------------------------------------
1 | #ifndef IMPEDANCEMATCHDIALOG_H
2 | #define IMPEDANCEMATCHDIALOG_H
3 |
4 | #include
5 | #include "Traces/tracemarkermodel.h"
6 |
7 | namespace Ui {
8 | class ImpedanceMatchDialog;
9 | }
10 |
11 | class ImpedanceMatchDialog : public QDialog
12 | {
13 | Q_OBJECT
14 |
15 | public:
16 | explicit ImpedanceMatchDialog(TraceMarkerModel &model, TraceMarker *marker = nullptr, QWidget *parent = nullptr);
17 | ~ImpedanceMatchDialog();
18 |
19 | private slots:
20 | void on_cSource_currentIndexChanged(int index);
21 | void calculateMatch();
22 |
23 | private:
24 | static constexpr double Z0 = 50.0;
25 | Ui::ImpedanceMatchDialog *ui;
26 | };
27 |
28 | #endif // IMPEDANCEMATCHDIALOG_H
29 |
--------------------------------------------------------------------------------
/Software/PC_Application/Tools/parameters.cpp:
--------------------------------------------------------------------------------
1 | #include "parameters.h"
2 |
3 | Sparam::Sparam(const Tparam &t) {
4 | m11 = t.m12 / t.m22;
5 | m21 = Type(1) / t.m22;
6 | m12 = (t.m11*t.m22 - t.m12*t.m21) / t.m22;
7 | m22 = -t.m21 / t.m22;
8 | }
9 |
10 | Sparam::Sparam(const ABCDparam &a, Type Z01, Type Z02) {
11 | auto denom = a.m11*Z02+a.m12+a.m21*Z01*Z02+a.m22*Z01;
12 | m11 = (a.m11*Z02+a.m12-a.m21*conj(Z01)*Z02-a.m22*conj(Z01)) / denom;
13 | m12 = (2.0*(a.m11*a.m22-a.m12*a.m21)*sqrt(real(Z01)*real(Z02))) / denom;
14 | m21 = (2.0*sqrt(real(Z01)*real(Z02))) / denom;
15 | m22 = (-a.m11*conj(Z02)+a.m12-a.m21*Z01*conj(Z02)+a.m22*Z01) / denom;
16 | }
17 |
18 | Sparam::Sparam(const ABCDparam &a, Type Z0)
19 | : Sparam(a, Z0, Z0)
20 | {
21 | }
22 |
23 | ABCDparam::ABCDparam(const Sparam &s, Type Z01, Type Z02)
24 | {
25 | auto denom = 2.0*s.m21*sqrt(real(Z01)*real(Z02));
26 | m11 = ((conj(Z01)+s.m11*Z01)*(1.0-s.m22)+s.m12*s.m21*Z01) / denom;
27 | m12 = ((conj(Z01)+s.m11*Z01)*(conj(Z02)+s.m22*Z02)-s.m12*s.m21*Z01*Z02) / denom;
28 | m21 = ((1.0-s.m11)*(1.0-s.m22)-s.m12*s.m21) / denom;
29 | m22 = ((1.0-s.m11)*(conj(Z02)+s.m22*Z02)+s.m12*s.m21*Z02) / denom;
30 | }
31 |
32 | Tparam::Tparam(const Sparam &s)
33 | {
34 | m11 = -(s.m11*s.m22 - s.m12*s.m21) / s.m21;
35 | m12 = s.m11 / s.m21;
36 | m21 = -s.m22 / s.m21;
37 | m22 = 1.0 / s.m21;
38 | }
39 |
40 | ABCDparam::ABCDparam(const Sparam &s, Type Z0)
41 | : ABCDparam(s, Z0, Z0)
42 | {
43 | }
44 |
--------------------------------------------------------------------------------
/Software/PC_Application/TraceSetup:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/TraceSetup
--------------------------------------------------------------------------------
/Software/PC_Application/Traces/Math/dft.h:
--------------------------------------------------------------------------------
1 | #ifndef DFT_H
2 | #define DFT_H
3 |
4 | #include "tracemath.h"
5 | #include "windowfunction.h"
6 |
7 | namespace Math {
8 |
9 | class DFT : public TraceMath
10 | {
11 | public:
12 | DFT();
13 |
14 | DataType outputType(DataType inputType) override;
15 | QString description() override;
16 | void edit() override;
17 |
18 | static QWidget* createExplanationWidget();
19 |
20 | virtual nlohmann::json toJSON() override;
21 | virtual void fromJSON(nlohmann::json j) override;
22 | Type getType() override {return Type::DFT;};
23 |
24 | public slots:
25 | void inputSamplesChanged(unsigned int begin, unsigned int end) override;
26 |
27 | private:
28 | void updateDFT();
29 | bool automaticDC;
30 | double DCfreq;
31 | WindowFunction window;
32 | };
33 |
34 | }
35 |
36 | #endif // DFT_H
37 |
--------------------------------------------------------------------------------
/Software/PC_Application/Traces/Math/dftexplanationwidget.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | DFTExplanationWidget
4 |
5 |
6 |
7 | 0
8 | 0
9 | 364
10 | 412
11 |
12 |
13 |
14 | Form
15 |
16 |
17 | -
18 |
19 |
20 | <html><head/><body><p><span style=" font-weight:600;">DFT</span></p><p>Performs a DFT on the time domain data, transforming it back into the frequency domain.</p><p>There are two possible choices for the DC bin frequency:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Automatic: Check frequency span of the original data that was used to create the time domain values and use the same frequency values for the DFT.</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Manual: User selectable frequency which is used for the DC bin.</li></ul><p><br/></p><p><br/></p></body></html>
21 |
22 |
23 | true
24 |
25 |
26 |
27 | -
28 |
29 |
30 | Qt::Vertical
31 |
32 |
33 |
34 | 20
35 | 40
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/Software/PC_Application/Traces/Math/expression.h:
--------------------------------------------------------------------------------
1 | #ifndef EXPRESSION_H
2 | #define EXPRESSION_H
3 |
4 | #include "tracemath.h"
5 | #include "parser/mpParser.h"
6 |
7 | namespace Math {
8 |
9 | class Expression : public TraceMath
10 | {
11 | public:
12 | Expression();
13 | ~Expression();
14 |
15 | DataType outputType(DataType inputType) override;
16 | QString description() override;
17 | void edit() override;
18 |
19 | static QWidget* createExplanationWidget();
20 |
21 | virtual nlohmann::json toJSON() override;
22 | virtual void fromJSON(nlohmann::json j) override;
23 | Type getType() override {return Type::Expression;};
24 |
25 | public slots:
26 | void inputSamplesChanged(unsigned int begin, unsigned int end) override;
27 |
28 | private slots:
29 | void expressionChanged();
30 | private:
31 | QString exp;
32 | mup::ParserX *parser;
33 | mup::Value t, d, f, w, x;
34 | };
35 |
36 | }
37 |
38 | #endif // EXPRESSION_H
39 |
--------------------------------------------------------------------------------
/Software/PC_Application/Traces/Math/expressionexplanationwidget.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | ExpressionExplanationWidget
4 |
5 |
6 |
7 | 0
8 | 0
9 | 417
10 | 421
11 |
12 |
13 |
14 | Form
15 |
16 |
17 | -
18 |
19 |
20 | <html><head/><body><p><span style=" font-weight:600;">Custom Expression</span></p><p>Create your own math function by defining a custom expression that is applied to the data. Depending on the input domain, the expression works in the time or frequency domain.</p><p><br/></p></body></html>
21 |
22 |
23 | true
24 |
25 |
26 |
27 | -
28 |
29 |
30 | Qt::Vertical
31 |
32 |
33 |
34 | 20
35 | 251
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/Software/PC_Application/Traces/Math/medianfilter.h:
--------------------------------------------------------------------------------
1 | #ifndef MEDIANFILTER_H
2 | #define MEDIANFILTER_H
3 |
4 | #include "tracemath.h"
5 |
6 | namespace Math {
7 |
8 | class MedianFilter : public TraceMath
9 | {
10 | public:
11 | MedianFilter();
12 |
13 | virtual DataType outputType(DataType inputType) override;
14 | virtual QString description() override;
15 |
16 | virtual void edit() override;
17 |
18 | static QWidget *createExplanationWidget();
19 |
20 | virtual nlohmann::json toJSON() override;
21 | virtual void fromJSON(nlohmann::json j) override;
22 | Type getType() override {return Type::MedianFilter;};
23 |
24 | public slots:
25 | // a single value of the input data has changed, index determines which sample has changed
26 | virtual void inputSamplesChanged(unsigned int begin, unsigned int end) override;
27 |
28 | private:
29 | unsigned int kernelSize;
30 | enum class Order {
31 | AbsoluteValue = 0,
32 | Phase = 1,
33 | Real = 2,
34 | Imag = 3,
35 | } order;
36 | static QString orderToString(Order o);
37 | };
38 |
39 | }
40 |
41 | #endif // MEDIANFILTER_H
42 |
--------------------------------------------------------------------------------
/Software/PC_Application/Traces/Math/newtracemathdialog.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | NewTraceMathDialog
4 |
5 |
6 | Qt::ApplicationModal
7 |
8 |
9 |
10 | 0
11 | 0
12 | 840
13 | 596
14 |
15 |
16 |
17 | Available math operations
18 |
19 |
20 | true
21 |
22 |
23 | -
24 |
25 |
-
26 |
27 |
28 | -
29 |
30 |
31 | -1
32 |
33 |
34 |
35 |
36 |
37 | -
38 |
39 |
40 | Qt::Horizontal
41 |
42 |
43 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 | buttonBox
53 | accepted()
54 | NewTraceMathDialog
55 | accept()
56 |
57 |
58 | 248
59 | 254
60 |
61 |
62 | 157
63 | 274
64 |
65 |
66 |
67 |
68 | buttonBox
69 | rejected()
70 | NewTraceMathDialog
71 | reject()
72 |
73 |
74 | 316
75 | 260
76 |
77 |
78 | 286
79 | 274
80 |
81 |
82 |
83 |
84 |
85 |
--------------------------------------------------------------------------------
/Software/PC_Application/Traces/Math/parser/mpFwdDecl.h:
--------------------------------------------------------------------------------
1 | /*
2 | __________ ____ ___
3 | _____ __ _\______ \_____ _______ ______ __________\ \/ /
4 | / \| | \ ___/\__ \\_ __ \/ ___// __ \_ __ \ /
5 | | Y Y \ | / | / __ \| | \/\___ \\ ___/| | \/ \
6 | |__|_| /____/|____| (____ /__| /____ >\___ >__| /___/\ \
7 | \/ \/ \/ \/ \_/
8 | Copyright (C) 2016, Ingo Berg
9 | All rights reserved.
10 |
11 | Redistribution and use in source and binary forms, with or without
12 | modification, are permitted provided that the following conditions are met:
13 |
14 | * Redistributions of source code must retain the above copyright notice,
15 | this list of conditions and the following disclaimer.
16 | * Redistributions in binary form must reproduce the above copyright notice,
17 | this list of conditions and the following disclaimer in the documentation
18 | and/or other materials provided with the distribution.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
24 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 | POSSIBILITY OF SUCH DAMAGE.
30 | */
31 | #ifndef MUP_FWD_DECL_H
32 | #define MUP_FWD_DECL_H
33 |
34 | #include "mpDefines.h"
35 |
36 |
37 | MUP_NAMESPACE_START
38 |
39 | class ParserXBase;
40 | class ParserMessageProviderBase;
41 |
42 | class ICallback;
43 | class IToken;
44 | class IValue;
45 | class IValueReader;
46 | class IPrecedence;
47 | class IOprtIndex;
48 | class Value;
49 | class ValueCache;
50 | template
51 | class TokenPtr;
52 |
53 | MUP_NAMESPACE_END
54 |
55 | #endif
56 |
--------------------------------------------------------------------------------
/Software/PC_Application/Traces/Math/parser/mpIPackage.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | __________ ____ ___
3 | _____ __ _\______ \_____ _______ ______ __________\ \/ /
4 | / \| | \ ___/\__ \\_ __ \/ ___// __ \_ __ \ /
5 | | Y Y \ | / | / __ \| | \/\___ \\ ___/| | \/ \
6 | |__|_| /____/|____| (____ /__| /____ >\___ >__| /___/\ \
7 | \/ \/ \/ \/ \_/
8 | Copyright (C) 2016 Ingo Berg
9 | All rights reserved.
10 |
11 | muParserX - A C++ math parser library with array and string support
12 | Copyright (c) 2016, Ingo Berg
13 | All rights reserved.
14 |
15 | Redistribution and use in source and binary forms, with or without
16 | modification, are permitted provided that the following conditions are met:
17 |
18 | * Redistributions of source code must retain the above copyright notice,
19 | this list of conditions and the following disclaimer.
20 | * Redistributions in binary form must reproduce the above copyright notice,
21 | this list of conditions and the following disclaimer in the documentation
22 | and/or other materials provided with the distribution.
23 |
24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
25 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
28 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
31 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 | POSSIBILITY OF SUCH DAMAGE.
34 | */
35 | #include "mpIPackage.h"
36 |
37 | #include "mpDefines.h"
38 | #include "mpParserBase.h"
39 |
40 |
41 | MUP_NAMESPACE_START
42 |
43 | //------------------------------------------------------------------------------
44 | IPackage::IPackage()
45 | {}
46 |
47 | //------------------------------------------------------------------------------
48 | IPackage::~IPackage()
49 | {}
50 |
51 | MUP_NAMESPACE_END
52 |
--------------------------------------------------------------------------------
/Software/PC_Application/Traces/Math/parser/mpMatrixError.h:
--------------------------------------------------------------------------------
1 | #ifndef MU_MATRIX_ERROR_H
2 | #define MU_MATRIX_ERROR_H
3 |
4 | /*
5 | __________ ____ ___
6 | _____ __ _\______ \_____ _______ ______ __________\ \/ /
7 | / \| | \ ___/\__ \\_ __ \/ ___// __ \_ __ \ /
8 | | Y Y \ | / | / __ \| | \/\___ \\ ___/| | \/ \
9 | |__|_| /____/|____| (____ /__| /____ >\___ >__| /___/\ \
10 | \/ \/ \/ \/ \_/
11 | Copyright (C) 2016, Ingo Berg
12 | All rights reserved.
13 |
14 | Redistribution and use in source and binary forms, with or without
15 | modification, are permitted provided that the following conditions are met:
16 |
17 | * Redistributions of source code must retain the above copyright notice,
18 | this list of conditions and the following disclaimer.
19 | * Redistributions in binary form must reproduce the above copyright notice,
20 | this list of conditions and the following disclaimer in the documentation
21 | and/or other materials provided with the distribution.
22 |
23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 | IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
27 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 | POSSIBILITY OF SUCH DAMAGE.
33 | */
34 |
35 | #include
36 | #include
37 |
38 | MUP_NAMESPACE_START
39 |
40 | class MatrixError : public std::runtime_error
41 | {
42 | public:
43 | explicit MatrixError(const std::string &sMsg)
44 | :std::runtime_error(sMsg)
45 | {}
46 | };
47 |
48 | MUP_NAMESPACE_END
49 |
50 | #endif
51 |
--------------------------------------------------------------------------------
/Software/PC_Application/Traces/Math/parser/mpOprtPostfixCommon.h:
--------------------------------------------------------------------------------
1 | #ifndef MP_OPRT_POSTFIX_COMMON_H
2 | #define MP_OPRT_POSTFIX_COMMON_H
3 |
4 | /** \file
5 | \brief Definitions of classes used as callbacks for standard postfix operators.
6 | */
7 |
8 | /** \defgroup postop Postfix operator callbacks
9 |
10 | This group lists the objects representing the postfix operators of muParserX.
11 | */
12 |
13 | #include "mpIOprt.h"
14 | #include "mpValue.h"
15 | #include "mpError.h"
16 |
17 |
18 | MUP_NAMESPACE_START
19 |
20 | //------------------------------------------------------------------------------
21 | /** \brief Calculate factorial of a non-negative integer.
22 | \ingroup postop
23 | */
24 | class OprtFact : public IOprtPostfix
25 | {
26 | public:
27 |
28 | OprtFact();
29 |
30 | virtual void Eval(ptr_val_type& ret, const ptr_val_type *arg, int) override;
31 | virtual const char_type* GetDesc() const override;
32 | virtual IToken* Clone() const override;
33 | };
34 |
35 | //------------------------------------------------------------------------------
36 | /** \brief Returns percentage of given number.
37 | \ingroup postop
38 | */
39 | class OprtPercentage : public IOprtPostfix
40 | {
41 | public:
42 |
43 | OprtPercentage();
44 |
45 | virtual void Eval(ptr_val_type& ret, const ptr_val_type *arg, int) override;
46 | virtual const char_type* GetDesc() const override;
47 | virtual IToken* Clone() const override;
48 | };
49 | } // namespace mu
50 |
51 | #endif
52 |
--------------------------------------------------------------------------------
/Software/PC_Application/Traces/Math/parser/mpParserMessageProvider.h:
--------------------------------------------------------------------------------
1 | #ifndef MP_PARSER_MESSAGE_PROVIDER_H
2 | #define MP_PARSER_MESSAGE_PROVIDER_H
3 |
4 | #include
5 | #include
6 |
7 | #include "mpDefines.h"
8 | #include "mpTypes.h"
9 |
10 |
11 | MUP_NAMESPACE_START
12 |
13 | //-----------------------------------------------------------------------------------------------
14 | /** \brief Base class for Parser Message providing classes. */
15 | class ParserMessageProviderBase
16 | {
17 | friend class std::unique_ptr;
18 |
19 | public:
20 | ParserMessageProviderBase();
21 | virtual ~ParserMessageProviderBase();
22 |
23 | void Init();
24 | string_type GetErrorMsg(EErrorCodes errc) const;
25 |
26 | private:
27 | // Disable CC and assignment operator for this class and derivatives
28 | ParserMessageProviderBase(const ParserMessageProviderBase &ref);
29 | ParserMessageProviderBase& operator=(const ParserMessageProviderBase &ref);
30 |
31 | protected:
32 | std::vector m_vErrMsg;
33 |
34 | virtual void InitErrorMessages() = 0;
35 | };
36 |
37 | //-----------------------------------------------------------------------------------------------
38 | /** \brief English versions of parser messages. */
39 | class ParserMessageProviderEnglish : public ParserMessageProviderBase
40 | {
41 | public:
42 | ParserMessageProviderEnglish();
43 |
44 | protected:
45 | virtual void InitErrorMessages();
46 | };
47 |
48 | //-----------------------------------------------------------------------------------------------
49 | /** \brief German versions of parser messages. */
50 | class ParserMessageProviderGerman : public ParserMessageProviderBase
51 | {
52 | public:
53 | ParserMessageProviderGerman();
54 |
55 | protected:
56 | virtual void InitErrorMessages();
57 | };
58 |
59 | MUP_NAMESPACE_END
60 |
61 | #endif
62 |
--------------------------------------------------------------------------------
/Software/PC_Application/Traces/Math/tdr.h:
--------------------------------------------------------------------------------
1 | #ifndef TDRLOWPASS_H
2 | #define TDRLOWPASS_H
3 |
4 | #include "tracemath.h"
5 | #include "windowfunction.h"
6 |
7 | namespace Math {
8 |
9 | class TDR : public TraceMath
10 | {
11 | public:
12 | TDR();
13 |
14 | DataType outputType(DataType inputType) override;
15 | QString description() override;
16 | void edit() override;
17 |
18 | static QWidget* createExplanationWidget();
19 |
20 | virtual nlohmann::json toJSON() override;
21 | virtual void fromJSON(nlohmann::json j) override;
22 | Type getType() override {return Type::TDR;};
23 |
24 | enum class Mode {
25 | Lowpass,
26 | Bandpass,
27 | };
28 | Mode getMode() const;
29 | const WindowFunction& getWindow() const;
30 |
31 | public slots:
32 | void inputSamplesChanged(unsigned int begin, unsigned int end) override;
33 |
34 | private:
35 | void updateTDR();
36 | Mode mode;
37 | WindowFunction window;
38 | bool stepResponse;
39 | bool automaticDC;
40 | std::complex manualDC;
41 | };
42 |
43 | }
44 |
45 | #endif // TDRBANDPASS_H
46 |
--------------------------------------------------------------------------------
/Software/PC_Application/Traces/Math/tdrexplanationwidget.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | TDRExplanationWidget
4 |
5 |
6 |
7 | 0
8 | 0
9 | 364
10 | 412
11 |
12 |
13 |
14 | Form
15 |
16 |
17 | -
18 |
19 |
20 | <html><head/><body><p><span style=" font-weight:600;">TDR (IDFT)</span></p><p>This operation performs an inverse DFT on the frequency data, resulting in time domain data.</p><p>Two modes are available:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Bandpass: The center frequency is used as the DC bin for the IDFT. In this mode, any span can be used as the input, but in the time domain no step response is available.</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Lowpass: The start frequency is used as the DC bin. If a step response should also be calculated, the start frequency should be as low as possible.</li></ul><p><br/></p><p><br/></p></body></html>
21 |
22 |
23 | true
24 |
25 |
26 |
27 | -
28 |
29 |
30 | Qt::Vertical
31 |
32 |
33 |
34 | 20
35 | 40
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/Software/PC_Application/Traces/Math/tracematheditdialog.h:
--------------------------------------------------------------------------------
1 | #ifndef TRACEMATHEDITDIALOG_H
2 | #define TRACEMATHEDITDIALOG_H
3 |
4 | #include
5 | #include
6 | #include "Traces/trace.h"
7 |
8 | namespace Ui {
9 | class TraceMathEditDialog;
10 | }
11 |
12 | class MathModel : public QAbstractTableModel
13 | {
14 | Q_OBJECT
15 | public:
16 | MathModel(Trace &t, QObject *parent = 0);
17 |
18 | enum {
19 | ColIndexStatus = 0,
20 | ColIndexDescription = 1,
21 | ColIndexDomain = 2,
22 | ColIndexLast,
23 | };
24 |
25 | int rowCount(const QModelIndex &parent = QModelIndex()) const override;
26 | int columnCount(const QModelIndex &parent = QModelIndex()) const override;
27 | QVariant data(const QModelIndex &index, int role) const override;
28 | QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
29 | Qt::ItemFlags flags(const QModelIndex &index) const override;
30 |
31 | void addOperation(TraceMath *math);
32 | void deleteRow(unsigned int row);
33 |
34 | private:
35 | Trace &t;
36 | };
37 |
38 | class TraceMathEditDialog : public QDialog
39 | {
40 | Q_OBJECT
41 |
42 | public:
43 | explicit TraceMathEditDialog(Trace &t, QWidget *parent = nullptr);
44 | ~TraceMathEditDialog();
45 |
46 | private:
47 | Ui::TraceMathEditDialog *ui;
48 | };
49 |
50 | #endif // TRACEMATHEDITDIALOG_H
51 |
--------------------------------------------------------------------------------
/Software/PC_Application/Traces/Math/windowfunction.h:
--------------------------------------------------------------------------------
1 | #ifndef WINDOWFUNCTION_H
2 | #define WINDOWFUNCTION_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include "savable.h"
8 |
9 | class WindowFunction : public QObject, public Savable
10 | {
11 | Q_OBJECT;
12 | public:
13 | enum class Type {
14 | Rectangular,
15 | // Kaiser,
16 | Gaussian,
17 | // Chebyshev,
18 | Hann,
19 | Hamming,
20 | Blackman,
21 | // always has to be the last entry
22 | Last,
23 | };
24 | static QString typeToName(Type type);
25 |
26 | WindowFunction(Type type = Type::Hamming);
27 |
28 | void apply(std::vector>& data) const;
29 | void reverse(std::vector>& data) const;
30 |
31 | QWidget *createEditor();
32 |
33 | Type getType() const;
34 | QString getDescription();
35 |
36 | virtual nlohmann::json toJSON() override;
37 | virtual void fromJSON(nlohmann::json j) override;
38 |
39 | signals:
40 | void changed();
41 |
42 | private:
43 | double getFactor(unsigned int n, unsigned int N) const;
44 | Type type;
45 | // parameters for the different types. Not all windows use one and most only one.
46 | // But keeping all parameters for all windows allows switching between window types
47 | // while remembering the settings for each type
48 | double kaiser_alpha;
49 | double gaussian_sigma;
50 | double chebyshev_alpha;
51 | };
52 |
53 | #endif // WINDOWFUNCTION_H
54 |
--------------------------------------------------------------------------------
/Software/PC_Application/Traces/markerwidget.h:
--------------------------------------------------------------------------------
1 | #ifndef MARKERWIDGET_H
2 | #define MARKERWIDGET_H
3 |
4 | #include
5 | #include "tracemarkermodel.h"
6 |
7 | namespace Ui {
8 | class MarkerWidget;
9 | }
10 |
11 | class MarkerWidget : public QWidget
12 | {
13 | Q_OBJECT
14 |
15 | public:
16 | explicit MarkerWidget(TraceMarkerModel &model, QWidget *parent = nullptr);
17 | ~MarkerWidget();
18 |
19 | private slots:
20 | void on_bDelete_clicked();
21 | void on_bAdd_clicked();
22 | void updatePersistentEditors();
23 |
24 | private:
25 | Ui::MarkerWidget *ui;
26 | TraceMarkerModel &model;
27 | };
28 |
29 | #endif // MARKERWIDGET_H
30 |
--------------------------------------------------------------------------------
/Software/PC_Application/Traces/smithchartdialog.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | SmithChartDialog
4 |
5 |
6 |
7 | 0
8 | 0
9 | 302
10 | 76
11 |
12 |
13 |
14 | Smithchart Setup
15 |
16 |
17 | true
18 |
19 |
20 | -
21 |
22 |
-
23 |
24 |
25 | Display mode:
26 |
27 |
28 |
29 | -
30 |
31 |
-
32 |
33 | Show complete traces
34 |
35 |
36 | -
37 |
38 | Limit to current span
39 |
40 |
41 |
42 |
43 |
44 |
45 | -
46 |
47 |
48 | Qt::Horizontal
49 |
50 |
51 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 | buttonBox
61 | accepted()
62 | SmithChartDialog
63 | accept()
64 |
65 |
66 | 248
67 | 254
68 |
69 |
70 | 157
71 | 274
72 |
73 |
74 |
75 |
76 | buttonBox
77 | rejected()
78 | SmithChartDialog
79 | reject()
80 |
81 |
82 | 316
83 | 260
84 |
85 |
86 | 286
87 | 274
88 |
89 |
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/Software/PC_Application/Traces/tracecsvexport.h:
--------------------------------------------------------------------------------
1 | #ifndef TRACECSVEXPORT_H
2 | #define TRACECSVEXPORT_H
3 |
4 | #include
5 | #include "tracemodel.h"
6 |
7 | namespace Ui {
8 | class TraceCSVExport;
9 | }
10 |
11 | class TraceCSVModel : public QAbstractListModel
12 | {
13 | Q_OBJECT
14 | public:
15 | TraceCSVModel(std::vector traces, QObject *parent = 0);
16 | ~TraceCSVModel(){};
17 |
18 | int rowCount(const QModelIndex &parent = QModelIndex()) const override;
19 | QVariant data(const QModelIndex &index, int role) const override;
20 | bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
21 | Qt::ItemFlags flags(const QModelIndex &index) const override;
22 |
23 | std::vector tracesToExport();
24 | signals:
25 | void selectionChanged(bool anySelected);
26 | private:
27 | // check which traces can be exported (only allow traces on the same domain with identical span/time)
28 | void updateEnabledTraces();
29 | unsigned int points;
30 | double minX, maxX;
31 | Trace::DataType type;
32 | std::vector traces;
33 | std::vector enabled;
34 | std::vector save;
35 | };
36 |
37 | class TraceCSVExport : public QDialog
38 | {
39 | Q_OBJECT
40 |
41 | public:
42 | explicit TraceCSVExport(TraceModel &model, QWidget *parent = nullptr);
43 | ~TraceCSVExport();
44 |
45 | private slots:
46 | void on_buttonBox_accepted();
47 |
48 | private:
49 | Ui::TraceCSVExport *ui;
50 | TraceCSVModel model;
51 | };
52 |
53 | #endif // TRACECSVEXPORT_H
54 |
--------------------------------------------------------------------------------
/Software/PC_Application/Traces/tracecsvexport.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | TraceCSVExport
4 |
5 |
6 | Qt::ApplicationModal
7 |
8 |
9 |
10 | 0
11 | 0
12 | 286
13 | 322
14 |
15 |
16 |
17 | CSV Export
18 |
19 |
20 | true
21 |
22 |
23 | -
24 |
25 |
26 | QAbstractItemView::SelectRows
27 |
28 |
29 |
30 | -
31 |
32 |
33 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | buttonBox
43 | accepted()
44 | TraceCSVExport
45 | accept()
46 |
47 |
48 | 298
49 | 300
50 |
51 |
52 | 298
53 | 160
54 |
55 |
56 |
57 |
58 | buttonBox
59 | rejected()
60 | TraceCSVExport
61 | reject()
62 |
63 |
64 | 298
65 | 300
66 |
67 |
68 | 298
69 | 160
70 |
71 |
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/Software/PC_Application/Traces/traceeditdialog.h:
--------------------------------------------------------------------------------
1 | #ifndef TRACEEDITDIALOG_H
2 | #define TRACEEDITDIALOG_H
3 |
4 | #include
5 | #include "trace.h"
6 |
7 | namespace Ui {
8 | class TraceEditDialog;
9 | }
10 |
11 | class TraceEditDialog : public QDialog
12 | {
13 | Q_OBJECT
14 |
15 | public:
16 | explicit TraceEditDialog(Trace &t, QWidget *parent = nullptr);
17 | ~TraceEditDialog();
18 |
19 | private slots:
20 | void on_buttonBox_accepted();
21 |
22 | private:
23 | Ui::TraceEditDialog *ui;
24 | Trace &trace;
25 | bool VNAtrace;
26 | };
27 |
28 | #endif // TRACEEDITDIALOG_H
29 |
--------------------------------------------------------------------------------
/Software/PC_Application/Traces/traceimportdialog.h:
--------------------------------------------------------------------------------
1 | #ifndef TRACEIMPORTDIALOG_H
2 | #define TRACEIMPORTDIALOG_H
3 |
4 | #include
5 | #include "tracemodel.h"
6 | #include
7 |
8 | namespace Ui {
9 | class TraceImportDialog;
10 | }
11 |
12 | class TraceParameterModel : public QAbstractTableModel
13 | {
14 | Q_OBJECT
15 | friend class TraceImportDialog;
16 | public:
17 | TraceParameterModel(std::vector traces, QString prefix, QObject *parent = 0);
18 | ~TraceParameterModel(){};
19 |
20 | int rowCount(const QModelIndex &parent = QModelIndex()) const override;
21 | int columnCount(const QModelIndex &parent = QModelIndex()) const override;
22 | QVariant data(const QModelIndex &index, int role) const override;
23 | QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
24 | bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
25 | Qt::ItemFlags flags(const QModelIndex &index) const override;
26 |
27 | // adds all enabled traces to the model, deletes other traces
28 | void import(TraceModel &model);
29 | private:
30 | class Parameter {
31 | public:
32 | bool enabled;
33 | QString trace;
34 | QString name;
35 | QColor color;
36 | };
37 | std::vector params;
38 | std::vector traces;
39 | };
40 |
41 | class TraceImportDialog : public QDialog
42 | {
43 | Q_OBJECT
44 |
45 | public:
46 | explicit TraceImportDialog(TraceModel &model, std::vector traces, QString prefix = QString(), QWidget *parent = nullptr);
47 | ~TraceImportDialog();
48 |
49 | private slots:
50 | void on_buttonBox_accepted();
51 | void on_tableView_doubleClicked(const QModelIndex &index);
52 |
53 | private:
54 | Ui::TraceImportDialog *ui;
55 | TraceModel &model;
56 | TraceParameterModel *tableModel;
57 | };
58 |
59 | #endif // TRACEIMPORTDIALOG_H
60 |
--------------------------------------------------------------------------------
/Software/PC_Application/Traces/traceimportdialog.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | TraceImportDialog
4 |
5 |
6 |
7 | 0
8 | 0
9 | 396
10 | 420
11 |
12 |
13 |
14 | Import Traces
15 |
16 |
17 | -
18 |
19 |
20 | false
21 |
22 |
23 | 21
24 |
25 |
26 | 80
27 |
28 |
29 | true
30 |
31 |
32 | false
33 |
34 |
35 |
36 | -
37 |
38 |
39 | Qt::Horizontal
40 |
41 |
42 | QDialogButtonBox::Cancel|QDialogButtonBox::Ok
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | buttonBox
52 | accepted()
53 | TraceImportDialog
54 | accept()
55 |
56 |
57 | 248
58 | 254
59 |
60 |
61 | 157
62 | 274
63 |
64 |
65 |
66 |
67 | buttonBox
68 | rejected()
69 | TraceImportDialog
70 | reject()
71 |
72 |
73 | 316
74 | 260
75 |
76 |
77 | 286
78 | 274
79 |
80 |
81 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/Software/PC_Application/Traces/tracemodel.h:
--------------------------------------------------------------------------------
1 | #ifndef TRACEMODEL_H
2 | #define TRACEMODEL_H
3 |
4 | #include
5 | #include "trace.h"
6 | #include
7 | #include "Device/device.h"
8 | #include "savable.h"
9 |
10 | class TraceModel : public QAbstractTableModel, public Savable
11 | {
12 | Q_OBJECT
13 | public:
14 | TraceModel(QObject *parent = 0);
15 | ~TraceModel();
16 |
17 | enum {
18 | ColIndexVisible = 0,
19 | ColIndexPlayPause = 1,
20 | ColIndexMath = 2,
21 | ColIndexName = 3,
22 | ColIndexLast,
23 | };
24 |
25 | void addTrace(Trace *t);
26 | void removeTrace(unsigned int index);
27 | Trace *trace(unsigned int index);
28 | void toggleVisibility(unsigned int index);
29 | void togglePause(unsigned int index);
30 | void toggleMath(unsigned int index);
31 |
32 | int rowCount(const QModelIndex &parent = QModelIndex()) const override;
33 | int columnCount(const QModelIndex &parent = QModelIndex()) const override;
34 | QVariant data(const QModelIndex &index, int role) const override;
35 |
36 | std::vector getTraces();
37 |
38 | bool PortExcitationRequired(int port);
39 |
40 | virtual nlohmann::json toJSON() override;
41 | virtual void fromJSON(nlohmann::json j) override;
42 |
43 | signals:
44 | void SpanChanged(double fmin, double fmax);
45 | void traceAdded(Trace *t);
46 | void traceRemoved(Trace *t);
47 | void requiredExcitation(bool excitePort1, bool excitePort2);
48 | void traceNameChanged(Trace *t);
49 |
50 | public slots:
51 | void clearVNAData();
52 | void addVNAData(const Protocol::Datapoint& d, const Protocol::SweepSettings& settings);
53 | void addSAData(const Protocol::SpectrumAnalyzerResult& d, const Protocol::SpectrumAnalyzerSettings& settings);
54 |
55 | private:
56 | std::vector traces;
57 | };
58 |
59 | #endif // TRACEMODEL_H
60 |
--------------------------------------------------------------------------------
/Software/PC_Application/Traces/tracesmithchart.h:
--------------------------------------------------------------------------------
1 | #ifndef TRACESMITHCHART_H
2 | #define TRACESMITHCHART_H
3 |
4 | #include "traceplot.h"
5 | #include
6 | #include
7 | #include
8 |
9 | class TraceSmithChart : public TracePlot
10 | {
11 | Q_OBJECT
12 | public:
13 | TraceSmithChart(TraceModel &model, QWidget *parent = 0);
14 |
15 | virtual Type getType() override { return Type::SmithChart;};
16 |
17 | virtual nlohmann::json toJSON() override;
18 | virtual void fromJSON(nlohmann::json j) override;
19 | public slots:
20 | void axisSetupDialog();
21 | protected:
22 | static constexpr double ReferenceImpedance = 50.0;
23 | static constexpr double screenUsage = 0.9;
24 | static constexpr double smithCoordMax = 4096;
25 |
26 | QPoint dataToPixel(Trace::Data d);
27 | std::complex pixelToData(QPoint p);
28 | QPoint markerToPixel(TraceMarker *m) override;
29 | double nearestTracePoint(Trace *t, QPoint pixel) override;
30 |
31 | //void paintEvent(QPaintEvent *event) override;
32 | virtual void updateContextMenu() override;
33 | bool supported(Trace *t) override;
34 | virtual void draw(QPainter& painter) override;
35 | virtual void traceDropped(Trace *t, QPoint position) override;
36 | QString mouseText(QPoint pos) override;
37 | bool limitToSpan;
38 | QTransform transform;
39 | };
40 |
41 | #endif // TRACESMITHCHART_H
42 |
--------------------------------------------------------------------------------
/Software/PC_Application/Traces/tracetouchstoneexport.h:
--------------------------------------------------------------------------------
1 | #ifndef TRACETOUCHSTONEEXPORT_H
2 | #define TRACETOUCHSTONEEXPORT_H
3 |
4 | #include
5 | #include
6 | #include "tracemodel.h"
7 | #include
8 |
9 | namespace Ui {
10 | class TraceTouchstoneExport;
11 | }
12 |
13 | class TraceTouchstoneExport : public QDialog
14 | {
15 | Q_OBJECT
16 |
17 | public:
18 | explicit TraceTouchstoneExport(TraceModel &model, QWidget *parent = nullptr);
19 | ~TraceTouchstoneExport();
20 | bool setTrace(int portFrom, int portTo, Trace *t);
21 | bool setPortNum(int ports);
22 |
23 | private slots:
24 | void on_buttonBox_accepted();
25 | void on_sbPorts_valueChanged(int ports);
26 | void selectionChanged(QComboBox *w);
27 |
28 | private:
29 | Ui::TraceTouchstoneExport *ui;
30 | TraceModel &model;
31 | std::vector> cTraces;
32 |
33 | unsigned int points;
34 | double lowerFreq, upperFreq;
35 | bool freqsSet;
36 | };
37 |
38 | #endif // TRACEEXPORTDIALOG_H
39 |
--------------------------------------------------------------------------------
/Software/PC_Application/Traces/tracewidget.h:
--------------------------------------------------------------------------------
1 | #ifndef TRACEWIDGET_H
2 | #define TRACEWIDGET_H
3 |
4 | #include
5 | #include "tracemodel.h"
6 |
7 | namespace Ui {
8 | class TraceWidget;
9 | }
10 |
11 | class TraceWidget : public QWidget
12 | {
13 | Q_OBJECT
14 |
15 | public:
16 | explicit TraceWidget(TraceModel &model, QWidget *parent = nullptr);
17 | ~TraceWidget();
18 |
19 | protected slots:
20 | void on_add_clicked();
21 | void on_remove_clicked();
22 | void on_edit_clicked();
23 | void on_view_doubleClicked(const QModelIndex &index);
24 | void on_view_clicked(const QModelIndex &index);
25 | virtual void exportDialog() = 0;
26 | virtual void importDialog() = 0;
27 |
28 | protected:
29 | bool eventFilter(QObject *obj, QEvent *event) override;
30 | virtual Trace::LiveParameter defaultParameter() = 0;
31 | QPoint dragStartPosition;
32 | Trace *dragTrace;
33 | Ui::TraceWidget *ui;
34 | TraceModel &model;
35 | int createCount;
36 | };
37 |
38 | #endif // TRACEWIDGET_H
39 |
--------------------------------------------------------------------------------
/Software/PC_Application/Traces/xyplotaxisdialog.h:
--------------------------------------------------------------------------------
1 | #ifndef XYPLOTAXISDIALOG_H
2 | #define XYPLOTAXISDIALOG_H
3 |
4 | #include
5 | #include "tracexyplot.h"
6 |
7 | namespace Ui {
8 | class XYplotAxisDialog;
9 | }
10 |
11 | class XYplotAxisDialog : public QDialog
12 | {
13 | Q_OBJECT
14 |
15 | public:
16 | explicit XYplotAxisDialog(TraceXYPlot *plot);
17 | ~XYplotAxisDialog();
18 |
19 | private slots:
20 | void on_buttonBox_accepted();
21 | void XAxisTypeChanged(int XAxisIndex);
22 |
23 | private:
24 | std::set supportedYAxis(TraceXYPlot::XAxisType type);
25 | Ui::XYplotAxisDialog *ui;
26 | TraceXYPlot *plot;
27 | };
28 |
29 | #endif // XYPLOTAXISDIALOG_H
30 |
--------------------------------------------------------------------------------
/Software/PC_Application/Util/qpointervariant.h:
--------------------------------------------------------------------------------
1 | #ifndef QPOINTERVARIANT_H
2 | #define QPOINTERVARIANT_H
3 |
4 | #include
5 |
6 | class QPointerVariant {
7 | public:
8 | template QPointerVariant(T *ptr)
9 | : ptr(static_cast(ptr)),
10 | variant(QVariant(*ptr)){};
11 | void setValue(const QVariant &value) {
12 | auto destType = variant.type();
13 | if(!value.canConvert(destType)) {
14 | throw std::runtime_error("Unable to convert QVariant to requested type");
15 | }
16 | variant = value;
17 | variant.convert(destType);
18 | QMetaType mt(destType);
19 | mt.construct(ptr, variant.constData());
20 | }
21 | QVariant value() {
22 | return QVariant(variant.type(), ptr);
23 | }
24 | private:
25 | void *ptr;
26 | QVariant variant;
27 | };
28 |
29 | #endif // QPOINTERVARIANT_H
30 |
--------------------------------------------------------------------------------
/Software/PC_Application/Util/util.h:
--------------------------------------------------------------------------------
1 | #ifndef UTILH_H
2 | #define UTILH_H
3 |
4 | namespace Util {
5 | template T Scale(T value, T from_low, T from_high, T to_low, T to_high) {
6 | value -= from_low;
7 | value *= (to_high - to_low) / (from_high - from_low);
8 | value += to_low;
9 | return value;
10 | }
11 | }
12 |
13 | #endif // UTILH_H
14 |
--------------------------------------------------------------------------------
/Software/PC_Application/VNA/Deembedding/deembedding.h:
--------------------------------------------------------------------------------
1 | #ifndef DEEMBEDDING_H
2 | #define DEEMBEDDING_H
3 |
4 | #include "deembeddingoption.h"
5 | #include
6 | #include
7 | #include "savable.h"
8 |
9 | class Deembedding : public QObject, public Savable
10 | {
11 | Q_OBJECT
12 | public:
13 | Deembedding(){};
14 | ~Deembedding(){};
15 |
16 | void Deembed(Protocol::Datapoint &d);
17 |
18 | void removeOption(unsigned int index);
19 | void addOption(DeembeddingOption* option);
20 | void swapOptions(unsigned int index);
21 | std::vector& getOptions() {return options;};
22 | nlohmann::json toJSON() override;
23 | void fromJSON(nlohmann::json j) override;
24 | public slots:
25 | void configure();
26 |
27 | private:
28 | std::vector options;
29 | };
30 |
31 | #endif // DEEMBEDDING_H
32 |
--------------------------------------------------------------------------------
/Software/PC_Application/VNA/Deembedding/deembeddingdialog.h:
--------------------------------------------------------------------------------
1 | #ifndef DEEMBEDDINGDIALOG_H
2 | #define DEEMBEDDINGDIALOG_H
3 |
4 | #include
5 | #include "deembeddingoption.h"
6 | #include "deembedding.h"
7 | #include
8 |
9 | namespace Ui {
10 | class DeembeddingDialog;
11 | }
12 |
13 | class OptionModel : public QAbstractListModel
14 | {
15 | Q_OBJECT
16 | public:
17 | OptionModel(Deembedding *d, QObject *parent = 0);
18 |
19 | enum {
20 | ColIndexStatus = 0,
21 | ColIndexDescription = 1,
22 | ColIndexDomain = 2,
23 | ColIndexLast,
24 | };
25 |
26 | int rowCount(const QModelIndex &parent = QModelIndex()) const override;
27 | QVariant data(const QModelIndex &index, int role) const override;
28 |
29 | void addOption(DeembeddingOption *option);
30 | void deleteRow(unsigned int row);
31 |
32 | private:
33 | Deembedding *d;
34 | };
35 |
36 | class DeembeddingDialog : public QDialog
37 | {
38 | Q_OBJECT
39 |
40 | public:
41 | explicit DeembeddingDialog(Deembedding* d, QWidget *parent = nullptr);
42 | ~DeembeddingDialog();
43 |
44 | private:
45 | Ui::DeembeddingDialog *ui;
46 | OptionModel model;
47 | };
48 |
49 | #endif // DEEMBEDDINGDIALOG_H
50 |
--------------------------------------------------------------------------------
/Software/PC_Application/VNA/Deembedding/deembeddingoption.cpp:
--------------------------------------------------------------------------------
1 | #include "deembeddingoption.h"
2 |
3 | #include "portextension.h"
4 | #include "twothru.h"
5 | #include "matchingnetwork.h"
6 |
7 | DeembeddingOption *DeembeddingOption::create(DeembeddingOption::Type type)
8 | {
9 | switch(type) {
10 | case Type::PortExtension:
11 | return new PortExtension();
12 | case Type::TwoThru:
13 | return new TwoThru();
14 | case Type::MatchingNetwork:
15 | return new MatchingNetwork();
16 | default:
17 | return nullptr;
18 | }
19 | }
20 |
21 | QString DeembeddingOption::getName(DeembeddingOption::Type type)
22 | {
23 | switch(type) {
24 | case Type::PortExtension:
25 | return "Port Extension";
26 | case Type::TwoThru:
27 | return "2xThru";
28 | case Type::MatchingNetwork:
29 | return "Matching Network";
30 | default:
31 | return "";
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Software/PC_Application/VNA/Deembedding/deembeddingoption.h:
--------------------------------------------------------------------------------
1 | #ifndef DEEMBEDDINGOPTION_H
2 | #define DEEMBEDDINGOPTION_H
3 |
4 | #include
5 | #include "savable.h"
6 | #include "Device/device.h"
7 |
8 | class DeembeddingOption : public QObject, public Savable
9 | {
10 | Q_OBJECT
11 | public:
12 | enum class Type {
13 | PortExtension,
14 | TwoThru,
15 | MatchingNetwork,
16 | // Add new deembedding options here, do not explicitly assign values and keep the Last entry at the last position
17 | Last,
18 | };
19 |
20 | static DeembeddingOption *create(Type type);
21 | static QString getName(Type type);
22 |
23 | virtual void transformDatapoint(Protocol::Datapoint &p) = 0;
24 | virtual void edit(){};
25 | virtual Type getType() = 0;
26 | signals:
27 | // Deembedding option may selfdestruct if not applicable with current settings. It should emit this signal before deleting itself
28 | void deleted(DeembeddingOption *option);
29 | };
30 |
31 | #endif // DEEMBEDDING_H
32 |
--------------------------------------------------------------------------------
/Software/PC_Application/VNA/Deembedding/form.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | Form
4 |
5 |
6 |
7 | 0
8 | 0
9 | 339
10 | 238
11 |
12 |
13 |
14 | Form
15 |
16 |
17 | QWidget#Form {image: url(:/icons/parallelC.svg);}
18 | border: 1px solid red;
19 |
20 |
21 | -
22 |
23 |
24 | -
25 |
26 |
27 | Qt::Vertical
28 |
29 |
30 |
31 | 20
32 | 186
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/Software/PC_Application/VNA/Deembedding/portextension.h:
--------------------------------------------------------------------------------
1 | #ifndef PORTEXTENSION_H
2 | #define PORTEXTENSION_H
3 |
4 | #include
5 | #include "../VNA_embedded/Application/Communication/Protocol.hpp"
6 | #include
7 | #include "Calibration/calkit.h"
8 | #include
9 | #include "deembeddingoption.h"
10 |
11 | namespace Ui {
12 | class PortExtensionEditDialog;
13 | }
14 |
15 | class PortExtension : public DeembeddingOption
16 | {
17 | Q_OBJECT
18 | public:
19 | PortExtension();
20 | void transformDatapoint(Protocol::Datapoint& d) override;
21 | void setCalkit(Calkit *kit);
22 | Type getType() override {return Type::PortExtension;}
23 | nlohmann::json toJSON() override;
24 | void fromJSON(nlohmann::json j) override;
25 | public slots:
26 | void edit() override;
27 |
28 | private:
29 | void startMeasurement();
30 | class Extension {
31 | public:
32 | bool enabled;
33 | double delay;
34 | double velocityFactor;
35 | double DCloss;
36 | double loss;
37 | double frequency;
38 | };
39 | Extension port1, port2;
40 |
41 | // status variables for automatic measurements
42 | Calkit *kit;
43 | bool measuring;
44 | bool isPort1;
45 | bool isOpen;
46 | bool isIdeal;
47 | std::vector measurements;
48 | QMessageBox *msgBox;
49 | Ui::PortExtensionEditDialog *ui;
50 | };
51 |
52 | #endif // PORTEXTENSION_H
53 |
--------------------------------------------------------------------------------
/Software/PC_Application/VNA/Deembedding/twothru.h:
--------------------------------------------------------------------------------
1 | #ifndef TWOTHRU_H
2 | #define TWOTHRU_H
3 |
4 | #include "deembeddingoption.h"
5 | #include "Tools/parameters.h"
6 | #include
7 | #include
8 |
9 | namespace Ui {
10 | class TwoThruDialog;
11 | }
12 |
13 | class TwoThru : public DeembeddingOption
14 | {
15 | public:
16 | TwoThru();
17 |
18 | virtual void transformDatapoint(Protocol::Datapoint &p) override;
19 | virtual void edit() override;
20 | virtual Type getType() override {return DeembeddingOption::Type::TwoThru;}
21 | nlohmann::json toJSON() override;
22 | void fromJSON(nlohmann::json j) override;
23 |
24 | private slots:
25 | void startMeasurement();
26 | void updateLabel();
27 | private:
28 | using Point = struct {
29 | double freq;
30 | Tparam inverseP1, inverseP2;
31 | };
32 | std::vector measurements;
33 | std::vector points;
34 | bool measuring;
35 | QMessageBox *msgBox;
36 | Ui::TwoThruDialog *ui;
37 | };
38 |
39 | #endif // TWOTHRU_H
40 |
--------------------------------------------------------------------------------
/Software/PC_Application/VNA/Deembedding/twothrudialog.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | TwoThruDialog
4 |
5 |
6 | Qt::NonModal
7 |
8 |
9 |
10 | 0
11 | 0
12 | 233
13 | 103
14 |
15 |
16 |
17 | 2xThru
18 |
19 |
20 | true
21 |
22 |
23 | -
24 |
25 |
26 |
27 |
28 |
29 |
30 | -
31 |
32 |
33 | Measure
34 |
35 |
36 |
37 | -
38 |
39 |
40 | Qt::Vertical
41 |
42 |
43 |
44 | 20
45 | 40
46 |
47 |
48 |
49 |
50 | -
51 |
52 |
53 | QDialogButtonBox::Ok
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/Software/PC_Application/VNA/portextensiondialog.h:
--------------------------------------------------------------------------------
1 | #ifndef PORTEXTENSIONDIALOG_H
2 | #define PORTEXTENSIONDIALOG_H
3 |
4 | #include
5 |
6 | namespace Ui {
7 | class PortExtensionDialog;
8 | }
9 |
10 | class PortExtensionDialog : public QDialog
11 | {
12 | Q_OBJECT
13 |
14 | public:
15 | explicit PortExtensionDialog(QWidget *parent = nullptr);
16 | ~PortExtensionDialog();
17 |
18 | private slots:
19 | void on_buttonBox_accepted();
20 |
21 | private:
22 | Ui::PortExtensionDialog *ui;
23 | };
24 |
25 | #endif // PORTEXTENSIONDIALOG_H
26 |
--------------------------------------------------------------------------------
/Software/PC_Application/VNA/tracewidgetvna.h:
--------------------------------------------------------------------------------
1 | #ifndef TRACEWIDGETVNA_H
2 | #define TRACEWIDGETVNA_H
3 |
4 | #include "Traces/tracewidget.h"
5 |
6 | class TraceWidgetVNA : public TraceWidget
7 | {
8 | public:
9 | TraceWidgetVNA(TraceModel &model, QWidget *parent = nullptr);
10 | protected slots:
11 | virtual void exportDialog() override {};
12 | virtual void importDialog() override;
13 |
14 | protected:
15 | virtual Trace::LiveParameter defaultParameter() override {return Trace::LiveParameter::S11;};
16 | };
17 |
18 | #endif // TRACEWIDGETVNA_H
19 |
--------------------------------------------------------------------------------
/Software/PC_Application/appwindow.h:
--------------------------------------------------------------------------------
1 | #ifndef APPWINDOW_H
2 | #define APPWINDOW_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include "Device/device.h"
10 | #include "Traces/traceplot.h"
11 | #include "Calibration/calibration.h"
12 | #include
13 | #include "Traces/tracemodel.h"
14 | #include "Traces/tracemarkermodel.h"
15 | #include "averaging.h"
16 | #include "Device/devicelog.h"
17 | #include "preferences.h"
18 | #include
19 | #include
20 | #include
21 |
22 | namespace Ui {
23 | class MainWindow;
24 | }
25 |
26 | class VNA;
27 | class Generator;
28 | class SpectrumAnalyzer;
29 |
30 | class AppWindow : public QMainWindow
31 | {
32 | Q_OBJECT
33 | public:
34 | AppWindow(QWidget *parent = nullptr);
35 | ~AppWindow();
36 |
37 | Ui::MainWindow *getUi() const;
38 | QStackedWidget *getCentral() const;
39 | Device *getDevice() const;
40 |
41 | protected:
42 | void closeEvent(QCloseEvent *event) override;
43 | private slots:
44 | void ConnectToDevice(QString serial = QString());
45 | void DisconnectDevice();
46 | int UpdateDeviceList();
47 | void StartManualControl();
48 | void UpdateReference();
49 | void StartFirmwareUpdateDialog();
50 | void DeviceNeedsUpdate(int reported, int expected);
51 | void SourceCalibrationDialog();
52 | void ReceiverCalibrationDialog();
53 | nlohmann::json SaveSetup();
54 | void LoadSetup(nlohmann::json j);
55 | private:
56 | void DeviceConnectionLost();
57 | void CreateToolbars();
58 |
59 | QStackedWidget *central;
60 |
61 | struct {
62 | struct {
63 | QComboBox *type;
64 | QComboBox *outFreq;
65 | } reference;
66 | } toolbars;
67 |
68 | Device *device;
69 | DeviceLog deviceLog;
70 | QString deviceSerial;
71 | QActionGroup *deviceActionGroup;
72 |
73 | // Modes
74 | VNA *vna;
75 | Generator *generator;
76 | SpectrumAnalyzer *spectrumAnalyzer;
77 |
78 | // Status bar widgets
79 | QLabel lConnectionStatus;
80 | QLabel lDeviceInfo;
81 |
82 | Ui::MainWindow *ui;
83 | };
84 |
85 | #endif // VNA_H
86 |
--------------------------------------------------------------------------------
/Software/PC_Application/averaging.h:
--------------------------------------------------------------------------------
1 | #ifndef AVERAGING_H
2 | #define AVERAGING_H
3 |
4 |
5 | #include "Device/device.h"
6 | #include
7 | #include
8 |
9 | class Averaging
10 | {
11 | public:
12 | Averaging();
13 | void reset(unsigned int points);
14 | void setAverages(unsigned int a);
15 | Protocol::Datapoint process(Protocol::Datapoint d);
16 | Protocol::SpectrumAnalyzerResult process(Protocol::SpectrumAnalyzerResult d);
17 | // Returns the number of averaged sweeps. Value is incremented whenever the last point of the sweep is added.
18 | // Returned values are in range 0 to averages
19 | unsigned int getLevel();
20 | // Returns the number of the currently active sweep. Value is incremented whenever the the first point of the sweep is added
21 | // Returned values are in range 0 (when no data has been added yet) to averages
22 | unsigned int currentSweep();
23 | private:
24 | std::vector, 4>>> avg;
25 | int maxPoints;
26 | unsigned int averages;
27 | };
28 |
29 | #endif // AVERAGING_H
30 |
--------------------------------------------------------------------------------
/Software/PC_Application/csv.h:
--------------------------------------------------------------------------------
1 | #ifndef CSV_H
2 | #define CSV_H
3 |
4 | #include
5 | #include
6 |
7 | class CSV
8 | {
9 | public:
10 | CSV();
11 |
12 | static CSV fromFile(QString filename, char sep = ',');
13 |
14 | void toFile(QString filename, char sep = ',');
15 | std::vector getColumn(QString header);
16 | std::vector getColumn(unsigned int index);
17 | QString getHeader(unsigned int index);
18 | unsigned int columns() { return _columns.size();}
19 |
20 | void addColumn(QString name, const std::vector &data);
21 |
22 | QString getFilename() const;
23 | void setFilename(const QString &value);
24 |
25 | private:
26 | class Column {
27 | public:
28 | QString header;
29 | std::vector data;
30 | };
31 | std::vector _columns;
32 | QString filename;
33 | };
34 |
35 | #endif // CSV_H
36 |
--------------------------------------------------------------------------------
/Software/PC_Application/icons.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | icons/add.png
5 | icons/edit.png
6 | icons/invisible.svg
7 | icons/visible.svg
8 | icons/pause.svg
9 | icons/play.svg
10 | icons/plus.svg
11 | icons/close.svg
12 | icons/horizontal.svg
13 | icons/vertical.svg
14 | icons/pCsC_small.png
15 | icons/pCsL_small.png
16 | icons/pLsC_small.png
17 | icons/pLsL_small.png
18 | icons/sCpC_small.png
19 | icons/sCpL_small.png
20 | icons/sLpC_small.png
21 | icons/sLpL_small.png
22 | icons/remove.png
23 | icons/cancel.png
24 | icons/clear.png
25 | icons/export.png
26 | icons/import.png
27 | icons/ok.png
28 | icons/open.png
29 | icons/play.png
30 | icons/refresh.png
31 | icons/save.png
32 | icons/trash.png
33 | icons/zoom-fit.png
34 | icons/zoom-in.png
35 | icons/zoom-out.png
36 | icons/math_disabled.svg
37 | icons/math_enabled.svg
38 | icons/parallelC.svg
39 | icons/parallelL.svg
40 | icons/parallelR.svg
41 | icons/seriesC.svg
42 | icons/seriesL.svg
43 | icons/seriesR.svg
44 | icons/DUT.png
45 | icons/port1.png
46 | icons/port2.png
47 | icons/DUT.svg
48 | icons/port1.svg
49 | icons/port2.svg
50 |
51 |
52 |
--------------------------------------------------------------------------------
/Software/PC_Application/icons/.gitignore:
--------------------------------------------------------------------------------
1 | tex
2 |
3 |
--------------------------------------------------------------------------------
/Software/PC_Application/icons/DUT.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/DUT.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/add.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/cancel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/cancel.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/clear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/clear.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/close.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
47 |
--------------------------------------------------------------------------------
/Software/PC_Application/icons/edit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/edit.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/export.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/export.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/horizontal.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
51 |
--------------------------------------------------------------------------------
/Software/PC_Application/icons/import.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/import.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/invisible.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Software/PC_Application/icons/ok.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/ok.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/open.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/open.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/pCsC.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/pCsC.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/pCsC_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/pCsC_small.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/pCsL.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/pCsL.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/pCsL_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/pCsL_small.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/pLsC.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/pLsC.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/pLsC_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/pLsC_small.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/pLsL.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/pLsL.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/pLsL_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/pLsL_small.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/parallelC.svg:
--------------------------------------------------------------------------------
1 |
2 |
19 |
--------------------------------------------------------------------------------
/Software/PC_Application/icons/parallelR.svg:
--------------------------------------------------------------------------------
1 |
2 |
19 |
--------------------------------------------------------------------------------
/Software/PC_Application/icons/pause.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Software/PC_Application/icons/play.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/play.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/play.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Software/PC_Application/icons/plus.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/Software/PC_Application/icons/port1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/port1.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/port2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/port2.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/refresh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/refresh.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/remove.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/remove.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/sCpC.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/sCpC.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/sCpC_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/sCpC_small.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/sCpL.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/sCpL.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/sCpL_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/sCpL_small.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/sLpC.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/sLpC.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/sLpC_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/sLpC_small.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/sLpL.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/sLpL.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/sLpL_small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/sLpL_small.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/save.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/save.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/seriesC.svg:
--------------------------------------------------------------------------------
1 |
2 |
15 |
--------------------------------------------------------------------------------
/Software/PC_Application/icons/seriesL.svg:
--------------------------------------------------------------------------------
1 |
2 |
15 |
--------------------------------------------------------------------------------
/Software/PC_Application/icons/seriesR.svg:
--------------------------------------------------------------------------------
1 |
2 |
15 |
--------------------------------------------------------------------------------
/Software/PC_Application/icons/trash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/trash.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/vertical.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
50 |
--------------------------------------------------------------------------------
/Software/PC_Application/icons/visible.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Software/PC_Application/icons/zoom-fit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/zoom-fit.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/zoom-in.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/zoom-in.png
--------------------------------------------------------------------------------
/Software/PC_Application/icons/zoom-out.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/PC_Application/icons/zoom-out.png
--------------------------------------------------------------------------------
/Software/PC_Application/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include
4 | #include
5 | #include "appwindow.h"
6 |
7 | #include "Calibration/calkit.h"
8 | #include "touchstone.h"
9 |
10 | #include
11 | int main(int argc, char *argv[]) {
12 | QApplication a(argc, argv);
13 | AppWindow vna;
14 | vna.resize(1280, 800);
15 | vna.show();
16 | a.exec();
17 | return 0;
18 | }
19 |
--------------------------------------------------------------------------------
/Software/PC_Application/mode.h:
--------------------------------------------------------------------------------
1 | #ifndef MODE_H
2 | #define MODE_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include "appwindow.h"
11 | #include "savable.h"
12 |
13 | class Mode : public QObject, public Savable
14 | {
15 | public:
16 | Mode(AppWindow *window, QString name);
17 |
18 | virtual void activate(); // derived classes must call Mode::activate before doing anything
19 | virtual void deactivate(); // derived classes must call Mode::deactivate before returning
20 | virtual void shutdown(){}; // called when the application is about to exit
21 | QString getName() const;
22 | static Mode *getActiveMode();
23 |
24 | virtual void initializeDevice() = 0;
25 | virtual void deviceDisconnected(){};
26 |
27 | protected:
28 | // call once the derived class is fully initialized
29 | void finalize(QWidget *centralWidget);
30 | AppWindow *window;
31 | std::set actions;
32 | std::set toolbars;
33 | std::set docks;
34 |
35 | private:
36 | static Mode *activeMode;
37 | static QWidget *cornerWidget;
38 | static QButtonGroup *modeButtonGroup;
39 | const QString name;
40 | QWidget *central;
41 | };
42 |
43 | #endif // MODE_H
44 |
--------------------------------------------------------------------------------
/Software/PC_Application/resources.qrc:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Software/PC_Application/savable.h:
--------------------------------------------------------------------------------
1 | #ifndef SAVABLE_H
2 | #define SAVABLE_H
3 |
4 | #include "json.hpp"
5 |
6 | class Savable {
7 | public:
8 | virtual nlohmann::json toJSON() = 0;
9 | virtual void fromJSON(nlohmann::json j) = 0;
10 | };
11 |
12 | #endif // SAVABLE_H
13 |
--------------------------------------------------------------------------------
/Software/PC_Application/touchstone.h:
--------------------------------------------------------------------------------
1 | #ifndef TOUCHSTONE_H
2 | #define TOUCHSTONE_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | class Touchstone
10 | {
11 | public:
12 | enum class Unit {
13 | Hz,
14 | kHz,
15 | MHz,
16 | GHz,
17 | };
18 |
19 | enum class Format {
20 | DBAngle,
21 | MagnitudeAngle,
22 | RealImaginary,
23 | };
24 |
25 | class Datapoint {
26 | public:
27 | double frequency;
28 | std::vector> S;
29 | };
30 |
31 | Touchstone(unsigned int m_ports);
32 | void AddDatapoint(Datapoint p);
33 | void toFile(std::string filename, Unit unit = Unit::GHz, Format format = Format::RealImaginary);
34 | static Touchstone fromFile(std::string filename);
35 | double minFreq();
36 | double maxFreq();
37 | unsigned int points() { return m_datapoints.size(); };
38 | Datapoint point(int index) { return m_datapoints.at(index); };
39 | Datapoint interpolate(double frequency);
40 | // remove all paramaters except the ones regarding port1 and port2 (port cnt starts at 0)
41 | void reduceTo2Port(unsigned int port1, unsigned int port2);
42 | // remove all paramaters except the ones from port (port cnt starts at 0)
43 | void reduceTo1Port(unsigned int port);
44 | unsigned int ports() { return m_ports; }
45 | QString getFilename() const;
46 |
47 | private:
48 | unsigned int m_ports;
49 | std::vector m_datapoints;
50 | QString filename;
51 | };
52 |
53 | #endif // TOUCHSTONE_H
54 |
--------------------------------------------------------------------------------
/Software/PC_Application/unit.h:
--------------------------------------------------------------------------------
1 | #ifndef UNIT_H
2 | #define UNIT_H
3 |
4 | #include
5 |
6 | namespace Unit
7 | {
8 | double FromString(QString string, QString unit = QString(), QString prefixes = " ");
9 | // prefixed need to be in ascending order (e.g. "m kMG" is okay, whjle "MkG" does not work)
10 | QString ToString(double value, QString unit = QString(), QString prefixes = " ", int precision = 6);
11 | double SIPrefixToFactor(char prefix);
12 | };
13 |
14 | #endif // UNIT_H
15 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/.gitignore:
--------------------------------------------------------------------------------
1 | /Debug/
2 | /build/
3 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | VNA_embedded
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 |
14 |
15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
16 | full,incremental,
17 |
18 |
19 |
20 |
21 |
22 | org.eclipse.cdt.core.cnature
23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
24 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
25 | fr.ac6.mcu.ide.core.MCUProjectNature
26 | org.eclipse.cdt.core.ccnature
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Application/AmplitudeCal.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include "Flash.hpp"
5 | #include "Firmware.hpp"
6 | #include "Protocol.hpp"
7 |
8 | namespace AmplitudeCal {
9 |
10 | constexpr uint8_t maxPoints = 64;
11 | constexpr uint32_t flash_address = Firmware::maxSize; // stored directly behind firmware in flash
12 | constexpr uint32_t flash_size = 8192; // reserve two sectors for now
13 |
14 | bool Load();
15 | bool Save();
16 | void SetDefault();
17 |
18 | using Correction = struct _correction {
19 | int16_t port1;
20 | int16_t port2;
21 | };
22 |
23 | Correction SourceCorrection(uint64_t freq);
24 | Correction ReceiverCorrection(uint64_t freq);
25 | void SendSource();
26 | void SendReceiver();
27 | void AddSourcePoint(const Protocol::AmplitudeCorrectionPoint& p);
28 | void AddReceiverPoint(const Protocol::AmplitudeCorrectionPoint& p);
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Application/App.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #ifdef __cplusplus
4 | #include "Protocol.hpp"
5 |
6 | extern "C" {
7 | #endif
8 |
9 | void App_Start();
10 |
11 | #ifdef __cplusplus
12 | }
13 | #endif
14 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Application/Communication/Communication.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "stm.hpp"
4 | #include "../App.h"
5 | #include
6 | #include "USB/usb.h"
7 |
8 | static uint8_t inputBuffer[1024];
9 | uint16_t inputCnt = 0;
10 | static uint8_t outputBuffer[1024];
11 |
12 | static Communication::Callback callback = nullptr;
13 |
14 | void Communication::SetCallback(Callback cb) {
15 | callback = cb;
16 | }
17 |
18 |
19 | void Communication::Input(const uint8_t *buf, uint16_t len) {
20 | if (inputCnt + len < sizeof(inputBuffer)) {
21 | // add received data to input buffer
22 | memcpy(&inputBuffer[inputCnt], buf, len);
23 | inputCnt += len;
24 | }
25 | Protocol::PacketInfo packet;
26 | uint16_t handled_len;
27 | do {
28 | handled_len = Protocol::DecodeBuffer(inputBuffer, inputCnt, &packet);
29 | if (handled_len == inputCnt) {
30 | // complete input buffer used up, reset counter
31 | inputCnt = 0;
32 | } else {
33 | // only used part of the buffer, move up remaining bytes
34 | uint16_t remaining = inputCnt - handled_len;
35 | memmove(inputBuffer, &inputBuffer[handled_len], remaining);
36 | inputCnt = remaining;
37 | }
38 | if(packet.type != Protocol::PacketType::None) {
39 | if(callback) {
40 | callback(packet);
41 | }
42 | }
43 | } while (handled_len > 0);
44 | }
45 | #include "Hardware.hpp"
46 | bool Communication::Send(const Protocol::PacketInfo &packet) {
47 | // DEBUG1_HIGH();
48 | uint16_t len = Protocol::EncodePacket(packet, outputBuffer,
49 | sizeof(outputBuffer));
50 | // DEBUG1_LOW();
51 | return usb_transmit(outputBuffer, len);
52 | // if (hUsbDeviceFS.dev_state == USBD_STATE_CONFIGURED) {
53 | // uint16_t len = Protocol::EncodePacket(packet, outputBuffer,
54 | // sizeof(outputBuffer));
55 | // while (CDC_Transmit_FS(outputBuffer, len) != USBD_OK)
56 | // ;
57 | // return true;
58 | // } else {
59 | // // not connected, do not attempt to send
60 | // return false;
61 | // }
62 | }
63 |
64 | void communication_usb_input(const uint8_t *buf, uint16_t len) {
65 | Communication::Input(buf, len);
66 | }
67 |
68 | bool Communication::SendWithoutPayload(Protocol::PacketType type) {
69 | Protocol::PacketInfo p;
70 | p.type = type;
71 | return Send(p);
72 | }
73 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Application/Communication/Communication.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #ifdef __cplusplus
6 |
7 | #include "Protocol.hpp"
8 |
9 | namespace Communication {
10 |
11 | using Callback = void(*)(const Protocol::PacketInfo&);
12 |
13 | void SetCallback(Callback cb);
14 | void Input(const uint8_t *buf, uint16_t len);
15 | bool Send(const Protocol::PacketInfo &packet);
16 | bool SendWithoutPayload(Protocol::PacketType type);
17 |
18 | }
19 |
20 | extern "C" {
21 | #endif
22 | void communication_usb_input(const uint8_t *buf, uint16_t len);
23 | #ifdef __cplusplus
24 | }
25 | #endif
26 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Application/Drivers/Exti.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #include "stm.hpp"
6 |
7 | namespace Exti {
8 |
9 | enum class EdgeType : uint8_t {
10 | Falling,
11 | Rising,
12 | Both,
13 | };
14 |
15 | enum class Pull : uint8_t {
16 | None,
17 | Up,
18 | Down,
19 | };
20 |
21 | using Callback = void(*)(void*);
22 |
23 | void Init();
24 | bool SetCallback(GPIO_TypeDef *gpio, uint16_t pin, EdgeType edge, Pull pull, Callback cb, void *ptr = nullptr);
25 | bool ClearCallback(GPIO_TypeDef *gpio, uint16_t pin);
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Application/Drivers/FPGA/FPGA_HAL.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "stm.hpp"
4 | #include "main.h"
5 |
6 | #define FPGA_SPI hspi1
7 | #define CONFIGURATION_SPI hspi2
8 | extern SPI_HandleTypeDef FPGA_SPI, CONFIGURATION_SPI;
9 |
10 | namespace FPGAHAL {
11 |
12 | using GPIO = struct {
13 | GPIO_TypeDef *gpio;
14 | uint16_t pin;
15 | };
16 | static constexpr GPIO CS = {.gpio = FPGA_CS_GPIO_Port, .pin = FPGA_CS_Pin};
17 | static constexpr GPIO PROGRAM_B = {.gpio = FPGA_PROGRAM_B_GPIO_Port, .pin = FPGA_PROGRAM_B_Pin};
18 | static constexpr GPIO INIT_B = {.gpio = FPGA_INIT_B_GPIO_Port, .pin = FPGA_INIT_B_Pin};
19 | static constexpr GPIO DONE = {.gpio = FPGA_DONE_GPIO_Port, .pin = FPGA_DONE_Pin};
20 | static constexpr GPIO FPGA_RESET = {.gpio = FPGA_RESET_GPIO_Port, .pin = FPGA_RESET_Pin};
21 | static constexpr GPIO AUX1 = {.gpio = FPGA_AUX1_GPIO_Port, .pin = FPGA_AUX1_Pin};
22 | static constexpr GPIO AUX2 = {.gpio = FPGA_AUX2_GPIO_Port, .pin = FPGA_AUX2_Pin};
23 | static constexpr GPIO AUX3 = {.gpio = FPGA_AUX3_GPIO_Port, .pin = FPGA_AUX3_Pin};
24 | static constexpr GPIO IRQ = {.gpio = FPGA_INTR_GPIO_Port, .pin = FPGA_INTR_Pin};
25 |
26 | static inline void Low(GPIO g) {
27 | if(g.gpio) {
28 | g.gpio->BSRR = g.pin << 16;
29 | }
30 | }
31 | static inline void High(GPIO g) {
32 | if(g.gpio) {
33 | g.gpio->BSRR = g.pin;
34 | }
35 | }
36 | bool isHigh(GPIO g) {
37 | if(g.gpio) {
38 | return g.gpio->IDR & g.pin;
39 | } else {
40 | return false;
41 | }
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Application/Drivers/Flash.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Flash.hpp
3 | *
4 | * Created on: Aug 26, 2020
5 | * Author: jan
6 | */
7 |
8 | #ifndef DRIVERS_FLASH_HPP_
9 | #define DRIVERS_FLASH_HPP_
10 |
11 | #include "stm.hpp"
12 |
13 | class Flash {
14 | public:
15 | constexpr Flash(SPI_HandleTypeDef *spi, GPIO_TypeDef *CS_gpio, uint16_t CS_pin)
16 | : spi(spi),CS_gpio(CS_gpio),CS_pin(CS_pin){};
17 |
18 | bool isPresent();
19 | void read(uint32_t address, uint16_t length, void *dest);
20 | bool write(uint32_t address, uint16_t length, void *src);
21 | bool eraseChip();
22 | bool eraseSector(uint32_t address);
23 | bool erase32Block(uint32_t address);
24 | bool erase64Block(uint32_t address);
25 | bool eraseRange(uint32_t start, uint32_t len);
26 | // Starts the reading process without actually reading any bytes
27 | void initiateRead(uint32_t address);
28 | const SPI_HandleTypeDef* const getSpi() const {
29 | return spi;
30 | }
31 | static constexpr uint32_t PageSize = 256;
32 | static constexpr uint32_t SectorSize = 4096;
33 | static constexpr uint32_t Block32Size = 32768;
34 | static constexpr uint32_t Block64Size = 65536;
35 |
36 | private:
37 | void CS(bool high) {
38 | if(high) {
39 | CS_gpio->BSRR = CS_pin;
40 | } else {
41 | CS_gpio->BSRR = CS_pin << 16;
42 | }
43 | }
44 | void EnableWrite();
45 | bool WaitBusy(uint32_t timeout);
46 | SPI_HandleTypeDef * const spi;
47 | GPIO_TypeDef * const CS_gpio;
48 | const uint16_t CS_pin;
49 | };
50 |
51 |
52 | #endif /* DRIVERS_FLASH_HPP_ */
53 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Application/Drivers/Log.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #ifdef __cplusplus
4 | extern "C" {
5 | #endif
6 |
7 | //#define LOG_BLOCKING
8 |
9 | #define LOG_USART 3
10 | #define LOG_SENDBUF_LENGTH 1024
11 | //#define LOG_USE_MUTEX
12 |
13 | #define LOG_LEVEL_DEBUG 4
14 | #define LOG_LEVEL_INFO 3
15 | #define LOG_LEVEL_WARN 2
16 | #define LOG_LEVEL_ERR 1
17 | #define LOG_LEVEL_CRIT 0
18 |
19 | #define LOG_LEVEL_DEFAULT LOG_LEVEL_ERR
20 |
21 | #ifndef LOG_LEVEL
22 | #define LOG_LEVEL LOG_LEVEL_DEFAULT
23 | #endif
24 |
25 | #ifndef LOG_MODULE
26 | #define LOG_MODULE "Log"
27 | #endif
28 |
29 | #if LOG_LEVEL >= LOG_LEVEL_CRIT
30 | #define LOG_CRIT(fmt, ...) _log_write(LOG_MODULE, "CRT", fmt, ## __VA_ARGS__)
31 | #else
32 | #define LOG_CRIT(fmt, ...)
33 | #endif
34 | #if LOG_LEVEL >= LOG_LEVEL_ERR
35 | #define LOG_ERR(fmt, ...) _log_write(LOG_MODULE, "ERR", fmt, ## __VA_ARGS__)
36 | #else
37 | #define LOG_ERR(fmt, ...)
38 | #endif
39 | #if LOG_LEVEL >= LOG_LEVEL_WARN
40 | #define LOG_WARN(fmt, ...) _log_write(LOG_MODULE, "WRN", fmt, ## __VA_ARGS__)
41 | #else
42 | #define LOG_WARN(fmt, ...)
43 | #endif
44 | #if LOG_LEVEL >= LOG_LEVEL_INFO
45 | #define LOG_INFO(fmt, ...) _log_write(LOG_MODULE, "INF", fmt, ## __VA_ARGS__)
46 | #else
47 | #define LOG_INFO(fmt, ...)
48 | #endif
49 | #if LOG_LEVEL >= LOG_LEVEL_DEBUG
50 | #define LOG_DEBUG(fmt, ...) _log_write(LOG_MODULE, "DBG", fmt, ## __VA_ARGS__)
51 | #else
52 | #define LOG_DEBUG(fmt, ...)
53 | #endif
54 |
55 | #include
56 |
57 | void Log_Init();
58 | typedef void (*log_redirect_t)(const char *line, uint16_t length);
59 | void Log_SetRedirect(log_redirect_t redirect_function);
60 | void _log_write(const char *module, const char *level, const char *fmt, ...);
61 | void Log_Flush();
62 |
63 | #ifdef __cplusplus
64 | }
65 | #endif
66 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Application/Drivers/USB/usb.h:
--------------------------------------------------------------------------------
1 | /*
2 | * usb.h
3 | *
4 | * Created on: Aug 12, 2020
5 | * Author: jan
6 | */
7 |
8 | #ifndef DRIVERS_USB_USB_H_
9 | #define DRIVERS_USB_USB_H_
10 |
11 | #ifdef __cplusplus
12 | extern "C" {
13 | #endif
14 |
15 | #include
16 | #include
17 |
18 | typedef void(*usbd_recv_callback_t)(const uint8_t *buf, uint16_t len);
19 |
20 | void usb_init(usbd_recv_callback_t receive_callback);
21 | bool usb_transmit(const uint8_t *data, uint16_t length);
22 | uint16_t usb_available_buffer();
23 | void usb_log(const char *log, uint16_t length);
24 |
25 |
26 | #ifdef __cplusplus
27 | }
28 | #endif
29 |
30 | #endif /* DRIVERS_USB_USB_H_ */
31 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Application/Drivers/algorithm.cpp:
--------------------------------------------------------------------------------
1 | #include "algorithm.hpp"
2 |
3 | #include "stm.hpp"
4 | #include
5 |
6 | Algorithm::RationalApproximation Algorithm::BestRationalApproximation(float ratio, uint32_t max_denom) {
7 | RationalApproximation result;
8 | uint32_t a = 0, b = 1, c = 1, d = 1;
9 | while (b + d <= max_denom) {
10 | auto mediant = (float) (a + c) / (b + d);
11 | if (ratio == mediant) {
12 | if (b + d <= max_denom) {
13 | result.num = a + c;
14 | result.denom = b + d;
15 | return result;
16 | } else if (d > b) {
17 | result.num = c;
18 | result.denom = d;
19 | return result;
20 | } else {
21 | result.num = a;
22 | result.denom = b;
23 | return result;
24 | }
25 | } else if (ratio > mediant) {
26 | a = a + c;
27 | b = b + d;
28 | } else {
29 | c = a + c;
30 | d = b + d;
31 | }
32 | }
33 | // check which of the two is the better solution
34 | float dev_ab = (float) a / b - ratio;
35 | float dev_cd = (float) c / d - ratio;
36 | if(fabs(dev_cd) < fabs(dev_ab)) {
37 | result.num = c;
38 | result.denom = d;
39 | } else {
40 | result.num = a;
41 | result.denom = b;
42 | }
43 | return result;
44 | }
45 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Application/Drivers/algorithm.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace Algorithm {
6 |
7 | using RationalApproximation = struct _rationalapproximation {
8 | uint32_t num;
9 | uint32_t denom;
10 | };
11 |
12 | RationalApproximation BestRationalApproximation(float ratio, uint32_t max_denom);
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Application/Drivers/delay.cpp:
--------------------------------------------------------------------------------
1 | #include "delay.hpp"
2 |
3 | #include "stm.hpp"
4 |
5 | void Delay::ms(uint32_t t) {
6 | while(t--) {
7 | us(1000);
8 | }
9 | }
10 | void Delay::us(uint32_t t) {
11 | TIM1->CNT = 0;
12 | TIM1->CR1 |= TIM_CR1_CEN;
13 | while (TIM1->CNT < t)
14 | ;
15 | TIM1->CR1 &= ~TIM_CR1_CEN;
16 | }
17 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Application/Drivers/delay.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace Delay {
6 |
7 | void ms(uint32_t t);
8 | void us(uint32_t t);
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Application/Drivers/max2871.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "stm.hpp"
4 |
5 | class MAX2871 {
6 | public:
7 | constexpr MAX2871(SPI_HandleTypeDef *hspi, GPIO_TypeDef *LE = nullptr,
8 | uint16_t LEpin = 0, GPIO_TypeDef *RF_EN = nullptr,
9 | uint16_t RF_ENpin = 0, GPIO_TypeDef *LD = nullptr, uint16_t LDpin = 0,
10 | GPIO_TypeDef *CE = nullptr, uint16_t CEpin = 0,
11 | GPIO_TypeDef *MUX = nullptr, uint16_t MUXpin = 0) :
12 | regs(), f_PFD(0),
13 | hspi(hspi),
14 | CE(CE), CEpin(CEpin),
15 | LE(LE), LEpin(LEpin),
16 | MUX(MUX), MUXpin(MUXpin),
17 | RF_EN(RF_EN), RF_ENpin(RF_ENpin),
18 | LD(LD), LDpin(LDpin),
19 | outputFrequency(0),
20 | VCOmax(),
21 | gotVCOMap(false)
22 | {};
23 |
24 | bool Init();
25 | bool Init(uint32_t f_ref, bool doubler, uint16_t r, bool div2);
26 | bool SetReference(uint32_t f_ref, bool doubler, uint16_t r, bool div2);
27 | void ChipEnable(bool on);
28 | void RFEnable(bool on);
29 | bool Locked();
30 | enum class Power : uint8_t {
31 | n4dbm = 0x00,
32 | n1dbm = 0x01,
33 | p2dbm = 0x02,
34 | p5dbm = 0x03,
35 | };
36 | void SetPowerOutA(Power p, bool enabled = true);
37 | void SetPowerOutB(Power p, bool enabled = true);
38 | enum class Mode : uint8_t {
39 | LowNoise = 0x00,
40 | LowSpur1 = 0x02,
41 | LowSpur2 = 0x03,
42 | };
43 | void SetMode(Mode m);
44 | enum class CPMode : uint8_t {
45 | Disabled = 0x00,
46 | CP10 = 0x01,
47 | CP20 = 0x02,
48 | CP30 = 0x03,
49 | };
50 | void SetCPMode(CPMode m);
51 | void SetCPCurrent(uint8_t mA);
52 | bool SetFrequency(uint64_t f);
53 | void Update();
54 | void UpdateFrequency();
55 | bool BuildVCOMap();
56 | uint8_t GetTemp();
57 | uint32_t* GetRegisters() {
58 | return regs;
59 | }
60 | uint64_t GetActualFrequency() {
61 | return outputFrequency;
62 | }
63 | private:
64 | static constexpr uint64_t MaxFreq = 6100000000; // 6GHz according to datasheet, but slight overclocking is possible
65 |
66 | uint32_t Read();
67 | void Write(uint8_t reg, uint32_t val);
68 | uint32_t regs[6];
69 | uint32_t f_PFD;
70 | SPI_HandleTypeDef *hspi;
71 | GPIO_TypeDef *CE;
72 | uint16_t CEpin;
73 | GPIO_TypeDef *LE;
74 | uint16_t LEpin;
75 | GPIO_TypeDef *MUX;
76 | uint16_t MUXpin;
77 | GPIO_TypeDef *RF_EN;
78 | uint16_t RF_ENpin;
79 | GPIO_TypeDef *LD;
80 | uint16_t LDpin;
81 | uint64_t outputFrequency;
82 | uint16_t VCOmax[64];
83 | bool gotVCOMap;
84 | };
85 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Application/Drivers/stm.cpp:
--------------------------------------------------------------------------------
1 | #include "stm.hpp"
2 |
3 | using Callback = void(*)(void);
4 | static constexpr uint8_t numCallbacks = 10;
5 | static Callback callbacks[numCallbacks];
6 | uint8_t read_index, write_index;
7 |
8 | static void increment(uint8_t &index) {
9 | if(index < numCallbacks - 1) {
10 | index++;
11 | } else {
12 | index = 0;
13 | }
14 | }
15 | static uint8_t callbackFifoLevel() {
16 | int8_t level = (int8_t) write_index - (int8_t) read_index;
17 | if(level < 0) {
18 | level += numCallbacks;
19 | }
20 | return (uint8_t) level;
21 | }
22 |
23 | void STM::Init() {
24 | read_index = write_index = 0;
25 | HAL_NVIC_SetPriority(COMP4_IRQn, 6, 0);
26 | HAL_NVIC_EnableIRQ(COMP4_IRQn);
27 | }
28 |
29 | bool STM::DispatchToInterrupt(void (*cb)(void)) {
30 | if(callbackFifoLevel() < numCallbacks - 1) {
31 | callbacks[write_index] = cb;
32 | increment(write_index);
33 | HAL_NVIC_SetPendingIRQ(COMP4_IRQn);
34 | return true;
35 | } else {
36 | // already at limit
37 | return false;
38 | }
39 | }
40 |
41 | extern "C" {
42 | void COMP4_IRQHandler() {
43 | while(callbackFifoLevel() > 0) {
44 | if (callbacks[read_index]) {
45 | callbacks[read_index]();
46 | }
47 | increment(read_index);
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Application/Drivers/stm.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "stm32g431xx.h"
4 | #include "stm32g4xx_hal.h"
5 |
6 | extern ADC_HandleTypeDef hadc1;
7 |
8 | namespace STM {
9 |
10 | void Init();
11 | // No FreeRTOS function calls are allowed from interrupts with higher priorities than 5.
12 | // Certain parts of the data acquisition need higher priorities (so they don't get interrupted by FreeRTOS)
13 | // but they also need to trigger FreeRTOS functions. This can be achieved by dispatching a function-pointer
14 | // to a lower priority interrupt. The passed function can then handle the FreeRTOS function call
15 | bool DispatchToInterrupt(void (*cb)(void));
16 |
17 | static inline bool InInterrupt() {
18 | return (SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) != 0;
19 | }
20 |
21 | static inline int8_t getTemperature() {
22 | HAL_ADC_Start(&hadc1);
23 | HAL_ADC_PollForConversion(&hadc1, 100);
24 | int16_t adc = HAL_ADC_GetValue(&hadc1);
25 | int16_t rangeFrom = *TEMPSENSOR_CAL2_ADDR - *TEMPSENSOR_CAL1_ADDR;
26 | int16_t rangeTo = TEMPSENSOR_CAL2_TEMP - TEMPSENSOR_CAL1_TEMP;
27 | adc -= *TEMPSENSOR_CAL1_ADDR;
28 | int16_t result = ((int32_t) adc * rangeTo) / rangeFrom + TEMPSENSOR_CAL1_TEMP;
29 | if(result < -128) {
30 | result = -128;
31 | } else if(result > 127) {
32 | result = 127;
33 | }
34 | return result;
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Application/Firmware.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Firmware.hpp
3 | *
4 | * Created on: Aug 26, 2020
5 | * Author: jan
6 | */
7 |
8 | #ifndef COMMUNICATION_FIRMWARE_HPP_
9 | #define COMMUNICATION_FIRMWARE_HPP_
10 |
11 | #include "Flash.hpp"
12 |
13 | namespace Firmware {
14 |
15 | static constexpr uint32_t maxSize = 1048576;
16 |
17 | using Info = struct info {
18 | uint32_t FPGA_bitstream_address;
19 | uint32_t FPGA_bitstream_size;
20 | uint32_t CPU_image_address;
21 | uint32_t CPU_image_size;
22 | bool valid;
23 | bool CPU_need_update;
24 | };
25 |
26 | Info GetFlashContentInfo();
27 | void PerformUpdate(Info info);
28 |
29 | }
30 |
31 |
32 | #endif /* COMMUNICATION_FIRMWARE_HPP_ */
33 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Application/Generator.cpp:
--------------------------------------------------------------------------------
1 | #include "Generator.hpp"
2 | #include "Manual.hpp"
3 | #include "Hardware.hpp"
4 | #include "max2871.hpp"
5 | #include "Si5351C.hpp"
6 | #include "AmplitudeCal.hpp"
7 |
8 | void Generator::Setup(Protocol::GeneratorSettings g) {
9 | if(g.activePort == 0) {
10 | // both ports disabled, no need to configure PLLs
11 | HW::SetIdle();
12 | return;
13 | }
14 | Protocol::ManualControl m;
15 | // LOs not required
16 | m.LO1CE = 0;
17 | m.LO1Frequency = 1000000000;
18 | m.LO1RFEN = 0;
19 | m.LO1RFEN = 0;
20 | m.LO2EN = 0;
21 | m.LO2Frequency = 60000000;
22 | m.Port1EN = 0;
23 | m.Port2EN = 0;
24 | m.RefEN = 0;
25 | m.Samples = 131072;
26 | m.WindowType = (int) FPGA::Window::None;
27 |
28 | switch(g.activePort) {
29 | case 1:
30 | m.AmplifierEN = 1;
31 | m.PortSwitch = 0;
32 | break;
33 | case 2:
34 | m.AmplifierEN = 1;
35 | m.PortSwitch = 1;
36 | break;
37 | }
38 | if (g.applyAmplitudeCorrection) {
39 | auto correction = AmplitudeCal::SourceCorrection(g.frequency);
40 | if (g.activePort == 1) {
41 | g.cdbm_level += correction.port1;
42 | } else {
43 | g.cdbm_level += correction.port2;
44 | }
45 | }
46 | auto amplitude = HW::GetAmplitudeSettings(g.cdbm_level, g.frequency, g.applyAmplitudeCorrection, g.activePort == 2);
47 | // Select correct source
48 | if(g.frequency < HW::BandSwitchFrequency) {
49 | m.SourceLowEN = 1;
50 | m.SourceLowFrequency = g.frequency;
51 | m.SourceHighCE = 0;
52 | m.SourceHighRFEN = 0;
53 | m.SourceHighFrequency = HW::BandSwitchFrequency;
54 | m.SourceHighLowpass = (int) FPGA::LowpassFilter::M947;
55 | m.SourceHighPower = (int) MAX2871::Power::n4dbm;
56 | m.SourceHighband = false;
57 | m.SourceLowPower = (int) amplitude.lowBandPower;
58 | m.SourceHighPower = (int) MAX2871::Power::n4dbm;
59 | } else {
60 | m.SourceLowEN = 0;
61 | m.SourceLowFrequency = HW::BandSwitchFrequency;
62 | m.SourceHighCE = 1;
63 | m.SourceHighRFEN = 1;
64 | m.SourceHighFrequency = g.frequency;
65 | if(g.frequency < 900000000UL) {
66 | m.SourceHighLowpass = (int) FPGA::LowpassFilter::M947;
67 | } else if(g.frequency < 1800000000UL) {
68 | m.SourceHighLowpass = (int) FPGA::LowpassFilter::M1880;
69 | } else if(g.frequency < 3500000000UL) {
70 | m.SourceHighLowpass = (int) FPGA::LowpassFilter::M3500;
71 | } else {
72 | m.SourceHighLowpass = (int) FPGA::LowpassFilter::None;
73 | }
74 | m.SourceHighband = true;
75 | m.SourceHighPower = (int) amplitude.highBandPower;
76 | m.SourceLowPower = (int) MAX2871::Power::n4dbm;
77 | }
78 |
79 | m.attenuator = amplitude.attenuator;
80 | Manual::Setup(m);
81 | }
82 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Application/Generator.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "Protocol.hpp"
4 |
5 | namespace Generator {
6 |
7 | // Generator is using the manual mode with some encapsulation for setting up. No further functions required
8 | void Setup(Protocol::GeneratorSettings g);
9 |
10 | }
11 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Application/HW_HAL.cpp:
--------------------------------------------------------------------------------
1 | #include "HW_HAL.hpp"
2 |
3 | Si5351C HWHAL::Si5351 = Si5351C(&hi2c2, 26000000);
4 | MAX2871 HWHAL::Source = MAX2871(&hspi1, FPGA_CS_GPIO_Port, FPGA_CS_Pin, nullptr, 0, nullptr, 0, nullptr, 0, GPIOA, GPIO_PIN_6);
5 | MAX2871 HWHAL::LO1 = MAX2871(&hspi1, FPGA_CS_GPIO_Port, FPGA_CS_Pin, nullptr, 0, nullptr, 0, nullptr, 0, GPIOA, GPIO_PIN_6);
6 | extern SPI_HandleTypeDef hspi1;
7 | Flash HWHAL::flash = Flash(&hspi1, FLASH_CS_GPIO_Port, FLASH_CS_Pin);
8 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Application/HW_HAL.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "stm.hpp"
4 | #include "Si5351C.hpp"
5 | #include "max2871.hpp"
6 | #include "main.h"
7 | #include "Flash.hpp"
8 |
9 | extern I2C_HandleTypeDef hi2c2;
10 | extern SPI_HandleTypeDef hspi1;
11 |
12 | namespace HWHAL {
13 |
14 | extern Si5351C Si5351;
15 | extern MAX2871 Source;
16 | extern MAX2871 LO1;
17 | extern Flash flash;
18 |
19 | // Mapping of the Si5351 channels to PLLs/Mixers
20 | namespace SiChannel {
21 | enum {
22 | Source = 3,
23 | LO1 = 5,
24 | Port2LO2 = 4,
25 | RefLO2 = 1,
26 | Port1LO2 = 2,
27 | LowbandSource = 0,
28 | ReferenceOut = 6,
29 | FPGA = 7,
30 | };
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Application/Led.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | namespace LED {
6 |
7 | void Init();
8 | void Pulsating();
9 | void Off();
10 | void Error(uint8_t code);
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Application/Manual.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "FPGA/FPGA.hpp"
4 | #include "Protocol.hpp"
5 |
6 | namespace Manual {
7 |
8 | void Setup(Protocol::ManualControl m);
9 | bool MeasurementDone(const FPGA::SamplingResult &result);
10 | void Work();
11 | void Stop();
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Application/SpectrumAnalyzer.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "Protocol.hpp"
4 | #include "FPGA/FPGA.hpp"
5 |
6 | namespace SA {
7 |
8 | enum class Detector {
9 | PosPeak = 0x00,
10 | NegPeak = 0x01,
11 | Sample = 0x02,
12 | Normal = 0x03,
13 | Average = 0x04,
14 | };
15 |
16 | void Setup(Protocol::SpectrumAnalyzerSettings settings);
17 | bool MeasurementDone(const FPGA::SamplingResult &result);
18 | void Work();
19 | void Stop();
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Application/Util.cpp:
--------------------------------------------------------------------------------
1 | #include "Util.hpp"
2 |
3 | uint32_t Util::Alias(int64_t f, uint32_t f_s) {
4 | // move into f_s range
5 | f %= f_s;
6 | if (f < 0) {
7 | f += f_s;
8 | }
9 | // fold at half the samplerate
10 | if(f >= f_s / 2) {
11 | f = f_s - f;
12 | }
13 | return f;
14 | }
15 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Application/Util.hpp:
--------------------------------------------------------------------------------
1 | #ifndef UTIL_HPP_
2 | #define UTIL_HPP_
3 |
4 | #include
5 |
6 | namespace Util {
7 | /*
8 | * Returns the frequency f appears to be when sampled with f_s
9 | */
10 | uint32_t Alias(int64_t f, uint32_t f_s);
11 |
12 | }
13 |
14 | #endif
15 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Application/VNA.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include "Protocol.hpp"
5 | #include "FPGA/FPGA.hpp"
6 |
7 | namespace VNA {
8 |
9 | bool Setup(Protocol::SweepSettings s);
10 | bool MeasurementDone(const FPGA::SamplingResult &result);
11 | void Work();
12 | void SweepHalted();
13 | void Stop();
14 |
15 | }
16 |
17 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Drivers/CMSIS/Device/ST/STM32G4xx/Include/stm32g431xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/VNA_embedded/Drivers/CMSIS/Device/ST/STM32G4xx/Include/stm32g431xx.h
--------------------------------------------------------------------------------
/Software/VNA_embedded/Drivers/CMSIS/Device/ST/STM32G4xx/Include/stm32g4xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/VNA_embedded/Drivers/CMSIS/Device/ST/STM32G4xx/Include/stm32g4xx.h
--------------------------------------------------------------------------------
/Software/VNA_embedded/Drivers/CMSIS/Include/cmsis_version.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | * @file cmsis_version.h
3 | * @brief CMSIS Core(M) Version definitions
4 | * @version V5.0.2
5 | * @date 19. April 2017
6 | ******************************************************************************/
7 | /*
8 | * Copyright (c) 2009-2017 ARM Limited. All rights reserved.
9 | *
10 | * SPDX-License-Identifier: Apache-2.0
11 | *
12 | * Licensed under the Apache License, Version 2.0 (the License); you may
13 | * not use this file except in compliance with the License.
14 | * You may obtain a copy of the License at
15 | *
16 | * www.apache.org/licenses/LICENSE-2.0
17 | *
18 | * Unless required by applicable law or agreed to in writing, software
19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 | * See the License for the specific language governing permissions and
22 | * limitations under the License.
23 | */
24 |
25 | #if defined ( __ICCARM__ )
26 | #pragma system_include /* treat file as system include file for MISRA check */
27 | #elif defined (__clang__)
28 | #pragma clang system_header /* treat file as system include file */
29 | #endif
30 |
31 | #ifndef __CMSIS_VERSION_H
32 | #define __CMSIS_VERSION_H
33 |
34 | /* CMSIS Version definitions */
35 | #define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */
36 | #define __CM_CMSIS_VERSION_SUB ( 1U) /*!< [15:0] CMSIS Core(M) sub version */
37 | #define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \
38 | __CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */
39 | #endif
40 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Drivers/STM32G4xx_HAL_Driver/Inc/stm32g4xx_hal_flash_ramfunc.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_hal_flash_ramfunc.h
4 | * @author MCD Application Team
5 | * @brief Header file of FLASH RAMFUNC driver.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © COPYRIGHT(c) 2017 STMicroelectronics
10 | *
11 | * This software component is licensed by ST under BSD 3-Clause license,
12 | * the "License"; You may not use this file except in compliance with the
13 | * License. You may obtain a copy of the License at:
14 | * opensource.org/licenses/BSD-3-Clause
15 | *
16 | ******************************************************************************
17 | */
18 |
19 | /* Define to prevent recursive inclusion -------------------------------------*/
20 | #ifndef STM32G4xx_FLASH_RAMFUNC_H
21 | #define STM32G4xx_FLASH_RAMFUNC_H
22 |
23 | #ifdef __cplusplus
24 | extern "C" {
25 | #endif
26 |
27 | /* Includes ------------------------------------------------------------------*/
28 | #include "stm32g4xx_hal_def.h"
29 |
30 | /** @addtogroup STM32G4xx_HAL_Driver
31 | * @{
32 | */
33 |
34 | /** @addtogroup FLASH_RAMFUNC
35 | * @{
36 | */
37 |
38 | /* Exported types ------------------------------------------------------------*/
39 | /* Exported macro ------------------------------------------------------------*/
40 | /* Exported functions --------------------------------------------------------*/
41 | /** @addtogroup FLASH_RAMFUNC_Exported_Functions
42 | * @{
43 | */
44 |
45 | /** @addtogroup FLASH_RAMFUNC_Exported_Functions_Group1
46 | * @{
47 | */
48 | /* Peripheral Control functions ************************************************/
49 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_EnableRunPowerDown(void);
50 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_DisableRunPowerDown(void);
51 | #if defined (FLASH_OPTR_DBANK)
52 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_OB_DBankConfig(uint32_t DBankConfig);
53 | #endif
54 | /**
55 | * @}
56 | */
57 |
58 | /**
59 | * @}
60 | */
61 |
62 | /**
63 | * @}
64 | */
65 |
66 | /**
67 | * @}
68 | */
69 |
70 | #ifdef __cplusplus
71 | }
72 | #endif
73 |
74 | #endif /* STM32G4xx_FLASH_RAMFUNC_H */
75 |
76 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
77 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Drivers/STM32G4xx_HAL_Driver/Inc/stm32g4xx_hal_spi_ex.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32g4xx_hal_spi_ex.h
4 | * @author MCD Application Team
5 | * @brief Header file of SPI HAL Extended module.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2017 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 |
20 | /* Define to prevent recursive inclusion -------------------------------------*/
21 | #ifndef STM32G4xx_HAL_SPI_EX_H
22 | #define STM32G4xx_HAL_SPI_EX_H
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "stm32g4xx_hal_def.h"
30 |
31 | /** @addtogroup STM32G4xx_HAL_Driver
32 | * @{
33 | */
34 |
35 | /** @addtogroup SPIEx
36 | * @{
37 | */
38 |
39 | /* Exported types ------------------------------------------------------------*/
40 | /* Exported constants --------------------------------------------------------*/
41 | /* Exported macros -----------------------------------------------------------*/
42 | /* Exported functions --------------------------------------------------------*/
43 | /** @addtogroup SPIEx_Exported_Functions
44 | * @{
45 | */
46 |
47 | /* Initialization and de-initialization functions ****************************/
48 | /* IO operation functions *****************************************************/
49 | /** @addtogroup SPIEx_Exported_Functions_Group1
50 | * @{
51 | */
52 | HAL_StatusTypeDef HAL_SPIEx_FlushRxFifo(SPI_HandleTypeDef *hspi);
53 | /**
54 | * @}
55 | */
56 |
57 | /**
58 | * @}
59 | */
60 |
61 | /**
62 | * @}
63 | */
64 |
65 | /**
66 | * @}
67 | */
68 |
69 | #ifdef __cplusplus
70 | }
71 | #endif
72 |
73 | #endif /* STM32G4xx_HAL_SPI_EX_H */
74 |
75 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
76 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Inc/stm32_assert.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32_assert.h
4 | * @brief STM32 assert file.
5 | ******************************************************************************
6 | * @attention
7 | *
8 | * © Copyright (c) 2020 STMicroelectronics.
9 | * All rights reserved.
10 | *
11 | * This software component is licensed by ST under Ultimate Liberty license
12 | * SLA0044, the "License"; You may not use this file except in compliance with
13 | * the License. You may obtain a copy of the License at:
14 | * www.st.com/SLA0044
15 | *
16 | ******************************************************************************
17 | */
18 |
19 | /* Define to prevent recursive inclusion -------------------------------------*/
20 | #ifndef __STM32_ASSERT_H
21 | #define __STM32_ASSERT_H
22 |
23 | #ifdef __cplusplus
24 | extern "C" {
25 | #endif
26 |
27 | /* Exported types ------------------------------------------------------------*/
28 | /* Exported constants --------------------------------------------------------*/
29 | /* Includes ------------------------------------------------------------------*/
30 | /* Exported macro ------------------------------------------------------------*/
31 | #ifdef USE_FULL_ASSERT
32 | /**
33 | * @brief The assert_param macro is used for function's parameters check.
34 | * @param expr: If expr is false, it calls assert_failed function
35 | * which reports the name of the source file and the source
36 | * line number of the call that failed.
37 | * If expr is true, it returns no value.
38 | * @retval None
39 | */
40 | #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
41 | /* Exported functions ------------------------------------------------------- */
42 | void assert_failed(uint8_t* file, uint32_t line);
43 | #else
44 | #define assert_param(expr) ((void)0U)
45 | #endif /* USE_FULL_ASSERT */
46 |
47 | #ifdef __cplusplus
48 | }
49 | #endif
50 |
51 | #endif /* __STM32_ASSERT_H */
52 |
53 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
54 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Inc/stm32g4xx_it.h:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file stm32g4xx_it.h
5 | * @brief This file contains the headers of the interrupt handlers.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2020 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under Ultimate Liberty license
13 | * SLA0044, the "License"; You may not use this file except in compliance with
14 | * the License. You may obtain a copy of the License at:
15 | * www.st.com/SLA0044
16 | *
17 | ******************************************************************************
18 | */
19 | /* USER CODE END Header */
20 |
21 | /* Define to prevent recursive inclusion -------------------------------------*/
22 | #ifndef __STM32G4xx_IT_H
23 | #define __STM32G4xx_IT_H
24 |
25 | #ifdef __cplusplus
26 | extern "C" {
27 | #endif
28 |
29 | /* Private includes ----------------------------------------------------------*/
30 | /* USER CODE BEGIN Includes */
31 |
32 | /* USER CODE END Includes */
33 |
34 | /* Exported types ------------------------------------------------------------*/
35 | /* USER CODE BEGIN ET */
36 |
37 | /* USER CODE END ET */
38 |
39 | /* Exported constants --------------------------------------------------------*/
40 | /* USER CODE BEGIN EC */
41 |
42 | /* USER CODE END EC */
43 |
44 | /* Exported macro ------------------------------------------------------------*/
45 | /* USER CODE BEGIN EM */
46 |
47 | /* USER CODE END EM */
48 |
49 | /* Exported functions prototypes ---------------------------------------------*/
50 | void NMI_Handler(void);
51 | void HardFault_Handler(void);
52 | void MemManage_Handler(void);
53 | void BusFault_Handler(void);
54 | void UsageFault_Handler(void);
55 | void DebugMon_Handler(void);
56 | void DMA1_Channel1_IRQHandler(void);
57 | void DMA1_Channel2_IRQHandler(void);
58 | void DMA1_Channel3_IRQHandler(void);
59 | void DMA1_Channel4_IRQHandler(void);
60 | void TIM1_TRG_COM_TIM17_IRQHandler(void);
61 | void UCPD1_IRQHandler(void);
62 | /* USER CODE BEGIN EFP */
63 |
64 | /* USER CODE END EFP */
65 |
66 | #ifdef __cplusplus
67 | }
68 | #endif
69 |
70 | #endif /* __STM32G4xx_IT_H */
71 |
72 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
73 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Inc/usbpd.h:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file usbpd.h
5 | * @author MCD Application Team
6 | * @brief This file contains the device define.
7 | ******************************************************************************
8 | * @attention
9 | *
10 | * © Copyright (c) 2020 STMicroelectronics.
11 | * All rights reserved.
12 | *
13 | * This software component is licensed by ST under Ultimate Liberty license
14 | * SLA0044, the "License"; You may not use this file except in compliance with
15 | * the License. You may obtain a copy of the License at:
16 | * www.st.com/SLA0044
17 | *
18 | ******************************************************************************
19 | */
20 | /* USER CODE END Header */
21 |
22 | /* Define to prevent recursive inclusion -------------------------------------*/
23 | #ifndef __usbpd_H
24 | #define __usbpd_H
25 | #ifdef __cplusplus
26 | extern "C" {
27 | #endif
28 |
29 | /* Includes ------------------------------------------------------------------*/
30 | #include "usbpd_core.h"
31 | #include "usbpd_dpm_core.h"
32 | #include "usbpd_dpm_user.h"
33 | #include "usbpd_hw_if.h"
34 |
35 | /* USER CODE BEGIN 0 */
36 | /* USER CODE END 0 */
37 |
38 | /* Global variables ---------------------------------------------------------*/
39 |
40 | /* USER CODE BEGIN 1 */
41 | /* USER CODE END 1 */
42 |
43 | /* USBPD init function */
44 | void MX_USBPD_Init(void);
45 |
46 | /* USER CODE BEGIN 2 */
47 | /* USER CODE END 2 */
48 |
49 | #ifdef __cplusplus
50 | }
51 | #endif
52 | #endif /*__usbpd_H */
53 |
54 | /**
55 | * @}
56 | */
57 |
58 | /**
59 | * @}
60 | */
61 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
62 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Inc/usbpd_vdm_user.h:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file usbpd_vdm_user.h
5 | * @author MCD Application Team
6 | * @brief Header file for usbpd_vdm_user.c file
7 | ******************************************************************************
8 | * @attention
9 | *
10 | * © Copyright (c) 2020 STMicroelectronics.
11 | * All rights reserved.
12 | *
13 | * This software component is licensed by ST under Ultimate Liberty license
14 | * SLA0044, the "License"; You may not use this file except in compliance with
15 | * the License. You may obtain a copy of the License at:
16 | * www.st.com/SLA0044
17 | *
18 | ******************************************************************************
19 | */
20 | /* USER CODE END Header */
21 |
22 | #ifndef __USBPD_VDM_USER_H_
23 | #define __USBPD_VDM_USER_H_
24 |
25 | #ifdef __cplusplus
26 | extern "C" {
27 | #endif
28 |
29 | /* Includes ------------------------------------------------------------------*/
30 | /** @addtogroup STM32_USBPD_APPLICATION
31 | * @{
32 | */
33 |
34 | /** @addtogroup STM32_USBPD_APPLICATION_VDM_USER
35 | * @{
36 | */
37 |
38 | /* Exported typedef ----------------------------------------------------------*/
39 | /* Exported define -----------------------------------------------------------*/
40 | /* Exported constants --------------------------------------------------------*/
41 | /* Exported macro ------------------------------------------------------------*/
42 | /* Exported variables --------------------------------------------------------*/
43 | /* Exported functions --------------------------------------------------------*/
44 | USBPD_StatusTypeDef USBPD_VDM_UserInit(uint8_t PortNum);
45 | void USBPD_VDM_UserReset(uint8_t PortNum);
46 |
47 | /**
48 | * @}
49 | */
50 |
51 | /**
52 | * @}
53 | */
54 |
55 | #ifdef __cplusplus
56 | }
57 | #endif
58 |
59 | #endif /* __USBPD_VDM_USER_H_ */
60 |
61 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
62 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Middlewares/ST/STM32_USBPD_Library/Core/inc/usbpd_def.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/VNA_embedded/Middlewares/ST/STM32_USBPD_Library/Core/inc/usbpd_def.h
--------------------------------------------------------------------------------
/Software/VNA_embedded/Middlewares/ST/STM32_USBPD_Library/Core/lib/USBPDCORE_PD3_FULL_CM4_wc32.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/VNA_embedded/Middlewares/ST/STM32_USBPD_Library/Core/lib/USBPDCORE_PD3_FULL_CM4_wc32.a
--------------------------------------------------------------------------------
/Software/VNA_embedded/Middlewares/ST/STM32_USBPD_Library/Devices/STM32G4XX/inc/usbpd_hw.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbpd_hw.h
4 | * @author MCD Application Team
5 | * @brief This file contains interface hw control.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2018 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under Ultimate Liberty license
13 | * SLA0044, the "License"; You may not use this file except in compliance with
14 | * the License. You may obtain a copy of the License at:
15 | * www.st.com/SLA0044
16 | *
17 | ******************************************************************************
18 | */
19 |
20 | #ifndef USBPD_HW_H
21 | #define USBPD_HW_H
22 | /* Includes ------------------------------------------------------------------*/
23 | /* Private typedef -----------------------------------------------------------*/
24 | /* Variable containing ADC conversions results */
25 | /* Private function prototypes -----------------------------------------------*/
26 | /* Private functions ---------------------------------------------------------*/
27 | UCPD_TypeDef *USBPD_HW_GetUSPDInstance(uint8_t PortNum);
28 | DMA_Channel_TypeDef *USBPD_HW_Init_DMARxInstance(uint8_t PortNum);
29 | void USBPD_HW_DeInit_DMARxInstance(uint8_t PortNum);
30 | DMA_Channel_TypeDef *USBPD_HW_Init_DMATxInstance(uint8_t PortNum);
31 | void USBPD_HW_DeInit_DMATxInstance(uint8_t PortNum);
32 | uint32_t USBPD_HW_GetRpResistorValue(uint8_t Portnum);
33 | void USBPD_HW_SetFRSSignalling(uint8_t Portnum, uint8_t cc);
34 | #endif /* USBPD_BSP_HW_H */
35 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
36 |
37 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Middlewares/ST/STM32_USBPD_Library/Devices/STM32G4XX/inc/usbpd_timersserver.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbpd_timersserver.h
4 | * @author MCD Application Team
5 | * @brief This file contains the headers of usbpd_timerserver.h.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2018 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * Redistribution and use in source and binary forms, with or without
13 | * This software component is licensed by ST under Ultimate Liberty license
14 | * SLA0044, the "License"; You may not use this file except in compliance with
15 | * the License. You may obtain a copy of the License at:
16 | * www.st.com/SLA0044
17 | *
18 | ******************************************************************************
19 | */
20 |
21 | #ifndef __USBPD_TIMERSSERVER_H_
22 | #define __USBPD_TIMERSSERVER_H_
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | /** @addtogroup STM32_USBPD_LIBRARY
30 | * @{
31 | */
32 |
33 | /** @addtogroup USBPD_DEVICE
34 | * @{
35 | */
36 |
37 | /** @addtogroup USBPD_DEVICE_TIMESERVER
38 | * @{
39 | */
40 |
41 | /* Exported constants --------------------------------------------------------*/
42 | typedef enum {
43 | TIM_PORT0_CRC,
44 | TIM_PORT0_RETRY,
45 | TIM_PORT1_CRC,
46 | TIM_PORT1_RETRY,
47 | TIM_MAX
48 | }
49 | TIM_identifier;
50 |
51 | #define TIM_MAX_TIME 10000u /*time in us, means 10 ms */
52 | /* Exported types ------------------------------------------------------------*/
53 | /* External variables --------------------------------------------------------*/
54 | /* Exported macros -----------------------------------------------------------*/
55 | /* Exported functions --------------------------------------------------------*/
56 | void USBPD_TIM_Init(void);
57 | void USBPD_TIM_DeInit(void);
58 | void USBPD_TIM_Start(TIM_identifier Id, uint32_t TimeUs);
59 | uint32_t USBPD_TIM_IsExpired(TIM_identifier Id);
60 |
61 | /**
62 | * @}
63 | */
64 |
65 | /**
66 | * @}
67 | */
68 |
69 | /**
70 | * @}
71 | */
72 |
73 | #ifdef __cplusplus
74 | }
75 | #endif
76 |
77 | #endif /* __USBPD_TIMERSSERVER_H_ */
78 |
79 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
80 |
81 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/VNA_embedded/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.c
--------------------------------------------------------------------------------
/Software/VNA_embedded/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ttrftech/LibreVNA/0ade8d95ac4620e890fce9ad308c97efe5c9dc4b/Software/VNA_embedded/Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS/cmsis_os.h
--------------------------------------------------------------------------------
/Software/VNA_embedded/New_configuration.cfg:
--------------------------------------------------------------------------------
1 | # This is an VNA_embedded board with a single STM32L432KCUx chip
2 | #
3 | # Generated by System Workbench for STM32
4 | # Take care that such file, as generated, may be overridden without any early notice. Please have a look to debug launch configuration setup(s)
5 |
6 | source [find interface/stlink.cfg]
7 |
8 | set WORKAREASIZE 0x8000
9 |
10 | transport select "hla_swd"
11 |
12 | set CHIPNAME STM32G432CBUx
13 | set BOARDNAME VNA_embedded
14 |
15 | # CHIPNAMES state
16 | set CHIPNAME_CPU0_ACTIVATED 1
17 |
18 | # Enable debug when in low power modes
19 | set ENABLE_LOW_POWER 1
20 |
21 | # Stop Watchdog counters when halt
22 | set STOP_WATCHDOG 1
23 |
24 | # STlink Debug clock frequency
25 | set CLOCK_FREQ 8000
26 |
27 | # use hardware reset, connect under reset
28 | # connect_assert_srst needed if low power mode application running (WFI...)
29 | reset_config srst_only srst_nogate connect_assert_srst
30 | set CONNECT_UNDER_RESET 1
31 |
32 | # BCTM CPU variables
33 |
34 |
35 |
36 | source [find target/stm32g4x.cfg]
37 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/Src/usbpd.c:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file usbpd.c
5 | * @author MCD Application Team
6 | * @brief This file contains the device define.
7 | ******************************************************************************
8 | * @attention
9 | *
10 | * © Copyright (c) 2020 STMicroelectronics.
11 | * All rights reserved.
12 | *
13 | * This software component is licensed by ST under Ultimate Liberty license
14 | * SLA0044, the "License"; You may not use this file except in compliance with
15 | * the License. You may obtain a copy of the License at:
16 | * www.st.com/SLA0044
17 | *
18 | ******************************************************************************
19 | */
20 | /* USER CODE END Header */
21 |
22 | /* Includes ------------------------------------------------------------------*/
23 | #include "usbpd.h"
24 |
25 | /* USER CODE BEGIN 0 */
26 | /* USER CODE END 0 */
27 |
28 | /* USER CODE BEGIN 1 */
29 | /* USER CODE END 1 */
30 |
31 | /* Global variables ---------------------------------------------------------*/
32 |
33 | /* USER CODE BEGIN 2 */
34 | /* USER CODE END 2 */
35 |
36 | /* USBPD init function */
37 | void MX_USBPD_Init(void)
38 | {
39 |
40 | /* Global Init of USBPD HW */
41 | USBPD_HW_IF_GlobalHwInit();
42 |
43 | /* Initialize the Device Policy Manager */
44 | if(USBPD_OK != USBPD_DPM_InitCore())
45 | {
46 | while(1);
47 | }
48 |
49 | /* Initialise the DPM application */
50 | if (USBPD_OK != USBPD_DPM_UserInit())
51 | {
52 | while(1);
53 | }
54 |
55 | /* USER CODE BEGIN 3 */
56 | /* USER CODE END 3 */
57 |
58 | }
59 |
60 | /* USER CODE BEGIN 4 */
61 | /* USER CODE END 4 */
62 |
63 | /**
64 | * @}
65 | */
66 |
67 | /**
68 | * @}
69 | */
70 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
71 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/VNA_embedded Debug.cfg:
--------------------------------------------------------------------------------
1 | # This is an VNA_embedded board with a single STM32G431CBUx chip
2 | #
3 | # Generated by System Workbench for STM32
4 | # Take care that such file, as generated, may be overridden without any early notice. Please have a look to debug launch configuration setup(s)
5 |
6 | source [find interface/stlink.cfg]
7 |
8 | set WORKAREASIZE 0x5800
9 |
10 | transport select "hla_swd"
11 |
12 | set CHIPNAME STM32G431CBUx
13 | set BOARDNAME VNA_embedded
14 |
15 | # CHIPNAMES state
16 | set CHIPNAME_CPU0_ACTIVATED 1
17 |
18 | # Enable debug when in low power modes
19 | set ENABLE_LOW_POWER 1
20 |
21 | # Stop Watchdog counters when halt
22 | set STOP_WATCHDOG 1
23 |
24 | # STlink Debug clock frequency
25 | set CLOCK_FREQ 8000
26 |
27 | # use hardware reset, connect under reset
28 | # connect_assert_srst needed if low power mode application running (WFI...)
29 | reset_config srst_only srst_nogate connect_assert_srst
30 | set CONNECT_UNDER_RESET 1
31 |
32 | # BCTM CPU variables
33 |
34 |
35 |
36 | source [find target/stm32g4x.cfg]
37 |
--------------------------------------------------------------------------------
/Software/VNA_embedded/VNA_embedded.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | ]>
11 |
12 |
13 | VNA_embedded
14 | SWD
15 | ST-Link
16 | stm32g431cbux
17 |
18 |
19 |
--------------------------------------------------------------------------------