HAL SMBUS Overview

Introducing SMBUS

group SMBUS_Introduction

  • The SMBUS hardware abstraction layer provides a set of APIs to interface with the STM32 SMBUS (System management bus) peripheral.

  • It simplifies the configuration, initialization and management of I2C communication, by supporting various modes such as polling and interrupt for data transfer.

  • This peripheral is compatible with the SMBUS specification version 3.0.

  • This abstraction layer ensures portability and ease of use across different STM32 series.

Module and files

The following diagram illustrates the SMBUS module and its associated files.

Module and files diagram

Component diagram

The following diagram illustrates the software components involved in the SMBUS module. It shows the interactions between the user application, HAL drivers, low-level drivers, and the hardware components.

@startuml
<style>
componentDiagram {
   arrow {
      FontSize 8
   }
}
</style>

title SMBUS Software Component Diagram

package "HAL" {
    [HAL_SERVICE]
    [HAL_SMBUS]
}

package "Low Layer" {
    [LL_I2C]
    [CMSIS]
    [SMBUS Interrupt routine service]
}

package "HW" {
    [STM32_HW]
}

[Appli] --> [HAL_SMBUS] : HAL SMBUS API
[Appli] <-- [HAL_SMBUS] : SMBUS callback
[HAL_SMBUS] --> [LL_I2C] : LL I2C API
[HAL_SMBUS] -l-> [HAL_SERVICE] : HAL_GetTick
[HAL_SMBUS] <-- [SMBUS Interrupt routine service]
[LL_I2C] --> [CMSIS]:SMBUS register def
[STM32_HW] -u--> [SMBUS Interrupt routine service]: SMBUSx Irq
[STM32_HW] <-u-- [LL_I2C] : I2C registers R/W
@enduml

Configuration table

The following table lists the configuration defines for the HAL SMBUS module, specifying their locations, default values, and descriptions:

group SMBUS_Configuration_Table

  1. Configuration inside the SMBUS driver

Software configuration defined in stm32c5xx_hal_conf.h:

Preprocessor flags

Default value

Comment

USE_HAL_SMBUS_MODULE

1

Enable HAL SMBUS driver module

USE_HAL_SMBUS_REGISTER_CALLBACKS

0

Allow the user to define their own callback

USE_HAL_CHECK_PARAM

0

Enable runtime parameter check

USE_HAL_SMBUS_CLK_ENABLE_MODEL

HAL_CLK_ENABLE_NO

Enable the gating of the peripheral clock

USE_HAL_CHECK_PROCESS_STATE

0

Enable atomicity of process state check

USE_HAL_MUTEX

0

Enable semaphore creation for OS

USE_HAL_SMBUS_USER_DATA

0

Add a user data inside HAL SMBUS handle

USE_HAL_SMBUS_GET_LAST_ERRORS

0

Enable retrieval of last processes error codes

Software configuration defined in preprocessor environment:

Preprocessor flags

Default value

Comment

USE_ASSERT_DBG_PARAM

Not defined

Enable check param for HAL and LL

USE_ASSERT_DBG_STATE

Not defined

Enable check state for HAL