Tutorial 1 (DUT tutorial)

Goal

This tutorial will show you the miniHIL basics. It uses an example DUT (=Device Under Test) which will be tested using the miniHIL environment.

Setup

  1. Make sure you have the default development environment (IDE + tools directory) setup correctly.

  2. Import all projects from this zip file into the miniHIL IDE.

  3. Connect the miniHIL Board (follow the Quick Start guide if needed, don’t connect the power, yet).

  4. Add the wire connections from "Wiring section below".

  5. Connect the power now.

  6. Flash the DUT using the evalboards debugger and the "DUTProjectF303_Tutorial1" launch configuration from the "DUTProjectF303" eclipse project.

  7. Flash the miniHIL software using the "build-debug-st-link" launch configuration.

  8. Launch the GUI.

Note If you are unsure about the process, follow the "Quick Start" guide on https://docs.protossoftware.de.
Note If you get a warning that more than one st link debugger is connected, disconnect the DUTs or the miniHILs ST-Link Debugger (depending on which board you want to flash).

Wiring

miniHIL Target 1 + 2 Function

Digital IO 0

PC1

"LED" output, active high

Digital IO 16

PC0

"BTN" input, active high

Digital IO 31

RES

DUT Reset

PF1

PA9

I2C SCL

PF0

<⇒

PA10

I2C SDA

PA10

PC4

UART RX (miniHIL)

PA9

PC5

UART TX (miniHIL)

PA_1C

PA4

Analog In (miniHIL), DAC out (DUT)

The DUT

Intro

For this tutorial a STM32F303 Nucleo-64 eval board is used. An example application, which will be used for this tutorial, can be found in the "DUTProjectF303" eclipse project.

You can build and flash the application using the "DUTProjectF303_Tutorial1" run configuration.

Functionality

The example application is pretty basic. It contains one button for user input and one LED. It also contains a small demonstration of miniHIL/CaGe capabilities in form of ADC/DAC and I2C tests.

A real world example of the system may be found on most recent power tools (mostly drills): The working light is controlled by the trigger on the Nucleo board. When you push the trigger the working light turns on. Once you release the trigger the light stays on for some time before turning off.

To make the dut more interesting the software contains different modi (or implementation states) which we can test separately.

The modi are switched by CaGe using the UART interface.

The following modes are available:

Mode Function

1

LED turns on while the button is pressed and turns off as soon as the button is released.

2

LED turns on when the button is pressed and turns off after 1s (regardless of button state).

3

LED is on while button is pressed and stays on for 1s after button is released. If the button is repressed during the 1s period, the timeout is restarted.

Only the last mode contains all the required features.

The DUTs LED will blink the currently selected mode after DUT reset.

For this example the blue button (on the Nucleo board) is connected in parallel with one of the µCs Inputs. The same is true for the LED output. That way you can test the DUTs behavior manually by pressing the blue button and observing the green LED.

As mentioned previously, the demo contains the ADC/DAC and I2C Master/Slave CaGe test examples.

In the ADC/DAC Test, the miniHIL sends a command to the DUT via UART, which should set a desired voltage on DUT’s DAC output. The simulator then tries to measure the voltage on its ADC input.

The I2C example simulates a simple microcontroller-sensor communication between the DUT and the miniHIL. In this case the miniHIL acts as an I2C-slave. In the first CaGE testcase, the miniHIL sends a byte sequence via UART that should be written by the DUT over I2C. The DUT sends the received byte sequence to the miniHIL via I2C and the both sequences are then compared in the CaGe test.

In the second testcase the DUT tries to read bytes from miniHIL. But at first the miniHIL sends a sequence of bytes to the DUT via UART that should be compared later with the data received by the DUT over I2C. If the sequences match, the DUT sends a confirmation over UART. Otherwise a fail message is sent and the test case fails.

Note The DUT software is implemented using eTrice. Feel free to play with it. If you come up with other interesting test scenarios, we are always happy to hear about it!

The tests

The project contains some example test cases. They can be found in the "Tutorial1Tests.cage" file (miniHILProject/model-user/). The testsuites contained in the ATutorial1TestsActor are shown in the gui once it is connected to the miniHIL board. Feel free to execute the tests once you have completed the setup. Depending on the selected DUT mode some of the testcases will fail.

Things to try

  • Play with the different DUT modes and observe which testcases pass/fail.

  • Expand the test cases to check if the working light can be retriggered in mode 2 or 3.

  • Have a look at the svgs which are generated in the HilSimGui directory when you executed the tests using the gui.

  • Execute the tests from the commandline (dont’t forget to disconnect the gui first). Have a look at https://docs.protossoftware.de → Development Environment → Headless Build and Test.

  • Play with the different DAC/ADC voltages and testcase voltage ranges. Try adding a 'for' loop in the CaGe test.

  • Set different I2C byte sequences. Check if multiple byte sequences work properly by building your own 'protocol'.