cancel
Showing results for 
Search instead for 
Did you mean: 

try to communicate between Two STM32 F407 discovery board in I2C Protocol but slave not work properly it gives no output

PANAN.1
Associate II

master side :

uint8_t TMP102_ADDR = 0x08;

uint8_t REG_TEMP = 0x01;

int result = 0x01;

(result is numerical data which i want to transfer to another stm 32 )

 HAL_I2C_Master_Transmit(&hi2c3,(TMP102_ADDR<<1),&result,sizeof(result),100);

slave side stm 32 program

uint8_t TMP102_ADDR = 0x08; // Use 8-bit address

uint8_t REG_TEMP = 0x00;

char buf[4];

AL_I2C_Mem_Read(&hi2c1,(TMP102_ADDR<<1),0x0C,I2C_MEMADD_SIZE_8BIT,buf, I2C_MEMADD_SIZE_8BIT,100);

still it shows error or no output on slave side both supplied by USB and ground at common point

5 REPLIES 5
TDK
Guru

The slave should call HAL_I2C_Slave_Receive to receive the information from the master.

There are examples for this. Here is one:

https://github.com/STMicroelectronics/STM32CubeF4/blob/2f3b26f16559f7af495727a98253067a31182cfc/Projects/STM32F412ZG-Nucleo/Examples/I2C/I2C_TwoBoards_ComPolling/readme.txt

If you feel a post has answered your question, please click "Accept as Solution".
PANAN.1
Associate II

HAL_I2C_Slave_Receive(&hi2c1,(uint8_t *)aRxBuffer,sizeof(aRxBuffer), 1000);

i use this instruction also but not works....

It won't even compile as you don't have a slave address. Were you able to follow the example?

If you feel a post has answered your question, please click "Accept as Solution".
PANAN.1
Associate II

i see the example but still it not work for my case

i have same stm32 f407 discovery board as tx and rx side and adress is 0x08

PANAN.1
Associate II

yes thank you now its work

but it dnt send updated value of ADC from transmit side

receiving side get value only once

it not update time by time