2016-11-14 10:54 PM
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 #smbus2016-11-15 05:34 AM
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.forum2017-02-21 08:37 AM
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
2017-02-21 09:12 AM
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
2017-05-10 08:12 AM
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
2017-05-10 11:23 AM
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
2017-05-18 05:12 AM
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
2017-05-26 06:25 AM
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
2017-07-20 02:23 AM
May be it is help us:
2017-09-15 12:27 PM
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