STM32CubeWBA: System modules

Revision as of 06:48, 31 March 2023 by Registered User

1 Introduction

This page regroups the wiki pages dedicated to the STM32WBA systems modules. They provide information on concepts, how to use the modules, plus a full description of their APIs.

2 System modules

Below some system modules available on STM32WBA microcontrollers:

  • Memory management (dynamic allocation manager on a static pool, such as allocation or free)
  • Flash management (Interfaces and tools to execute flash operations, such as write or erase)
  • Real-time debugging (configuration and management of GPIOs for debug purposes)
  • System clock manager (management of clock frequency to select the best suitable frequency at the right time)
  • Low-power management (such as Interfaces for managing power modes)
  • Trace management (low-impact trace manager API)

3 Background process

Some system modules are based on the request/callback mechanism: the user requests an operation to the module, and she/he is notified later of the result, since the operation is not executed at user call but later.
This is made possible thanks to the background process method. The user call is used to check the feasibility of the operation, and the operation is executed by the BackgroundProcess function in a different context.

The typical workflow is the following:

  • The user request is analyzed and registered (it can be a request to check a parameter, a state, or a context). An error code about the result of the request is returned to the user.
  • The system module requests the future execution of its BackgroundProcess function to the scheduler. This function is in charge of processing the real user operation.
  • The scheduler sets the system BackgroundProcess function to active. Once the operation is complete, the system module notifies the user using the callback.

The workflow can be represented as follows:

Background process use case
Connectivity Background Process.png

3.1 User steps

The ProcessRequest function is defined in the module but its implementation must be performed by the user. For the background process mechanism to operate correctly, follow the setup sequence described below. The role of the ProcessRequest function is always to schedule the BackgroundProcess function. However, it needs to be adapted to your operating system requirements and specificities. Furthermore, the BackgroundProcess function might need to be registered in your OS for scheduling purposes.

Follow the setup steps below:

  1. Register the background function in the OS.
  2. Implement the ProcessRequest function to schedule the background function.


Info white.png Information
An example of this setup sequence is provided in the How to section

3.2 How to

The following example explains how to set up the background process as a user. It can be applied to any module relying on a background process mechanism.
This example shows how to set up the advanced memory manager (AMM) module in a project relying on the sequencer.

First register the BackgroundProcess function of your system module for future scheduling
/* Register the AMM background task */
UTIL_SEQ_RegTask( 1U << CFG_TASK_AMM_BCKGND, UTIL_SEQ_RFU, AMM_BackgroundProcess);
Then implement the ProcessRequest function
Once the registering of the background function is done, implement the ProcessRequest function. As explained above, this function schedules the background function so that the operation can be executed:
void AMM_ProcessRequest (void)
{
  /* Request AMM background task scheduling */
  UTIL_SEQ_SetTask(1U << CFG_TASK_AMM_BCKGND, CFG_SCH_PRIO_0);
}
Set up and initialize the module
When these two steps are complete, set up and initialize the memory manager module.
An example of AMM initialization can be found here.