cancel
Showing results for 
Search instead for 
Did you mean: 

i2c

eunni
Associate III

Hi,

I now implementing i2c with 2 stm board.

The process is 

1. Master transmit data 

2. Slave receive and calculate some functions.

3. Slave transmit that changed data

4. Master receive it.

with HAL_I2C functions.

 

 

I measure the SDA line with logic analyzer, and the results are unexpected..

As you can see in the code, I transmitt 3.1416 to slave repeatedly.

and in the slave ProcessData function, TX_Buffer_1 updated 1 or 0.111 randomly . (random but the probability of 1 must be higher than 0.111)

As a result , the very first data transmit & receive & calculate & transmit well (left picture)

but after that, every data show 0.111 (right one)

eunni_0-1713786857592.png

I check RX_Buffer_1 in slave with PuTTY,

RX_Buffer _1 printed

3.1416

0

0

0

0

... which means except first data, slave receive 0 everytime...

but master still transmit 3.1416 (I checked it both logic analyzer and PuTTY)

 

Plz help :( idk what's the problem....

I attached master and slave main.c file. thank you

 

summary----------------------------------------------------------

1. master transmit 3.1416 reapetedly

2. slave receive 3.1416 at first, but after that, slave receive 0.

4 REPLIES 4
Andrew Neil
Evangelist III

I'm sorry :( 

After I posted it, I thought it was mass, so I re-post.

I can't find edit or delete function here 


@eunni wrote:

I can't find edit or delete function here 


It's here - the little round "down-arrow" in the top-right of the post:

AndrewNeil_0-1713800192943.png

 

EDIT:

For the opening post of a thread, it has 'Edit Message' instead of 'Edit Reply':

AndrewNeil_1-1713800325383.png

That also lets you edit the title.

 

 

Already removed the duplicate.

Regards
/Peter

In order 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.