cancel
Showing results for 
Search instead for 
Did you mean: 

X-Cube-SMBUS: How to integrate into project using CubeMx

Shreeyak Sajjan
Associate
Posted on March 13, 2017 at 15:08

Hi,

I need to use SMBus in a project and have come across the X-Cube-SMBus. There are no details given as to how to use CubeMX to integrate this library into my project. I use CubeMX in all my projects.

Can someone tell the appropriate steps/settings to be done in CubeMX to correctly use this library. Also, how to use this library, do I add all the files into my project as source files and I'm done?

I'm using an STM32F302r8-NUCLEO dev board on a windows machine.

#f3 #stm32f3 #smbus
4 REPLIES 4
Nesrine M_O
Lead II
Posted on March 13, 2017 at 17:18

Hi

shreeyak

,

Your request is forwarded to our MX team forchecking .

-Nesrine-

Posted on March 13, 2017 at 21:45

Alright! Thanks! Hope to get a reply soon!!

Mike Panetta
Associate II
Posted on October 06, 2017 at 01:03

I'm also having issues using this library.  I have tried to set it up similarly to the example in the STM32F072B-Discovery project in the x-cube-smbus Projects but I can't get anything out of the system.

Here is my initialization code:

/* USER CODE BEGIN 2 */

//HAL_SMBUS_EnableListen_IT(&hsmbus1);

hsmbus1.pBuffPtr = context.Buffer;

context.CMD_table = COMMANDS_TAB;

context.CMD_tableSize = 2; //COMMANDS_TAB_SIZE;

context.Device = &hsmbus1;

context.SRByte = 0x55;

context.CurrentCommand = NULL;

context.StateMachine = SMBUS_SMS_ARP_AR;

context.OwnAddress = 0x10;

STACK_SMBUS_Init(&context);

piobuf = STACK_SMBUS_GetBuffer( &context );

if (piobuf != NULL )

{

HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, 1);

for (int index = 0; index < STACK_NBYTE_SIZE; index++)

{

piobuf[index] = 0;

}

}

But I get nothing when I try to do an SMBUS read with command.  I see the address phase go out on the smbus,  but the device never gets the command byte, I think the device may be stretching the clock during the ACK phase and never acking.

Are there any simple examples on how to get this library working?  With just a few simple commands implemented, as an SMBUS Slave?

Thanks!

Mike

Jeanne Joly
Senior III
Posted on January 16, 2018 at 09:42

Hi

Sajjan.Shreeyak

and

mike.panetta

,

You can find some examples under STM32Cube\Repository\STM32Cube_FW_F3_V1.8.0\Projects\STM32303C_EVAL\Examples\SMBUS.

And to help you, you can read those threads :

I hope it will help you.

BR. Jeanne