cancel
Showing results for 
Search instead for 
Did you mean: 

To design STM32F051 as Slave.

Lweij.1
Associate

To design STM32F051 as Slave.

When receive the data from Mater, the STM32F051(Slave) can return data to the Master.

Current design

(1) After the MCU is initialized, it will call HAL_I2C_Slave_Receive_IT() to set the I2C interrupt to the receiving state.

(2) After receiving 3 bytes of data, it will trigger HAL_I2C_SlaveRxCpltCallback(), parse the data in this function.

At the same time, the I2C interrupt is changed to the transmission state, and the data is sent back to the Master.

(3) After the data is transmitted, the I2C interrupt is changed to the receiving state.

Current problem

At present, Slave can receive data(3 bytes) from the Master, but the program does not trigger HAL_I2C_SlaveRxCpltCallback().

Do you think there is any negligence in the program settings?

0 REPLIES 0