CircuitPython

To enable custom direct hardware interaction with a Device Under Test (DUT) through a microcontroller (MCU) embedded in a Pogo-Pin Cassette (PPC), off-the-shelf CircuitPython firmware images can be utilized.

These pre-configured firmware images support a wide range of hardware interfaces, providing a robust platform that can be seamlessly integrated into a PLT test plan.

References

I2C

Sample Test Plan

title: "I2C write with RP2040"
suite:
 - title: Defines
   steps:
    - command: define MCU.uart "UART2"
 - title: New CircuitPython Session
   steps:
    - command: uartCfg %MCU.uart% 1000000
      id: "239a:80c9"
 - title: "I2C write with CircuitPython"
   steps:
    - command: uart %MCU.uart%
      send: |
        import board, busio
          from adafruit_bus_device.i2c_device import I2CDevice
        with I2CDevice(busio.I2C(board.SCL, board.SDA), 0x20) as device:
          device.write(bytearray([0x01, 0x02, 0x03]))

PWM

Signal generation, using a code.py file uploaded to the CircuitPython device.

import audiocore
import audiopwmio
import board
import array
import time
import math

FREQUENCY = 200
SAMPLE_RATE = 5000

length = SAMPLE_RATE // FREQUENCY
sine_wave = array.array("H", [0] * length)
for i in range(length):
    sine_wave[i] = int(math.sin(math.pi * 2 * i / length) * (2 ** 15) + 2 ** 15)

dac = audiopwmio.PWMAudioOut(board.GP14)
sine_wave = audiocore.RawSample(sine_wave, sample_rate=SAMPLE_RATE)
dac.play(sine_wave, loop=True)
try:
    while True:
        time.sleep(1)
finally:
    dac.stop()
    dac.deinit()