Skip to content

SDS804x HD Oscilliscope

This example uses the Siglent SDS804X HD oscilloscope attached to the gateway to take a screenshot of the waveform during a test. It uses the VISAScopeSDS804XHD interface defined by the HIL SDK and creates a fixture, which the test_screenshot.py then uses to take a screenshot and return it to either the developer calling the HIL, or to a pipeline if it's running in CI.

It consists of two files:

conftest.py - This imports the VISAScopeSDS804XHD interface and creates the fixture

test_screenshot.py - Contains a test that sends uses the take_screenshot function to grab a screenshot and store it in screenshot.bmp that is returned at the end of the test because it's stored in the hil_results_get_path location.

    import os
    import pytest
    import logging
    import time

    from hil_sdk.version import __version__
    from hil_sdk.interfaces.jlink_interface import JLinkInterface
    from hil_sdk.interfaces.nrfjprog_interface import nrfjprog_flash
    from hil_sdk.interfaces.visa.oscilloscope.visa_scope_sds804xhd import VISAScopeSDS804XHD

    @pytest.fixture(autouse=True, scope="session")
    def hil_version_fixture():
        logging.info(f"HIL SDK version {__version__}")

    @pytest.fixture(autouse=True, scope="session")
    def jlink_fixture(hil_version_fixture):

        logging.info("Creating J-Link interface...")
        return JLinkInterface("nRF5340_xxAA_APP")

    @pytest.fixture(autouse=True, scope="session")
    def flash_fixture(jlink_fixture, hil_extras_get_path):

        logging.info("Flashing target...")
        assert nrfjprog_flash(hil_extras_get_path("artifacts/merged_domains.hex"), "NRF53") == 0

        logging.info("Resetting target...")
        assert jlink_fixture.reset_and_go()

        time.sleep(2)  # Sleep for a couple of seconds to let the target device start up


    @pytest.fixture
    def visa_scope_sds804xhd_fixture():
        return VISAScopeSDS804XHD()
    import pyvisa
    import os


    def test_scope_screenshot(visa_scope_sds804xhd_fixture, hil_results_get_path):

        try:
        # use the hil_results_get_path to get the path to the directory that will
        # be returned at the end of the test
            my_file_name = hil_results_get_path('screenshot.bmp')
            visa_scope_sds804xhd_fixture.take_screenshot(my_file_name)

        except Exception as err:
            print('Exception: ' + str(err))
            assert(False)