cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F429 SMBus Implementation

abreiteneder9
Associate
Posted on November 15, 2016 at 07:54

Dear all,

for a project I have to implement a SMBus communication with a battery. I already found the X-CUBE-SMBUS Software but it seems that it is only compatible with F0 and F3 Controllers. I also saw that these controllers include SMBus HAL drivers. My question is now if it is possible to port those libraries to the STM32F4 and which changes are necessry.

Greetings

#stm32f4 #smbus
19 REPLIES 19
Imen.D
ST Employee
Posted on November 15, 2016 at 14:34

Dear User,

The SMBus stack is not supported by STM32F4 HAL drivers.

The request is already raised internally to our development team.

We apologize for any inconvenience this may have caused you and we appreciate your understanding.

Best Regards

STM32.forum

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on February 21, 2017 at 16:37

hello,

I am interested in the same HAL driver. Do you have any update? Is it now available - even in beta?

warm regards,

Agnès CD

Posted on February 21, 2017 at 17:12

Hello

Cassin_Delaurier

‌,

Thanks for your interesting.

The SMBus for STM32F4 is not yet available. Your request is under investigation and

will be implemented in coming releases.

Best Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on May 10, 2017 at 15:12

Hi Imen D,

I want to use the SMBus library written by MCD team. Could you help me out with some example code, can be just communication between two STM devices.

Waiting for your reply...!!!

Thanks

Nikhil

Posted on May 10, 2017 at 18:23

Hi

Ingale.Nikhil

,

Refer to the

SMBUS

example within Cube firmware package as:

STM32Cube_FW_L0_V1.9.0\Projects\STM32L073Z_EVAL\Examples\SMBUS

STM32Cube_FW_F3_V1.8.0\Projects\STM32303E_EVAL\Examples\SMBUS

STM32Cube_FW_F0_V1.7.0\Projects\STM32091C_EVAL\Examples\SMBUS

The example shows how to ensure SMBUS Data buffer transmission and reception with IT.

Regards

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
Posted on May 18, 2017 at 12:12

Hi Imen D,

Thanks for sharing the above links for SMBUS examples. I was trying to implement SMBUS communication protocol between 2 STM32L4 devices.

It is working fine with the SMBUS HAL layer provided in STM32Cube_FW_L4_V1.6.0....

Thanks a lot for your help...:-)

Regards,

Nikhil 

Posted on May 26, 2017 at 13:25

   Hello Imen,

   I am trying to do SMBus communication between STM32L4 and STM32F103.

   I have HAL drivers for L4 and Std_Peripheral_Lib for F1. 

   I have configured F1 as master and L4 as slave and F1 is sending one byte to L4. 

F1 send data snippet:

I2C_GenerateSTART(SMBUS_PORT, ENABLE);

while ((!I2C_CheckEvent(SMBUS_PORT, I2C_EVENT_MASTER_MODE_SELECT)) && Timeout-- > 0);

I2C_Send7bitAddress(SMBUS_PORT, Device_Address, I2C_Direction_Transmitter);

Timeout = MAX_TIMEOUT;

while ((!I2C_CheckEvent(SMBUS_PORT, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED)) && Timeout-- > 0);

for (Index = 0; Index < Size; Index++)

{

I2C_SendData(SMBUS_PORT, TxBuffer[Index]);

Timeout = MAX_TIMEOUT;

while ((!I2C_CheckEvent(SMBUS_PORT, I2C_EVENT_MASTER_BYTE_TRANSMITTED)) && Timeout-- > 0);

}

I2C_GenerateSTOP(SMBUS_PORT, ENABLE);

L4 code snippet:

In main loop i have called HAL_SMBUS_EnableListen_IT(&SMBus_Handle) just before while loop and rest is handled in interrupts.

void HAL_SMBUS_AddrCallback(SMBUS_HandleTypeDef *hsmbus, uint8_t TransferDirection, uint16_t AddrMatchCode)

{

AddrMatchCode = AddrMatchCode << 1;

if(AddrMatchCode == (uint16_t)SLAVE_DEVICE_ADDRESS)

{

if(TransferDirection == 0)

{

HAL_SMBUS_Slave_Receive_IT(hsmbus, Rx_Data, 1, SMBUS_AUTOEND_MODE);

}

else

{

HAL_SMBUS_Slave_Transmit_IT(&SMBus_Handle,Tx_Data,2,SMBUS_FIRST_AND_LAST_FRAME_NO_PEC);

}

}

}

I could debug for address and its fine but now able to receive the data sent by master. Tried with 2 bytes too.

Everything is done as simple I2C handshake.

Let me know if something is wrong with this code.

Regards,

Nikhil

Igor Tabachnik
Associate II
Posted on July 20, 2017 at 11:23

May be it is help us: 

https://github.com/Selat/stm32-smbus

 
Posted on September 15, 2017 at 19:27

Dear ST,

Can you please update the comunicaty about the progress on the SMBus support in the F4 family?

We chose F4 family for our product and only now realised that HAL does not support SMBus, which is quite a big pain. I will appreciate any information.

Kind regards,

 Przemek