STM32CubeWBA: System Modules

Revision as of 16:39, 15 March 2023 by Registered User

1. Introduction

This page regroups the different wiki pages dedicated to STM32WBA systems modules. You will find information about their concepts, how to use them and their APIs.

2. System Modules

Here is the list of some system modules available on STM32WBA:

  • Memory Management (Dynamic allocation manager on static pool, i.e.: Allocation, Free, etc.)
  • Flash Management (Interfaces and tools to execute flash operations, i.e.: Write, erase, etc.)
  • Real Time Debug (Configuration and management of GPIO for debug purposes)
  • System Clock Manager (Manager of clock frequency to set the best suitable frequency at the right time)
  • Low Power Management (Interfaces for management of power modes, etc.)
  • Trace Management (Trace manager API with low impact)

3. Background process

Some system modules are based upon a request/callback mechanism. This means that the user request an operation to the module and he is notified later on the result. The operation is not executed at user call but later.
This is possible due to the "Background process" method. The user call is here to check the feasibility of the operations and - in a different context - the operation is realized by the background process function.

The typical work flow is like this:

  • The user request is analyzed - i.e.: Parameters check, states check, context check, etc.- and registered. An error code is returned to the user about the result of the request.
  • The system module requests the scheduler for a future execution of its "Background Process" function. This function is in charge of the process of the concrete user operation.
  • The scheduler set active the system "Background Process" function. Once the operation is achieved, the system module notifies the user with his callback.

And it can be represented as follow:

Background process use case

3.1. User steps

Still, for this machinery to work, the user shall proceed to some steps.
Indeed, the "ProcessRequest" function is defined in the module but its implementation is missing and shall be achieved by the user. The content of this function will always be the same: Scheduling of the Background process function. However, you will have to adapt it to your operating system needs and specifies. Furthermore, do not forget to register the Background process function to your OS if needed for scheduling purposes.

Sum up
  • Register the Background function in the OS
  • Implement the Process request function to schedule the background function


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

3.2. How to

The following example explain how to setup the Background Process as a user. This can be applied to any module relying on a background process method.
This example deals with the advanced memory manager (AMM) module setup in a project relying on the sequencer.

Register the Background process function
The first thing before any use is to register the background process function of our system module:
/* Register the AMM background task */
UTIL_SEQ_RegTask( 1U << CFG_TASK_AMM_BCKGND, UTIL_SEQ_RFU, AMM_BackgroundProcess);
This way the background process function is registered for future scheduling.
Implement the Process request function
Once register of the background function is done, you shall implement the process request function. As said above, this function has to schedule the background function so the operation can be executed:
void AMM_ProcessRequest (void)
{
  /* Ask for AMM background task scheduling */
  UTIL_SEQ_SetTask(1U << CFG_TASK_AMM_BCKGND, CFG_SCH_PRIO_0);
}
Setup and initialize the module
After these two steps, you can now setup and initialize the memory manager module.
An example of AMM initialization can be found here.