2017-10-06 01:22 PM
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_ADDRCall HAL_SMBUS_AddrCallback()HAL_SMBUS_AddrCallback()Call STACK_SMBUS_AddrAccpt()STACK_SMBUS_AddrAccpt()MATCH? 44:44MATCHComplete, ret: SUCCESSELSEWRITEComplete...SMBUS_Slave_ISRSMBUS_FLAG_ADDRCall HAL_SMBUS_AddrCallback()HAL_SMBUS_AddrCallback()Call STACK_SMBUS_AddrAccpt()STACK_SMBUS_AddrAccpt()MATCH? 44:44MATCHComplete, ret: SUCCESSELSEREADCall 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: 4aSMBUS_FLAG_STOPFHAL_SMBUS_ListenCpltCallback()Call HAL_SMBUS_ExecuteCommand() FOR SMBUS_SMS_QUICK_CMD_WSTACK_SMBUS_ExecuteCommand(0x20003fa8) Time to make the donuts!context: 0x20003fa8, Buffer: 0x20003fcb, piobuf: 0, CurrentCommand: 1, state: 1Got command 0x01HAL_SMBUS_ListenCpltCallback() - COMPLETEComplete...SMBUS_Slave_ISRComplete...SMBUS_Slave_ISRSMBUS_FLAG_ADDRCall HAL_SMBUS_AddrCallback()HAL_SMBUS_AddrCallback()Call STACK_SMBUS_AddrAccpt()STACK_SMBUS_AddrAccpt()MATCH? 44:44MATCHComplete, ret: SUCCESSELSEWRITEComplete...SMBUS_Slave_ISRSMBUS_FLAG_ADDRCall HAL_SMBUS_AddrCallback()HAL_SMBUS_AddrCallback()Call STACK_SMBUS_AddrAccpt()STACK_SMBUS_AddrAccpt()MATCH? 44:44MATCHComplete, ret: SUCCESSELSEREADCall 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: 4aGot command 0x01SMBUS_FLAG_STOPFHAL_SMBUS_ListenCpltCallback()Call HAL_SMBUS_ExecuteCommand() FOR SMBUS_SMS_QUICK_CMD_WSTACK_SMBUS_ExecuteCommand(0x20003fa8) Time to make the donuts!context: 0x20003fa8, Buffer: 0x20003fcb, piobuf: 0, CurrentCommand: 1, state: 1Got command 0x01HAL_SMBUS_ListenCpltCallback() - COMPLETEComplete...SMBUS_Slave_ISRComplete...Attached is my code in zip form.
Thanks for any help!
Mike
#x-cube-smbus2018-08-03 12:33 PM
Hi Mike,
I realize this post is over a year old. It doesn't look like anyone monitors this much.
I'm having a similar problem with the SMBus HAL. I'm trying to make an SMBus slave device. I'm using the SMBus Stack and the STM32F0 HAL version 1.7. Did you ever get this resolved?
The issues seems to be the "LISTEN" state. After the first bytes from the host <addr+w><cmd>, then <addr+r> The Stack needs to be able to transmit, but it can't because the HAL is still in the listen state, likely because of the <addr+r> that just happened. So, the HAL it skips right over the code in SLAVE_TRANSMIT_IT because it is still in the "LISTEN" | "RX" state. Right now, there is no code that can switch gears from "LISTEN|RX" to "TX"
The slave portion of the SMBus HAL just seems to be broken. The SMBus_Stack as implemented by ST seems to be written well and handles many cases. Master(Host) mode may work ok, but I have no need for that.
Thoughts?
Best Regards,
Jason
2018-08-27 02:30 PM
I ended up using plain I2C mode. SMBus mode was not working correctly.
Thanks,
Mike