GPIO events
GPIO events are timestamped records of the level changes of GPIO lines between your open node and the testbed, to time the steps of your firmware.
Your firmware toggles a GPIO line, and the testbed records each change with its time: you can time the steps of your program, or align them with the consumption and radio measures, without using the serial port.
Lines of the nodes
| Node | gpio1 |
gpio2 |
|---|---|---|
| IoT-LAB M3 | PA3 | PB9 |
| IoT-LAB A8-M3 | PC8 | PC0 |
The control node records both edges of these lines. The nodes with GPIO lines have the
property gpio, the number of their lines.
Do not use gpio1 with the consumption monitoring: on the control node, gpio1 shares an
interrupt line with the consumption sensor, enabling gpio1 stops the consumption
measures until the start of your next experiment. Use gpio2.
Create a profile with events
In the web portal, tick Events in the
monitoring profile form, and
give the names of the lines, here gpio2.
With the command line tools:
$ iotlab-profile addm3 -n events -current -period 8244 -avg 4 \
-outputs jsonl streaming -gpios gpio2
The events of a running node can be changed by updating its monitoring profile. They then go to the outputs of the experiment: see Monitoring outputs.
Toggle a line
A RIOT application toggling gpio2 every 500 ms on an IoT-LAB M3:
#include "periph/gpio.h"
#include "ztimer.h"
#define GPIO2_PIN GPIO_PIN(PORT_B, 9)
int main(void)
{
gpio_init(GPIO2_PIN, GPIO_OUT);
while (1) {
ztimer_sleep(ZTIMER_MSEC, 500);
gpio_toggle(GPIO2_PIN);
}
return 0;
}
In its Makefile:
FEATURES_REQUIRED += periph_gpio
USEMODULE += ztimer ztimer_msec
Read the events
In the file ~/.iot-lab/<exp_id>/event/<node>.jsonl, value is the level of the line
after the change:
{"timestamp_s":1793839256,"timestamp_us":493073,"value":1,"name":"gpio2"}
{"timestamp_s":1793839256,"timestamp_us":993081,"value":0,"name":"gpio2"}
With the streaming output, the query is:
event_value{exp_id="1234", name="gpio2"}
The events of the control node are timestamped with its clock, the same as the consumption and radio measures.