Overview

This section describes the high level design and functionality of the Micro BLE Stack (uBLE Stack). The uBLE Stack enables applications on the CC23xx to advertise, scan, or behave as a connection monitor.

Constraints and Requirements

The Micro BLE Stack has the following internal constraints and requirements:

  • This design optionally depends on partial integration of ICall to save system resources if there already is an application using ICall in the dual-mode use case. In the case of using the ICall module, ICall’s system heap management and RTOS service abstraction will be used.

  • There is no HCI because there is no separation between the controller and the host.

  • The privacy feature is not supported, but random address generation is supported.

  • To minimize the memory overhead and remove redundant context switching, the Micro BLE Stack doesn’t have a separate RTOS task. It is instead integrated in the application task.

  • The Micro BLE Stack requires the use of the MultiMode RF driver.

  • Devices using only the uBLE Stack can not be Bluetooth ® qualified.

System Architecture

The Micro BLE Stack consists of the Micro Radio Control Layer (RCL) Interface (Micro RCLI or uRCLI), the Micro Link Layer (Micro LL or uLL), and the Micro Generic Access Profile (Micro GAP or uGAP).

The Micro BLE Stack is not designed to run as a separate RTOS task, in order to save memory that would otherwise be required to maintain an additional task. Instead, it is integrated in the application from the RTOS context’s point of view. This way, all application callbacks that originate from RCL and Clock SWIs in the uBLE Stack (and might have lengthy operations such as command completion post processing and error handling) are called in the application task context.

How the Micro BLE Stack is integrated context-wise in the application is illustrated in Figure 106. Note that only the subcomponents directly relevant to the uBLE Stack in the application and the RCL driver are depicted.

alternate text

Figure 106. System Context Diagram

Micro Radio Control Layer (RCL) Interface

The Micro RCLI is primarily used to initialize the Radio and allow Radio commands to be sent. Depending on the features enabled, the uRCLI will define the proper parameter structures for the uLL to reference in order to utilize the RCL driver.

The following RCL commands are used by the uBLE Stack:

  • RCL_CMD_BLE5_ADV : Advertiser command, used by broadcaster

  • RCL_CMD_BLE5_SCANNER_t : Scanner command, used by observer

  • RCL_CMD_BLE5_GENERIC_RX_t : Generic RX command, used by monitor

Micro Generic Access Profile

The Micro GAP sits between the uLL and the application and is mainly responsible for controlling the uLL to set up and run profile roles. The application can indirectly configure the uLL through the uGAP and be notified of events from the uLL through uGAP callbacks. The uGAP needs an RTOS because the clock/timer service is used.

The Micro GAP performs:

  • Initialization and configuration of the uLL

  • State Management within the role

  • Interfacing with the application

  • Broadcaster, observer, and monitor roles

Parameter Management

The Micro GAP maintains the parameters used by the broadcaster, observer, and monitor roles. These parameters are also dependent on the features enabled in the uBLE Stack.

Broadcaster Parameters

These parameters are set by the uGAP through the ugap_bcastStart() and ugap_bcastSetDuty() functions:

  • ugbNumAdvEvent: The number of advertising events to be done before the broadcaster stops its job. This is given when the application starts the broadcaster by calling ug_bcastStart(). If this parameter is set to 0, the broadcaster will not go to the UGAP_BCAST_STATE_INITIALIZED state once started, unless it is requested to stop.

  • ugbDutyOnTime: Time period during which the broadcaster stays in the UGAP_BCAST_STATE_ADVERTISING state. The uLL also stays in the advertising state. When this time period ends, the broadcaster’s state will transition to the UGAP_BCAST_STATE_WAITING state and the uLL will exit the advertising state. A 100-ms time unit is used.

    • This parameter is only effective if Broadcaster Duty Control is enabled. If Broadcaster Duty Control is disabled, transitions to other states from the UGAP_BCAST_STATE_ADVERTISING state are not affected by this parameter.

  • ugbDutyOffTime: Time period during which the broadcaster stays in the UB_BCAST_STATE_WAITING state. The uLL cannot be in the advertising state during this period. When this time period ends, the broadcaster’s state will transition to the UGAP_BCAST_STATE_ADVERTISING state and the uLL will enter the advertising state. A 100-ms time unit is used.

    • This parameter is only effective if Broadcaster Duty Control is enabled. If set to 0, Broadcaster Duty Control is disabled and the broadcaster will not enter the UGAP_BCAST_STATE_WAITING state.

Observer Parameters

These parameters are set by the uGAP through the ugap_scanRequest and ugap_scanSuspend functions:

  • ugoScanOnTime: Time period during which the observer stays in the UGAP_SCAN_STATE_SCANNING state. The uLL also stays in the scanning state. When this time period ends, the observer’s state will transition to the UGAP_SCAN_STATE_WAITING state and the uLL will exit the scanning state. A 100-ms time unit is used.

  • ugoScanOffTime: Time period during which the observer stays in the UGAP_SCAN_STATE_WAITING state. The uLL cannot be in the scanning state during this period. When this time period ends, the observer’s state will transition to the UGAP_SCAN_STATE_SCANNING state and the uLL will enter the scanning state. A 100-ms time unit is used.

  • ugoStatePrev: The observer’s previous state. Used to determine whether the observer should enter the UGAP_SCAN_STATE_WAITING or UGAP_SCAN_STATE_SCANNING state upon leaving the UGAP_SCAN_STATE_SUSPENDED state.

  • ugoScanChanMap: The map of the channels that the observer will request the uLL to scan.

Monitor Parameters

There are not currently any uGAP parameters specific to the monitor role.

Role Management

The uGAP is the main interface to operate in various roles.

There are three distinct roles the uGAP supports:

The application must configure the uGAP to operate in the desired role. This section goes over some specifics of the individual roles.

Broadcaster Role

If the application configures the uGAP to operate in the broadcaster role, the uGAP lets the uLL send advertising events as described in Advertising State.

The broadcaster role has 4 states:

  • UGAP_BCAST_STATE_INITIALIZED: The broadcaster is initialized but has never started. The corresponding state of the uLL can be anything but ULL_STATE_ADVERTISING.

  • UGAP_BCAST_STATE_ADVERTISING: The broadcaster is advertising in this state. The corresponding state of the uLL is ULL_STATE_ADVERTISING. If Broadcaster Duty Control is enabled, the duty timer starts with the duration of ugbDutyOnTime when this state is entered. Then, the state switches to the UGAP_BCAST_STATE_WAITING state when the duty timer expires.

    • If 0 was passed to numAdvEvent when ugap_bcastStart() is called, ugbNumAdvEvent won’t have any effect on this state. Otherwise, the broadcaster’s state will switch to the UGAP_BCAST_STATE_IDLE state once the total number of advertising events since ugap_bcastStart() was called reaches ugbNumAdvEvent, or if requested through ugap_bcastStop().

    • If ugap_bcastSuspend() is called, the broadcaster’s state will switch to the UGAP_BCAST_STATE_SUSPENDED state, putting the duty timer on hold if Broadcaster Duty Control is enabled. The duty timer will resume when the broadcaster’s state switches back to the UGAP_BCAST_STATE_ADVERTISING state.

  • UGAP_BCAST_STATE_WAITING: The broadcaster has started but is not advertising in this state because it is in the ugbDutyOffTime period. The corresponding state of the uLL is ULL_STATE_STANDBY. If Broadcaster Duty Control is enabled, the duty timer starts with the duration of ugbDutyOffTime when this state is entered. Then, the state switches to the UGAP_BCAST_STATE_ADVERTISING state when the duty timer expires.

    • The state switches to the UGAP_BCAST_STATE_IDLE state if requested through ugap_bcastStop(). If ugap_bcastSuspend() is called, the state switches to the UGAP_BCAST_STATE_SUSPENDED state, putting the duty timer on hold if Duty Control is enabled. The duty timer will resume when the broadcaster’s state switches back to the UGAP_BCAST_STATE_WAITING state.

  • UGAP_BCAST_STATE_SUSPENDED: The broadcaster has started but is not advertising in this state. The corresponding state of the uLL can be anything but ULL_STATE_ADVERTISING. The former state shall be recorded when this state is entered. If the suspension is lifted through ugap_bcastResume(), the state will switch back to the former state. The state switches to the UGAP_BCAST_STATE_IDLE if ugap_bcastStop() is called.

alternate text

Figure 107. Broadcaster States

The Bluetooth Core Specifications Version 5.3 doesn’t allow the broadcaster to have Limited Discoverable Mode. However, the uGAP provides a duty control means similar to Limited Discoverable Mode to save power consumption. The duty control can be implemented with timers based on ugbDutyOnTime and ugbDutyOffTime, explained in Parameter Management. The broadcaster’s advertising state corresponds to the uLL’s advertising state.

The typical life cycle of the broadcasting function encompassing the application down to the uLL is illustrated in Figure 108.

alternate text

Figure 108. Life Cycle of Broadcaster Function

Observer Role

If the application configures the uGAP to operate in the observer role, the uGAP lets the uLL scan for advertising events as described in Scanning State.

The observer role has 4 states:

  • UGAP_SCAN_STATE_INITIALIZED: The observer is initialized but has never started. The corresponding state of the uLL can be anything but ULL_STATE_SCANNING.

  • UGAP_SCAN_STATE_SCANNING: The observer is scanning in this state. The corresponding state of the uLL is ULL_STATE_SCANNING. The duty timer starts with the duration of ugoScanOnTime when this state is entered. Then, the state switches to the UGAP_SCAN_STATE_WAITING state when the duty timer expires.

    • Only one channel will be scanned during this state, determined by the value of ugoScanChanMap when this state is entered. The observer will update ugoScanChanMap so that a new channel will be scanned the next time this state is entered, if possible.

    • The state switches to the UGAP_SCAN_STATE_IDLE state if requested through ugap_scanStop(). If ugap_scanSuspend() is called, the observer’s state will switch to the UGAP_SCAN_STATE_SUSPENDED state, putting the duty timer on hold. The duty timer will resume when the observer’s state switches back to the UGAP_SCAN_STATE_SCANNING state.

  • UGAP_SCAN_STATE_WAITING: The observer has started but is not scanning in this state because it is in the ugoScanOffTime period. The corresponding state of the uLL is ULL_STATE_STANDBY. The duty timer starts with the duration of ugoScanOffTime when this state is entered. Then, the state switches to the UGAP_SCAN_STATE_SCANNING state when the duty timer expires.

    • The state switches to the UGAP_SCAN_STATE_IDLE state if requested through ugap_scanStop(). If ugap_scanSuspend() is called, the state switches to the UGAP_SCAN_STATE_SUSPENDED state, putting the duty timer on hold. The duty timer will resume when the observer’s state switches back to the UGAP_SCAN_STATE_WAITING state.

  • UGAP_SCAN_STATE_SUSPENDED: The observer has started but is not advertising in this state. The corresponding state of the uLL can be anything but ULL_STATE_ADVERTISING. The former state shall be recorded when this state is entered. If the suspension is lifted through ugap_bcastResume(), the state will switch back to the former state. The state switches to the UGAP_BCAST_STATE_IDLE if ugap_bcastStop() is called.

Monitor Role

The monitor role is not defined by the Bluetooth Core Specifications Version 5.3. This section is to describe how the uGAP operates when using the monitor feature.

Warning

This role is should only be used as stand alone condition only, which means no other uBLE Stack feature should be used in conjunction.

The monitor role is designed to follow an active BLE connection. It requires knowledge of the connection information, such as access address, hop increment, and connection interval. The monitor role uses this information to set up the uGAP and uBLE Stack.

The monitor role has 3 States:

  • UGAP_MONITOR_STATE_INITIALIZED: The monitor is initialized but is not monitoring.

  • UGAP_MONITOR_STATE_IDLE: The monitor is not monitoring in this state. The corresponding state of the uLL is ULL_STATE_STANDBY.

  • UGAP_MONITOR_STATE_MONITORING: The monitor is scanning. The corresponding state of the uLL is ULL_STATE_MONITORING.

When a packet is detected during a scan of the connection specified by the provided connection parameters, a UGAP_MONITOR_EVT_MONITOR_INDICATION event is generated.

When a scan is complete, a UGAP_MONITOR_EVT_MONITOR_COMPLETE event is generated. If there are pending scans, the uGAP will start the next scheduled scan.

Each time the monitor switches states, a UGAP_MONITOR_EVT_STATE_CHANGE event is generated.

For more information regarding the monitor role and its application, please refer to the Connection Monitor (CM) Application section.