Handsake Protocl
This page describes a simple handshake protocol that can be used to communicate between the target and the host. The protocol is based on a simple request-response model.
Protocol
The suggested handshake protocol defines a simple way to exchange the input data, the metrics, warnings, and any runtime errors between the AI_Manager and MCU Target.
- The target sends
0:START\n
as soon as the target started. - The target sends
0:GET-DATA\n
when it is ready to receive the input data that will be used to run the model. - The AI_Manager sends directly the right number of bytes
- The target sends back the metrics in json format. The format of the message is the following :
1:{jyson_type:"inferance_metrics", ...}
Handling Errors, warnings and information
- The target sends an info message like :
2:<YOUR INFO MESSAGE>
- The target sends a warning message like :
3:<YOUR WARNING MESSAGE>
- The target sends an error message like :
4:<YOUR ERROR MESSAGE>
4:<YOUR ERROR MESSAGE>
trigger a system error that stops the manager and the CI/CD. Unknown messages, (messages that doesn’t start by 0, 1, 2, 3 or 4) will trigger an error and stops the CI/CD.Handling Hardfaults
In case of a hardfault, the target must be rebooted.
The 0:START\n
message is used to detect a Hardfault error. You must ensure that the target is able to send this message as soon as it starts (after initialization of the necessary resources). If the AI_Manager get this message after receiving the command 0:GET-DATA\n
, then it means that the target crashed. And thus the benchmark should stop and an error should be thrown.
Message type
- Command : message start with
0
- Result : message start with
1
- Info : message start with
2
- Warning : message start with
3
- Error : message start with
4