So I am planning on initiating a project that involves FreeRTOS, preferably BLE and some sensors and looking for some suggestions.
I got inspired by the PineTime project and wondering if I could achieve something similar (with fewer features but the same generic idea) though I’m still a bit unclear on their usage of FreeRTOS.
Currently what I have in mind is hooking up different sensors to nRF52DK board, connecting the phone app over BLE, and initiating requests i.e sensor data which could then serviced by the application and sent over to the phone app which would then display the data, but I feel this idea alone doesn’t justify FreeRTOS’ usage.
Perhaps another (better?) idea could be to hook up an LCD to nRF52, and have a separate LoggerTask perhaps that takes care of the data being printed to the screen and the other task will take care of reading, and sending data over to the phone app over BLE.
Does the second option sound feasible/decent? Is there anything else I should consider to make things more interesting?
Any response shall be appreciated!
thanks for the response. Do you happen to have any video demonstrating the functionality? Is it taking in user input over CLI (I see you’re using FreeRTOS CLI) in a separate thread and servicing in a different thread?
Unfortunately, none that I can share.
The GitHub project is actually a spin-off from a “real” project that uses a different (LCD) display and has several tasks:
- Two data collection tasks
- Three data logging tasks, one for each of three SD cards
- One User Interface task (there is a UI consisting of LCD and keypad)
- One BLE task
- One UART task (to support a terminal for development)
The general architecture is a set of communicating state machines each consisting of a task with an event loop. The event loop is fed by a FreeRTOS Queue in most cases; periodic in the case of the data collection tasks; waiting for an interrupt notification in the UART case.
Right on. From a high level, would you mind describing a general flow while a request to writing to SD card #1 is received, for instance? This hopefully gives a better idea to me how FreeRTOS is being used
Data acquisition task loop:
- Data acquisition runs
- Places samples into a global buffer.
xQueueSendToBack notifications on queues to:
- the three SD card managers
- the BLE task
- the User Interface task
- Back to xTaskDelayUntil
SD card manager task:
xQueueReceives notification, dispatches to handler for current state (not detected, mounted, failed)
- Assuming card state is mounted, dispatch to appropriate log file state machine (states: open, closed, stopped)
- Assuming open state, read global buffer, format record and
ff_printf to log file.
- Back to