nRF Machine Learning: Internal modules
The nRF Machine Learning application uses modules available in Common Application Framework (CAF), a set of generic modules based on Application Event Manager and available to all applications, and a set of dedicated internal modules. See Firmware architecture for more information.
The nRF Machine Learning application uses the following modules available in CAF:
See the module pages for more information about the modules and their configuration.
The nRF Machine Learning application also uses the following dedicated application modules:
ei_data_forwarder_bt_nus
The module forwards the sensor readouts over NUS to the connected Bluetooth Central. The sensor data is forwarded only if the connection is secured and the connection interval is within the limit defined by the
CONFIG_BT_PERIPHERAL_PREF_MAX_INT
andCONFIG_BT_PERIPHERAL_PREF_MAX_INT
Kconfig options.ei_data_forwarder_uart
The module forwards the sensor readouts over UART.
led_state
The module displays the application state using LEDs. The LED effects used to display the state of data forwarding, the machine learning results, and the state of the simulated signal are defined in the
led_state_def.h
file located in the application configuration directory. The common LED effects are used to represent the machine learning results and the simulated sensor signal.ml_runner
The module uses the Edge Impulse wrapper API to control running the machine learning model. It provides the prediction results using
ml_result_event
.ml_app_mode
The module controls application mode. It switches between running the machine learning model and forwarding the data. The change is triggered by a long press of the button defined in the module’s configuration.
sensor_sim_ctrl
The module controls the parameters of the generated simulated sensor signal. It switches between predefined sets of parameters for the simulated signal. The parameters of the generated signals are defined by the
sensor_sim_ctrl_def.h
file located in the application configuration directory.usb_state
The module enables USB.
Note
The ei_data_forwarder_bt_nus
and ei_data_forwarder_uart
modules stop forwarding the sensor readouts if they receive a sensor_event
that cannot be forwarded and needs to be dropped.
This could happen, for example, if the selected sensor sampling frequency is too high for the used implementation of the Edge Impulse data forwarder.
Data forwarding is stopped to make sure that dropped samples are noticed by the user.
If you switch to running the machine learning model and then switch back to data forwarding, the data is again forwarded to the host.