Flightlevel: testbed

Note

This section explains:

  • How a testbed is configured.

  • How a testbed instance is configured.

Tests always run against a specific testbed. See: Implementation.

This secion is about specifying such a testbed_showcase.

Specification of the testbed

Supported FUTS

File: src/testbed_showcase/constants.py

1class EnumFut(enum.StrEnum):
2   FUT_MCU_ONLY = enum.auto()
3   FUT_I2C = enum.auto()
4   FUT_UART = enum.auto()
5   FUT_ONEWIRE = enum.auto()
6   FUT_TIMER = enum.auto()

Tentacle Types

File: src/testbed_showcase/constants.py

1class TentacleType(enum.StrEnum):
2   TENTACLE_MCU = enum.auto()
3   TENTACLE_DEVICE_POTPOURRY = enum.auto()
4   TENTACLE_DAQ_SALEAE = enum.auto()

Configure the tentacles

File: src/testbed_showcase/tentacles_spec.py

1@dataclasses.dataclass
2class McuConfig:
3   trig1: str
4   trig2: str
5   data1: str
6   data2: str
7   i2c: str
8   onewire: str

The micropython code running on the MCUs differs from device to device - for example which GPIO to be used. See the use of this class in Flightlevel: micropython.

File: src/testbed_showcase/tentacle_specs.py

 1tentacle_spec_mcu_rpi_pico2 = TentacleSpec(
 2   tentacle_type=TentacleType.TENTACLE_MCU,
 3   futs=[
 4      EnumFut.FUT_MCU_ONLY,
 5      EnumFut.FUT_I2C,
 6      EnumFut.FUT_UART,
 7      EnumFut.FUT_ONEWIRE,
 8      EnumFut.FUT_TIMER,
 9   ],
10   category="MicroPython Board",
11   label="pico2",
12   doc=DOC_TENTACLE_RPI_PICO2,
13   mcu_usb_id=util_mcu_pico.RPI_PICO2_USB_ID,
14   tags="boards=RPI_PICO2:RPI_PICO2-RISCV,mcu=rp2,programmer=picotool",
15   relays_closed={
16      EnumFut.FUT_MCU_ONLY: [],
17      EnumFut.FUT_I2C: [2, 3, 4, 5],
18      EnumFut.FUT_ONEWIRE: [2, 3, 4],
19   },
20   mcu_config=McuConfig(
21      trig1="GP20",
22      trig2="GP21",
23      data1="GP19",
24      data2="GP18",
25      i2c="i2c = I2C(1, scl=Pin('GP19'), sda=Pin('GP18'), freq=100_000)",
26      onewire="GP14",
27   ),
28)
  • Line 2: It is a TENCALE_MCU

  • Line 3: These FUTS are supported: MCU_ONLY, I2C, UART, ONEWIRE and TIMER.

  • Line 14: boards=RPI_PICO2:RPI_PICO2-RISCV: Two firmware variants are supported RPI_PICO2 and RPI_PICO2-RISCV

  • Line 14: mcu=rp2 the processor helps octoprobe to find the corresponding USB manufacturer/device id.

  • Line 14: programmer=picotool specifies the programmer to be used.

  • Line 17: EnumFut.FUT_I2C: [2, 3, 4, 5],: When a test specifies to test I2C, then octoprobe will close the relais [2, 3, 4, 5]. This information corresponds to the schematics of the tentacle.

  • Line 21: trig1=”GP20”,: This fragment will be injected into micropython code. See Flightlevel: micropython.

Configure of the testbed-instance

  • A testbed is the specification of how the tentacles are populated and wired and how to test the different FUT.

    • Testbed/Tentacle specification

      • src/testbed_showcase/tentacle_spec_mcuconfig.py

      • src/testbed_showcase/tentacles_spec.py

  • A testbed may be instanciated (pysically assembled and soldered) serveral times: The same testbed may run in Switzerland with MCUs Pico and pyboard and also in Australia using MCUs Esp32, esp8266 and Arduino Portenta C33.

  • Tentacles inventory

 1from octoprobe.util_baseclasses import TentaclesCollector
 2
 3from testbed_showcase.constants import TESTBED_NAME
 4
 5from . import tentacle_specs
 6
 7TENTACLES_INVENTORY = (
 8    TentaclesCollector(testbed_name=TESTBED_NAME)
 9    .add_testbed_instance(
10        testbed_instance="ch_hans_1",
11        tentacles=[
12            ("e46340474b17-4429", "v1.0", tentacle_specs.MCU_PYBV11),
13            ("e46340474b4e-1831", "v1.1", tentacle_specs.MCU_RPI_PICO2),
14            ("e46340474b4c-1331", "v1.0", tentacle_specs.DAQ_SALEAE),
15            ("e46340474b4c-3f31", "v1.0", tentacle_specs.DEVICE_POTPOURRY),
16            (
17                "de646cc20b92-5425",
18                "v1.0",
19                tentacle_specs.MCU_RPI_PICO_W,
20            ),  # Tentacle v0.4
21        ],
22    )
23    .add_testbed_instance(
24        testbed_instance="ch_hans_2",
25        tentacles=[
26            ("e46340474b4c-2731", "v1.1", tentacle_specs.MCU_RPI_PICO2),
27            ("e46340474b28-3623", "v1.0", tentacle_specs.DAQ_SALEAE),
28            ("e46340474b0c-3523", "v1.0", tentacle_specs.DEVICE_POTPOURRY),
29        ],
30    )
31    .add_testbed_instance(
32        testbed_instance="ch_greenliff_1",
33        tentacles=[
34            ("e46340474b55-1722", "v1.0", tentacle_specs.MCU_RPI_PICO),
35            ("e46340474b16-4d29", "v1.0", tentacle_specs.DAQ_SALEAE),
36            ("e46340474b57-4722", "v1.0", tentacle_specs.DEVICE_POTPOURRY),
37        ],
38    )
39    .add_testbed_instance(
40        testbed_instance="au_damien_1",
41        tentacles=[
42            ("e46340474b14-1c29", "v1.1", tentacle_specs.MCU_RPI_PICO2),
43            ("e46340474b12-1931", "v1.0", tentacle_specs.DAQ_SALEAE),
44            ("e46340474b56-3b21", "v1.0", tentacle_specs.DEVICE_POTPOURRY),
45        ],
46    )
47).inventory