A bit of context
This ODeV project is inspired by the Serial_Datalog.
Firmware package architecture
The Idea
The goal is to use the multi sensors data logging feature from the STWIN firmware and to integrate it with the ODeV framework in order to add:
- Modularity
- Low power support
- A well-defined sensor application framework to use the sensors on the board in two scenarios:
- User not expert with the hardware implementation of a MEMS. In this case the sensor framework provides a high level API to select the sensors to use, and to modify the common parameters like ODR, full scale etc.
- Power user who want to take advantage of the low level driver, provided by ST, but still integrate their code with the sensor framework. In this case the developer documentation provides all the information to extend a sensor class and to overwrite some of the key virtual methods.
Main Components
- STWIN. I am not an hardware engineer, so I have to select what is available, and this is a good board to prototype the idea presented in this page. The board has a range of embedded industrial-grade sensors and an ultra-low-power microcontroller.
- ODeV framework. Of course it is the base for the firmware.
- FatFS, a generic FAT/exFAT filesystem module for small embedded systems.
- Parson, a lightweight json library written in C.
- STMems Standard C drivers, a platform independent drivers (PID) for STMicroelectronics sensors.
- STM32CubeIDE. The preferred IDE.
Fig.01 displays an high level block diagram of the prototype.
Fig.1 - Block diagram
The box with yellow background (e.g. SPIBusTask) have been developed for this demo. Following the design pattern of the framework the code is encapsulated in well defined classes to be easy to reuse across different project based on ODeV_f. The box with red foreground (e.g. FATFS) are open sure projects. The box with light cyan background (e.g. MX generated drv) include the PID sensor driver provided by ST and part of the code generated by STM32CubeMX.
In this page I will discuss the application specific code. Note that this is based on ODeV and its design pattern.
In this page I will discuss the application specific code. Note that this is based on ODeV and its design pattern.
Firmware architecture
The demo application
A demo application to test the sensor framework is available in the GITHUB repository.
To test the low power mode:
After the reset the application is in RUN mode and the GREEN user LED is on. To start the data logging:
The application goes in DATALOG mode and the GREEN LED start blinking. To stop the data logging press the user push button. The application goes back to RUN mode and the GREEN LED stop blinking.
When the application is in RUN, if there is no event for 10" then the low power mode timer triggers a power mode transaction and the application goes in SLEPP_1. The GREEN LED is turned off to signal the new power mode. The exit the SLEEP_1 mode press the user button and the application goes in RUN mode.
Even if this application is simple, it show the main feature of the sensor framework.
To test the low power mode:
- the demo application must be compiled in RELEASE configuration.
- after programming the STWIN perform an hard reset.
After the reset the application is in RUN mode and the GREEN user LED is on. To start the data logging:
- insert an SDCARD on the SDCARD slot.
- press the user push button.
The application goes in DATALOG mode and the GREEN LED start blinking. To stop the data logging press the user push button. The application goes back to RUN mode and the GREEN LED stop blinking.
When the application is in RUN, if there is no event for 10" then the low power mode timer triggers a power mode transaction and the application goes in SLEPP_1. The GREEN LED is turned off to signal the new power mode. The exit the SLEEP_1 mode press the user button and the application goes in RUN mode.
Even if this application is simple, it show the main feature of the sensor framework.
The source code
The source code is available in the ODeV_f GITHUB repository in the datalog_stwin branch.
Project status
The project is still in development. The main features have been implemented, but not all sensor of the STWIN are supported yet.
Supported sensors:
The project introduce also a new version of the ODeV framework with new features. I will discuss it in a separate page.
The folder structure of the project is not final and it will change during the development.
The HTML API documentation is not updated.
Supported sensors:
- ISM330DHCX
- IIS3DWB
The project introduce also a new version of the ODeV framework with new features. I will discuss it in a separate page.
The folder structure of the project is not final and it will change during the development.
The HTML API documentation is not updated.