# thienan2050/bluetooth-low-energy-fundamentals architecture

> Architecture diagram of the GitHub repository thienan2050/bluetooth-low-energy-fundamentals, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thienan2050/bluetooth-low-energy-fundamentals
- Repository: https://github.com/thienan2050/bluetooth-low-energy-fundamentals

## Overview

##### Project type and purpose
- This is not a web‐app or microservice suite but a collection of embedded C firmware examples and solutions for a Bluetooth Low Energy (BLE) fundamentals course.
- It uses the Zephyr RTOS and the Nordic nRF Connect SDK to build BLE prototypes on Nordic Semiconductor hardware (nRF52, nRF53, nRF54 boards).
- Each “li/li_ej” directory is a standalone exercise (“ej”) or its solution (“_sol”), containing a CMake build description, Zephyr Kconfig, board overlays, a project config (prj.conf), a sample.yaml (for flashing/debugging), and a main.c (and sometimes additional modules like my_lbs.c/h).

##### File‐structure analysis
- Top‐level directories: l2, l3, l4, l5, l6 – correspond to “Level 2” through “Level 6” of the course.
- Under each level: “l?_eX” = exercise X; “l?_eX_sol” = solution.
- Common files per example:
- CMakeLists.txt – Zephyr/CMake build entry
- Kconfig.sysbuild (and sometimes Kconfig) – build‐time configuration
- boards/…conf & .overlay – hardware‐specific pin/radio settings
- prj.conf – Zephyr/BT stack runtime settings (e.g., advertisement interval, connection parameters)
- sample.yaml – nRF Connect tooling config for flashing & logging
- src/main.c (+ optional service modules like my_lbs.c/h) – application logic
- Some complex exercises (e.g., l3_e2, l6_e2, l4_e3) introduce multi-image builds for multi-core parts of the SoC (network core vs app core) and use rpmsg/HCI IPC, sysbuild, and child_image directories.

##### README insights
- The repo backs a self-paced BLE course.
- Goals: hands-on with BLE advertisement, connection, GATT services, security, packet sniffing.
- Uses Nordic hardware and Zephyr‐based nRF Connect SDK.
- Each exercise is meant to be built and run on two boards to form a unidirectional or bidirectional BLE link.

##### Final advice
- Be exhaustive but clear: break the system into Build, Firmware, Hardware, Wireless, Tools.
- Zephyr modules (Bluetooth Host/Controller) and any multi-core IPC.
- This level of detail will give course participants and maintainers a crystal‐clear view of how an example is built, deployed, and runs over BLE.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer Workstation and Build System
    subgraph "Developer Workstation" 
        DevTools["CMake + Zephyr SDK + Kconfig"]:::build
    end
    DevTools -->|"cmake build"| Firmware["Firmware Binary (.hex/.bin)"]:::build
    click DevTools "https://github.com/thienan2050/bluetooth-low-energy-fundamentals/blob/main/l2/l2_e1/CMakeLists.txt"

    %% Flash & Debug Tooling
    Firmware -->|"flash (sample.yaml)"| BoardA["Board A (nRF5340)"]:::hw
    click Firmware "https://github.com/thienan2050/bluetooth-low-energy-fundamentals/blob/main/l2/l2_e1/sample.yaml"

    %% Board A internal components (multi-core example)
    subgraph "Board A (nRF5340)" 
        direction TB
        subgraph "Application Core" 
            direction TB
            AppMain["src/main.c"]:::sw
            AppLBS["src/my_lbs.c/h"]:::sw
        end
        subgraph "Network Core" 
            direction TB
            BTController["Bluetooth Controller (Host & Controller)"]:::sw
        end
        AppMain -->|"rpmsg/HCI IPC"| BTController
        click AppMain "https://github.com/thienan2050/bluetooth-low-energy-fundamentals/blob/main/l4/l4_e3/src/main.c"
        click AppLBS "https://github.com/thienan2050/bluetooth-low-energy-fundamentals/blob/main/l4/l4_e3/src/my_lbs.c"
        click BTController "https://github.com/thienan2050/bluetooth-low-energy-fundamentals/blob/main/l3/l3_e2/child_image/hci_ipc.conf"
        click BTController "https://github.com/thienan2050/bluetooth-low-energy-fundamentals/blob/main/l3/l3_e2/child_image/hci_rpmsg.conf"
        click BTController "https://github.com/thienan2050/bluetooth-low-energy-fundamentals/blob/main/l4/l4_e3/sysbuild/ipc_radio.conf"
        click BTController "https://github.com/thienan2050/bluetooth-low-energy-fundamentals/blob/main/l4/l4_e3/sysbuild_bt_rpc.conf"
        click AppMain "https://github.com/thienan2050/bluetooth-low-energy-fundamentals/blob/main/l4/l4_e3/app.overlay"
        click AppMain "https://github.com/thienan2050/bluetooth-low-energy-fundamentals/blob/main/l4/l4_e3/usb.overlay"
        click AppMain "https://github.com/thienan2050/bluetooth-low-energy-fundamentals/tree/main/l4/l4_e3/Kconfig"
        click AppMain "https://github.com/thienan2050/bluetooth-low-energy-fundamentals/blob/main/l4/l4_e3/Kconfig.sysbuild"
    end

    %% Board B mirror of Board A
    Firmware -->|"flash (sample.yaml)"| BoardB["Board B (nRF5340)"]:::hw
    subgraph "Board B (nRF5340)" 
        direction TB
        subgraph "Application Core" 
            direction TB
            BAppMain["src/main.c"]:::sw
        end
        subgraph "Network Core" 
            direction TB
            BBTController["Bluetooth Controller"]:::sw
        end
        BAppMain -->|"rpmsg/HCI IPC"| BBTController
        click BAppMain "https://github.com/thienan2050/bluetooth-low-energy-fundamentals/blob/main/l4/l4_e3_sol/src/main.c"
        click BBTController "https://github.com/thienan2050/bluetooth-low-energy-fundamentals/blob/main/l4/l4_e3_sol/child_image/hci_ipc.conf"
        click BBTController "https://github.com/thienan2050/bluetooth-low-energy-fundamentals/blob/main/l4/l4_e3_sol/child_image/hci_rpmsg.conf"
        click BBTController "https://github.com/thienan2050/bluetooth-low-energy-fundamentals/blob/main/l4/l4_e3_sol/sysbuild/ipc_radio.conf"
        click BAppMain "https://github.com/thienan2050/bluetooth-low-energy-fundamentals/blob/main/l4/l4_e3_sol/app.overlay"
        click BAppMain "https://github.com/thienan2050/bluetooth-low-energy-fundamentals/blob/main/l4/l4_e3_sol/usb.overlay"
        click BAppMain "https://github.com/thienan2050/bluetooth-low-energy-fundamentals/tree/main/l4/l4_e3_sol/Kconfig"
        click BAppMain "https://github.com/thienan2050/bluetooth-low-energy-fundamentals/blob/main/l4/l4_e3_sol/Kconfig.sysbuild"
    end

    %% Wireless Link
    BoardA <-->|"BLE Link"| BoardB:::wireless

    %% PC Tools and Logging
    subgraph "External Tools" 
        direction TB
        PC["nRF Connect Desktop & Sniffer"]:::tool
    end
    BoardA -->|"UART/RTT logging"| PC
    BoardB -->|"UART/RTT logging"| PC

    %% Styles
    classDef build fill:#D6EAF8,stroke:#1F618D,color:#1F618D;
    classDef sw fill:#D5F5E3,stroke:#196F3D,color:#196F3D;
    classDef hw fill:#F2F3F4,stroke:#7B7D7D,color:#7B7D7D;
    classDef wireless fill:#FDEBD0,stroke:#B9770E,color:#B9770E;
    classDef tool fill:#FCF3CF,stroke:#B7950B,color:#B7950B;
```
