Sugestions for a project around FreeRTOS and BLE

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!

I have something like what you’re describing running on one of these: PSoC® 6-BLE Pioneer Kit (CY8CKIT-062-BLE) . It comes with an e-ink display (and emWin), and if you use PRoC Creator, FreeRTOS is built in. I added some SD cards for data logging: GitHub - carlk3/FreeRTOS-FAT-CLI-for-PSoC-63: FAT filesystem on SD card in an AdaLogger Shield ( https://www.adafruit.com/product/1141 ) (https://learn.adafruit.com/adafruit-data-logger-shield/overview ) on a PSoC® 6 BLE Pioneer Kit (CY8CKIT-062-BLE) (https://www.cypress.com/documentation/development-kitsboards/psoc-6-ble-pioneer-kit-cy8ckit-062-ble ).

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

No problem.

Data acquisition task loop:

  1. xTaskDelayUntil expires
  2. Data acquisition runs
  3. Places samples into a global buffer.
  4. xQueueSendToBack notifications on queues to:
  • the three SD card managers
  • the BLE task
  • the User Interface task
  1. Back to xTaskDelayUntil

SD card manager task:

  1. xQueueReceives notification, dispatches to handler for current state (not detected, mounted, failed)
  2. Assuming card state is mounted, dispatch to appropriate log file state machine (states: open, closed, stopped)
  3. Assuming open state, read global buffer, format record and ff_printf to log file.
  4. Back to xQueueReceive
1 Like