cancel
Showing results for 
Search instead for 
Did you mean: 

HAL I2C slave with read/write

craig239955_stm1_st
Associate II
Posted on August 27, 2015 at 13:08

Hi,

I've been looking over an example of master/slave I2C communication using an interrupt and I just can't seem to figure out how it actually works. The description is really vague and the HAL documentation isn't much better.

I need to write some firmware that will receive some commands/data, and act upon the data received, but it will also receive requests where it will have to reply to the master with data.

How can I modify this code to either just receive commands when sent to the write address, or respond to commands when sent to the read address?
2 REPLIES 2
Amel NASRI
ST Employee
Posted on August 28, 2015 at 12:22

Hi kureigu,

1- What are you using as STM32 product?

2- Which example did you looked to?

3- What are exactly the problems you faced to adapt it to your specific needs?

-Mayla-

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

craig239955_stm1_st
Associate II
Posted on August 28, 2015 at 12:36

This is for an STM32F030F4P6

The example I looked at was one with the STM32CubeMX pack for the STM32F030 family nucleo: ''\STM32Cube_FW_F0_V1.3.0\Projects\STM32F030R8-Nucleo\Examples\I2C\I2C_TwoBoards_ComIT''

Firstly I just don't think I understand how to implement the interrupt itself that deals with whatever I2C data is received.

Secondly, after reading the documentation I still don't know how to discern the difference between READ and WRITE addresses in an I2C slave interrupt, so that I can act on a command OR send data back in necessary.