cancel
Showing results for 
Search instead for 
Did you mean: 

1.stm32l052 Smbus traffic has no ack 2.XferOptions parameter configuration

JCai.2
Associate II

HI,

1.When I was debugging mlx90615, I used smbus to communicate. The reading function was as follows:

uint32_t I2C_Read_Cmd_Data (SMBUS_HandleTypeDef *hsmbus1, uint16_t chip, uint8_t *cmdBuffer, int32_t cmdBufferLen, uint8_t *dataBuffer, int32_t dataBufferLen)

{

 uint32_t ret_code = I2C_OK;

 if(HAL_SMBUS_Master_Transmit_IT(hsmbus1, (uint16_t)chip, (uint8_t*)cmdBuffer, 1, SMBUS_FIRST_FRAME)!= HAL_OK)

 {

while(1);

 }

while(HAL_SMBUS_GetState(hsmbus1) != HAL_SMBUS_STATE_READY);

 if(HAL_SMBUS_Master_Receive_IT(hsmbus1, (uint16_t)chip, (uint8_t*)dataBuffer, 3,SMBUS_FIRST_AND_LAST_FRAME_WITH_PEC) != HAL_OK)

 {

while(1);

 }

while(HAL_SMBUS_GetState(hsmbus1) != HAL_SMBUS_STATE_READY);

  return ret_code;

}

but the measurement waveform found that there was always no ack in the last byte (pec), as shown below

0693W000000UgI7QAK.jpg

Would like to ask where the problem is, please answer, thank you very much

2.As shown above, I have the following options for the last parameter(XferOptions) when using the HAL_SMBUS_Master_Transmit_IT function, the waveform will change when I modify it, I would like to ask how to configure this parameter, thank you!

/* List of XferOptions in usage of :

 * 1- Restart condition when direction change

 * 2- No Restart condition in other use cases

 */

#define SMBUS_FIRST_FRAME           SMBUS_SOFTEND_MODE

#define SMBUS_NEXT_FRAME            ((uint32_t)(SMBUS_RELOAD_MODE | SMBUS_SOFTEND_MODE))

#define SMBUS_FIRST_AND_LAST_FRAME_NO_PEC   SMBUS_AUTOEND_MODE

#define SMBUS_LAST_FRAME_NO_PEC        SMBUS_AUTOEND_MODE

#define SMBUS_FIRST_AND_LAST_FRAME_WITH_PEC  ((uint32_t)(SMBUS_AUTOEND_MODE | SMBUS_SENDPEC_MODE))

#define SMBUS_LAST_FRAME_WITH_PEC       ((uint32_t)(SMBUS_AUTOEND_MODE | SMBUS_SENDPEC_MODE))

/* List of XferOptions in usage of :

 * 1- Restart condition in all use cases (direction change or not)

 */

#define SMBUS_OTHER_FRAME_NO_PEC        (0x000000AAU)

#define SMBUS_OTHER_FRAME_WITH_PEC       (0x0000AA00U)

#define SMBUS_OTHER_AND_LAST_FRAME_NO_PEC   (0x00AA0000U)

#define SMBUS_OTHER_AND_LAST_FRAME_WITH_PEC  (0xAA000000U)

0 REPLIES 0