AnsweredAssumed Answered

X-CUBE-SMBUS Does not work with CubeMX (STM32F072RB)

Question asked by Mike Panetta on Oct 6, 2017

I've tried everything I can think of, but I can't get the library to work at all.  I see on my oscilloscope where it tries to get data from the device (I am using STM32F072RB as SMBUS SLAVE), but it never gets what I try to send.  Attaching my code below.

 

Are there any examples of how to get SMBUS working with CubeMX software? 

 

I put some prints in the lib code and here is what I get... Why does it think I want SMBUS QUICK transfer?  I am not sending a quick, I am sending a read byte request with command....

 

The following is 2 attempted transfers:

SMBUS_Slave_ISR
SMBUS_FLAG_ADDR
Call HAL_SMBUS_AddrCallback()
HAL_SMBUS_AddrCallback()
Call STACK_SMBUS_AddrAccpt()
STACK_SMBUS_AddrAccpt()
MATCH? 44:44
MATCH
Complete, ret: SUCCESS
ELSE
WRITE
Complete...
SMBUS_Slave_ISR
SMBUS_FLAG_ADDR
Call HAL_SMBUS_AddrCallback()
HAL_SMBUS_AddrCallback()
Call STACK_SMBUS_AddrAccpt()
STACK_SMBUS_AddrAccpt()
MATCH? 44:44
MATCH
Complete, ret: SUCCESS
ELSE
READ
Call STACK_SMBUS_ExecuteCommand() Where does this go?
STACK_SMBUS_ExecuteCommand(0x20003fa8) Time to make the donuts!
context: 0x20003fa8, Buffer: 0x20003fcb, piobuf: 0, CurrentCommand: 0, state: 4a
SMBUS_FLAG_STOPF
HAL_SMBUS_ListenCpltCallback()
Call HAL_SMBUS_ExecuteCommand() FOR SMBUS_SMS_QUICK_CMD_W
STACK_SMBUS_ExecuteCommand(0x20003fa8) Time to make the donuts!
context: 0x20003fa8, Buffer: 0x20003fcb, piobuf: 0, CurrentCommand: 1, state: 1
Got command 0x01
HAL_SMBUS_ListenCpltCallback() - COMPLETE
Complete...
SMBUS_Slave_ISR
Complete...
SMBUS_Slave_ISR
SMBUS_FLAG_ADDR
Call HAL_SMBUS_AddrCallback()
HAL_SMBUS_AddrCallback()
Call STACK_SMBUS_AddrAccpt()
STACK_SMBUS_AddrAccpt()
MATCH? 44:44
MATCH
Complete, ret: SUCCESS
ELSE
WRITE
Complete...
SMBUS_Slave_ISR
SMBUS_FLAG_ADDR
Call HAL_SMBUS_AddrCallback()
HAL_SMBUS_AddrCallback()
Call STACK_SMBUS_AddrAccpt()
STACK_SMBUS_AddrAccpt()
MATCH? 44:44
MATCH
Complete, ret: SUCCESS
ELSE
READ
Call STACK_SMBUS_ExecuteCommand() Where does this go?
STACK_SMBUS_ExecuteCommand(0x20003fa8) Time to make the donuts!
context: 0x20003fa8, Buffer: 0x20003fcb, piobuf: 0, CurrentCommand: 1, state: 4a
Got command 0x01
SMBUS_FLAG_STOPF
HAL_SMBUS_ListenCpltCallback()
Call HAL_SMBUS_ExecuteCommand() FOR SMBUS_SMS_QUICK_CMD_W
STACK_SMBUS_ExecuteCommand(0x20003fa8) Time to make the donuts!
context: 0x20003fa8, Buffer: 0x20003fcb, piobuf: 0, CurrentCommand: 1, state: 1
Got command 0x01
HAL_SMBUS_ListenCpltCallback() - COMPLETE
Complete...
SMBUS_Slave_ISR
Complete...

 

Attached is my code in zip form.

 

Thanks for any help!

 

Mike

Attachments

Outcomes