This article is about a customer project that requires testing of a connectivity stack. Note: Only very generic properties can be disclosed: Protection of customer IP is key.
The requirements of that project are:
- Real-time capability of test equipment
- High throughput
- Low latency (as connectivity protocol paradigm is stop-and-wait
- Various interfaces: I2C, SPI, UART
- Two independent communication channels between user/test program and two devices-under-test
- Multi-platform host library
- „Primary Firmware“ containig the OS and the I/O system
- „Secondary Firmware“ or „App“ containing tests
The majority of 3000 test cases runs host-based. The host is a Windows or Linux PC or a MAC respectively. A small selection runs on Android-based devices as well as on IOS.
This article is about real-time, though: What is „real-time“ about, then? It is about requirements and constraints entirely. Real-time in fact is about absolutely guaranteed system response within a defined deadline. In other words: The real-time system responds within a period of time which will have no influence on the overall system behaviour.
As previously said the majority of tests will not care about host (PC) to device latency: This includes PC library call, USB delay, device-side request dispatch, worker-thread invocation and serial interface data transfer.
Some, however do: This quite limited number of tests is about measuring device-under-test response time, data throughput, execution time of commands, post-command dead-time and various other characteristics. Now can such a test be done host PC based, with USB transfer initiation every 1 ms only? The answer is pretty much NO.
While the device developed comes in handy as USB-to-interface and I/O line controller, the real value is within its capability to run user code efficiently and with minimum delay! Demanding tests run in a RTOS environment completely device-based:
- An „App“ can be developed using a specific SDK
- Download the program using a „USB-Stick“ mode bootloader
- This „App“ is able to access the same I/O functions as available in the host library
- In addition OS functions for threads, semaphores and other objects are available
- Moreover, utilities for time and data throughput measurement are available
- Supervision of computing power consumption and resource allocation inclusive
- Timers and interrupts are available: IRQs can be handled by dynamically registered ISRs, filtering of IRQ action is comprised: A chain of handlers can be arranged, e.g. for DMA action on different peripherals
- DMA action allows for high parallelism of I/O operations
- SDK available
For testing, a complete C++ (!) X-Unit test bench comprising 150+ tests was developed in the „App“ space of the microcontroller. The test application uses services of the device firmware and the I/O system.