IonizationChamber/Software/Firmware/README.md

45 wiersze
1.4 KiB
Markdown

2024-12-11 08:50:20 +00:00
# Architecture
2021-08-07 14:16:47 +00:00
2024-12-11 16:04:18 +00:00
Below is the sequence diagram for the firmware.
2021-08-07 14:16:47 +00:00
2025-06-27 06:15:49 +00:00
![firmware main sequence diagram](../../Documentation/Diagrams/FirmwareMainSequence.svg)
![firmware tick sequence diagram](../../Documentation/Diagrams/FirmwareTickSequence.svg)
2021-08-07 14:16:47 +00:00
2024-12-11 08:50:20 +00:00
# Building Firmware
2021-08-07 14:16:47 +00:00
2024-12-11 08:50:20 +00:00
Docker is used to create an isolated and reproducible work environment.
2021-08-07 14:16:47 +00:00
2025-06-27 06:15:49 +00:00
[Detailed information about setting up the environment.](../../Documentation/Manuals/README.md)
2021-08-07 14:16:47 +00:00
2024-12-11 08:50:20 +00:00
# Protocol for sending measurements via UART
2021-08-07 14:16:47 +00:00
2024-12-11 08:50:20 +00:00
## Purpose
2021-08-07 14:16:47 +00:00
2024-12-11 08:50:20 +00:00
To ensure data integrity when sending information from the ionization chamber device to the computer, a simple protocol was added to encapsulate each data or command transmission.
2021-08-07 14:16:47 +00:00
2024-12-11 08:50:20 +00:00
## Protocol details
2021-08-07 14:16:47 +00:00
2024-12-11 08:50:20 +00:00
### Definition of the message
2021-08-07 14:16:47 +00:00
2025-06-27 06:15:49 +00:00
![uart frame format diagram](../../Documentation/Diagrams/UartFrameFormat.svg)
2021-08-07 14:16:47 +00:00
2024-12-11 08:50:20 +00:00
The field “msg length” describes the number of bytes in the “data” section.
2021-08-07 14:16:47 +00:00
2024-12-11 08:50:20 +00:00
The content of the data section in the above message is an example and may vary depending on the message ID. Currently, only one message is supported, as shown above.
2021-08-07 14:16:47 +00:00
2024-12-11 08:50:20 +00:00
### Defined message ids and message content
2021-08-07 14:16:47 +00:00
2024-12-11 08:50:20 +00:00
Currently, only one message type is defined (with ID = 1).
2021-08-07 14:16:47 +00:00
2024-12-11 08:50:20 +00:00
* Msg ID: 1 - Data from the last analog measurement of the actual value.
Msg Data Section:
* ADC configuration
* MSB (most significant byte) from ADC
* LSB (least significant byte) from ADC
2021-08-07 14:16:47 +00:00
2024-12-11 08:50:20 +00:00
### CRC
2021-08-07 14:16:47 +00:00
2024-12-11 08:50:20 +00:00
The CRC is calculated by XOR-ing all bytes in the "preamble" and "data" sections.
2021-08-07 14:16:47 +00:00