cancel
Showing results for 
Search instead for 
Did you mean: 

SMBUS/PMBUS V2 (AN4502) integrated to CubeMX HAL problem

loffan bertilsson
Associate II
Posted on June 17, 2017 at 11:36

Hi, I need help with using the SMBUS/PMBUS V2 library with STM32 Cube HAL,

https://my.st.com/content/my_st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-expansion-software/x-cube-smbus.license%3d1497686538860.html

Whaterver I do I get the error: ..\Middlewares\ST\STM32_SMBus_Stack\inc\stm32_PMBUS_stack.h(410): error: &sharp20: identifier 'HAL_StatusTypeDef' is undefined

Even when I include the stm32f0xx_hal.h file in the Keil projec.

It can find it ok when i right click and 'go to definition'

I just want to add and use the two files stm32_PMBUS_stack.c and stm32_SMBUS_stack.c with the corresponding .h files, but as soon as I include the .h files for the files in main.h then I have this problem.

I attach a cleanly generated project from CubeMx (latest version) and the example provided from ST is on this link:

https://my.st.com/content/my_st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-expansion-software/x-cube-smbus.license%3d1497686538860.html

 

Both compile fine on there own but not when I try to include the stm32_SMBUS_stack and stm32_PMBUS_stack files in my CubeMx project.

The example for my board has this path in the example.

STM32_AN4502_FW_V2.0.0\Projects\STM32F072B-Discovery\MDK-ARM\Project.uvprojx

Also I have to add the &sharpinclude <stdint.h> in the new files as it cant find the uint8_t definition otherwise, weird that it works without it in the ST example..

Thankful for all the help I can get as I have been struggling with this issue for weeks! Probably just a include chain modification somewhere that I cant find on my own.

Best regards

Christoffer

#hal #pmbus #cube-mx #smbus
4 REPLIES 4
loffan bertilsson
Associate II
Posted on June 20, 2017 at 21:20

Someone got an idea? should be straight forward to include to the STM32Cube HAL as stated on the AN4502 site:

X-CUBE-SMBUS software package contains SMBus/PMBus stack implementation for STM32Cube.

The SMBus stack is built on STM32Cube HAL drivers to implement the transport layer. The middleware also includes the template for further expansion and personalization of PMBus support.

loffan bertilsson
Associate II
Posted on June 24, 2017 at 17:42

Found the problem,

The STM32CubeMX generated project includes main.h in the stm32f0xx_hal_conf.h file, the example from ST does not.

To fix, just move the following from main.h to main.c:

/* USER CODE BEGIN Includes */

#include 'stm32_SMBUS_stack.h'

#include 'stm32_PMBUS_stack.h'

/* USER CODE END Includes */

Best

Christoffer

Mike Panetta
Associate II
Posted on December 06, 2017 at 01:22

Did you actually get the library to work?  If so could you send me an example?  I could never get it to work with STM32F072...

Thanks,

Mike

Chester Lu
Associate
Posted on December 19, 2017 at 14:01

I just found and downloaded STM32 Cube Expansion software (AN4502 Application note, STM32 SMBus / PMBusTM embedded software expansion for STM32Cube), try to help me to develop my I2C, PMbus application on my STM32F103 MCU with STM3210E-EVAL board. I believe this software is mean to help us for the PMbus related project.  But I found that the MCU and Eval board I am using is not in the software support list. Even as told the software code is highly portable to my system, I still want to know what is the best approach? or even to port the code to my project, very similar to what you did,  a) what is the best way to to do it, via project, drivers or middlewares? b) stay with my project generated with 

STM32CubeMX

 then copy/import the 

stm32_SMBUS_stack files into my project to make it work?  Thanks!