SLAA476B February 2011 – July 2019 BQ2040 , BQ2040 , BQ2060A , BQ2060A , BQ2063 , BQ2063 , BQ2083-V1P3 , BQ2083-V1P3 , BQ2084-V143 , BQ2084-V143 , BQ2084-V150 , BQ2084-V150 , BQ2085-V1P3 , BQ2085-V1P3 , BQ20Z40-R1 , BQ20Z40-R1 , BQ20Z70-V160 , BQ20Z70-V160 , BQ20Z80A-V110 , BQ20Z80A-V110 , BQ28400 , BQ28400 , BQ78PL114 , BQ78PL114 , BQ78PL116 , BQ78PL116 , LM5145 , LM5145 , MSP430F5500 , MSP430F5500 , MSP430F5501 , MSP430F5501 , MSP430F5502 , MSP430F5502 , MSP430F5503 , MSP430F5503 , MSP430F5504 , MSP430F5504 , MSP430F5505 , MSP430F5505 , MSP430F5506 , MSP430F5506 , MSP430F5507 , MSP430F5507 , MSP430F5508 , MSP430F5508 , MSP430F5509 , MSP430F5509 , MSP430F5510 , MSP430F5510 , TPS40057 , TPS40057 , TPS40170 , TPS40170
This function initializes the I2C USCI module within the MSP430F5510 for SMBus communication.
Function Definition
void SMBus_Initialize (unsigned char SMBus_Mode) {...}
Inputs
Name | Type | Description | Example Value |
---|---|---|---|
SMBus_Mode | unsigned char | Option to configure the MSP430F5510 in SMBus master or SMBus slave mode. | SMBUS_MASTER_MODE, SMBUS_SLAVE_MODE |
Return
None
Example Function Call
To configure the MSP430F5510 in master mode:
SMBus_Initialize SMBUS_MASTER_MODE);
The function uses a structure to map the MSP430F5510 port pins to the 1-to-2 demux (to prevent SMBus signal collision) and the SMBus clock and data Lines.
Structure Definition Name
SMBusDescription_t
Parameters
Name | Type | Description | Example Value |
---|---|---|---|
PortChanDir | unsigned int | Address of the port direction register connected to the 1-to-2 demux. This register controls the input or output capability of the port. | P4DIR_ADDR |
PortChanOut | unsigned int | Address of the port output register connected to the 1-to-2 demux. This register controls the on or off state of the output. | P4OUT_ADDR |
PortChanBit | unsigned int | Bit of the port connected to the 1-to-2 demux (value can range from 0 to 15) | BIT0, BIT1, ..., BITF |
PortComAddr | unsigned int | Address of the port select register connected to the I2C USCI lines for SMBus. | P6SEL_ADDR |
PortComBitData | unsigned int | Bit of the port connected to the data line of the I2C USCI module (value can range from 0 to 15) | BIT0, ...,BITF |
PortComBitClock | unsigned int | Bit of the port connected to the clock line of the I2C USCI module (value can range from 0 to 15) | BIT0, ...,BITF |
Example Structure Declaration
For the SMBus channel select pin on P4.0 and SMBus communication lines SDA on P4.1 and SCL on P4.2:
// Constant defined in header file
#define SMBUS_DEFAULT_STATE {P4DIR_ADDR, P4OUT_ADDR, BIT8, P4SEL_ADDR, BIT9, BITA}
// Declaration in source code file
SMBusDescription_t SMBus = SMBUS_DEFAULT_STATE;