The System Management Bus (SMBus) is a single-ended simple two-wire bus for lightweight communication. The MSP430 SMBus Library is a royalty-free set of primitives for enabling communication with external devices supporting SMBus like battery chargers, sensors etc.
SMBus Library
The SMBus I/O interface is a two-wire, bi-directional serial bus. The System Management Bus is compatible with the I2C serial bus.
Micropython Smbus Library
SMBus module is available with a number of Silicon Laboratories 8051 MCU models. mikroC PRO for 8051 provides library which supports the master SMBus mode.
- SMBus is used as a communication link for smart batteries, power-related devices, and a wide variety of other system devices. The MSP430™ SMBus Library is a royalty-free set of API's that provide support for master and slave protocols in a SMBus communication system.
- The Power Management Bus (PMBus) is an open standard power-management protocol with fully defined commands that support communication with power converters and other digital power-management devices and host processors in a power system. The protocol is implemented over the industry-standard SMBus serial interface and enables programming.
Library Routines
SMBus1_Init
Prototype | void SMBus1_Init(unsigned long clock); |
---|---|
Returns | Nothing. |
Description | Initializes SMBus with desired |
Requires | Library requires SMBus module. |
Example |
SMBus1_Start
Prototype | char SMBus1_Start(); |
---|---|
Returns | If there is no error function returns 0, otherwise returns 1. |
Description | Determines if SMBus bus is free and issues START signal. |
Requires | SMBus must be configured before using this function. See SMBus1_Init. |
Example |
SMBus1_Repeated_Start
Prototype | void SMBus1_Repeated_Start(void); |
---|---|
Returns | Nothing. |
Description | Issues repeated START signal. |
Requires | SMBus must be configured before using this function. See SMBus1_Init. |
Example |
SMBus1_Busy
Prototype | char SMBus1_Busy(); |
---|---|
Returns | Returns 0 if SMBus start sequence is finished, 1 if SMBus start sequence is not finished. |
Description | Signalizes the status of SMBus bus. |
Requires | SMBus must be configured before using this function. See SMBus1_Init. |
Example |
SMBus1_Read
Prototype | char SMBus1_Read(char nack); |
---|---|
Returns | Returns one byte from the slave. |
Description | Reads one byte from the slave, and sends acknowledge signal if parameter |
Requires | SMBus must be configured before using this function. See SMBus1_Init. Also, START signal needs to be issued in order to use this function. See SMBus1_Start. |
Example | Read data and send not acknowledge signal: |
SMBus1_Write
Prototype | void SMBus1_Write(char data_); |
---|---|
Returns | Nothing. |
Description | Sends data byte (parameter |
Requires | SMBus must be configured before using this function. See SMBus1_Init. Also, START signal needs to be issued in order to use this function. See SMBus1_Start. |
Example |
SMBus1_Status
Prototype | char SMBus1_Status(); |
---|---|
Returns | Returns value of status register. |
Description | Returns status of SMBus. |
Requires | SMBus must be configured before using this function. See SMBus1_Init. |
Example |
SMBus1_Stop
Prototype | void SMBus1_Stop(); |
---|---|
Returns | Nothing. |
Description | Issues STOP signal to SMBus operation. |
Requires | SMBus must be configured before using this function. See SMBus1_Init. |
Example |
SMBus1_Close
Prototype | void SMBus1_Close(); |
---|---|
Returns | Nothing. |
Description | Closes SMBus connection. |
Requires | SMBus must be configured before using this function. See SMBus1_Init. |
Example |
Library Example
This code demonstrates use of SMBus Library procedures and functions. 8051 MCU is connected (SCL, SDA pins ) to 24c02 EEPROM. Program sends data to EEPROM (data is written at address 2). Then, we read data via SMBus from EEPROM and send its value to PORTA, to check if the cycle was successful. Check the figure below.
HW Connection
Interfacing 24c02 to 8051 via SMBus
What do you think about this topic ? Send us feedback!
This document describes the implementation of the system management bus (SMBus) using the MSP430™ microcontroller I2C peripheral. SMBus is used as a communication link for smart batteries, power-related devices, and a wide variety of other system devices.
The MSP430™ SMBus Library is a royalty-free set of API's that provide support for master and slave protocols in a SMBus communication system.
This API document is broken out into the following sections:
- Modules Tab
- Application API layer, a list of the public API's designed to be called by user applications.
- Network layer, the functions that implement and manage the internal SMBus state. User applications should not call functions in this layer.
- Phyical layer, the functions that implement the device dependent calls to the microcontroller. User applications should not call functions in this layer. User application should not call functions in this layer.
- Data Structures Tab
- Data Structures, a list of data structures defined by MSP430™ SMBus Library
- Data Fields, a list of fields available in the data structures
- Files Tab
- File List, an alphabetical list of API's avaialable in MSP430™ SMBus Library
- Globals, an alphabetical list of MSP430™ SMBus Library global definitions
- Related Pages Tab
- Legal disclaimer*
Also note the existence of the following content available on disk. This is not part of this API but contains useful example code and documentation.
Python Smbus Library
- Example Code
- under examples/driverlib/MSP430G2xx3/{peripheral}
- Users Guide
- doc/driverlib/MSP430G2xx3/MSP430G2xx3_DriverLib_Users_Guide-1.10.00.00.pdf