Example

The following is an example of how the communication should be executed. The packets will be in JSON for readability, but should be in the common_com_lib packets in practice.

  1. Send an ENTER command with C_EARTH_BOND_MEASUREMENT_RPE measurement.

STM -> nRF1

{
  "items": [
    {
      "key": "C_G_EVENT_ENTER",
      "value": "C_EARTH_BOND_MEASUREMENT_RPE"
    }
  ]
}
  1. The nRF should start sending back current MFT's settings, preferrably when their value has changed.

nRF -> STM2

{
  "items": [
    {
      "key": "C_G_FUNC_SETTINGS_GLOBAL"
    },
    {
      "key": "C_SETTINGS_GLOBAL_SETT_MFT_ROTARY",
      "value": "C_SETTINGS_GLOBAL_SETT_VAL_MFT_ROTARY_CONTINUITY"
    },
    {
      "key": "C_SETTINGS_GLOBAL_SETT_MFT_F1",
      "value": "C_SETTINGS_GLOBAL_SETT_VAL_MFT_F1_LN"
    },
    {
      "key": "C_SETTINGS_GLOBAL_SETT_MFT_F2",
      "value": "C_SETTINGS_GLOBAL_SETT_VAL_MFT_F2_ZEROED"
    },
    {
      "key": "C_SETTINGS_GLOBAL_SETT_MFT_F3",
      "value": "C_SETTINGS_GLOBAL_SETT_VAL_MFT_F3_PRETEST_OHM_PLUS_MINUS"
    },
    {
      "key": "C_SETTINGS_GLOBAL_SETT_MFT_F4",
      "value": "C_SETTINGS_GLOBAL_SETT_VAL_MFT_F4_MA250"
    }
  ]
}
  1. When the measurement on STM is started, the C_G_EVENT_START will be sent.

STM -> nRF3

{
  "items": [
    {
      "key": "C_G_EVENT_START",
      "value": "C_EARTH_BOND_MEASUREMENT_RPE"
    }
  ]
}
  1. The nRF should start sending back results when they're available, possibly waiting for the user to start the measurement.

nRF -> STM4

{
  "items": [
    {
      "key": "C_EARTH_BOND_MEASUREMENT_RPE"
    },
    {
      "key": "C_EARTH_BOND_RES_RPE_EARTH_BOND",
      "value": 0.25
    }
  ]
}
  1. The STM stops the measurement.

STM -> nRF5

{
  "items": [
    {
      "key": "C_G_EVENT_STOP",
      "value": null,
    }
  ]
}
  1. The STM exits the measurement.

STM -> nRF6

{
  "items": [
    {
      "key": "C_G_EVENT_EXIT",
      "value": null,
    }
  ]
}

Packets templates in C/C++

To create the packet, the following boilerplate can be used:

Enter packet

MSG_CREATE(msg);
MSG_APPEND(msg, C_G_EVENT_ENTER, C_EARTH_BOND_MEASUREMENT_RPE);
MSG_SEND(&comm, msg);

Settings packet

MSG_CREATE(msg);
MSG_APPEND(msg, C_G_FUNC_SETTINGS_GLOBAL);
MSG_APPEND(msg, C_SETTINGS_GLOBAL_SETT_MFT_ROTARY, C_SETTINGS_GLOBAL_SETT_VAL_ROTARY_INSULATION);
MSG_APPEND(msg, C_SETTINGS_GLOBAL_SETT_MFT_F1, C_SETTINGS_GLOBAL_SETT_VAL_MFT_F1_LN);
MSG_APPEND(msg, C_SETTINGS_GLOBAL_SETT_MFT_F2, C_SETTINGS_GLOBAL_SETT_VAL_MFT_F2_ZEROED);
MSG_APPEND(msg, C_SETTINGS_GLOBAL_SETT_MFT_F3, C_SETTINGS_GLOBAL_SETT_VAL_MFT_F3_PRETEST_OHM_PLUS_MINUS);
MSG_APPEND(msg, C_SETTINGS_GLOBAL_SETT_MFT_F4, C_SETTINGS_GLOBAL_SETT_VAL_MFT_F4_MA250);
MSG_SEND(&comm, msg);

Start packet

MSG_CREATE(msg);
MSG_APPEND(msg, C_G_EVENT_START, C_EARTH_BOND_MEASUREMENT_RPE);
MSG_SEND(&comm, msg);

Result packet

MSG_CREATE(msg);
MSG_APPEND(msg, C_EARTH_BOND_MEASUREMENT_RPE);
MSG_APPEND(msg, C_EARTH_BOND_RES_RPE_EARTH_BOND, 0.25);
MSG_SEND(&comm, msg);

Stop packet

MSG_CREATE(msg);
MSG_APPEND(msg, C_G_EVENT_STOP);
MSG_SEND(&comm, msg);

Exit packet

MSG_CREATE(msg);
MSG_APPEND(msg, C_G_EVENT_EXIT);
MSG_SEND(&comm, msg);