cancel
Showing results for 
Search instead for 
Did you mean: 

I2C

eunni
Associate III

Hi,

What I want to implement is I2C communication.

There is one master(NUCLEO-U575ZI-Q) and slave(LK432KC).

 

Master transmit TX_Buffer_1 which is double 3.0

and Slave recieve it in RX_Buffer_1. 

Slave doubled RX_Buffer_1 and transmit to master.

 

I use memcpy and Slave_RxCallback function to implement it.

I attached 2 main file each is master and slave.

 

And I also have logic analyzer to detect SCL and SDA line. 

eunni_0-1712835224726.png

In my code, Master transmit only 1 slave address (0x08) like this picture,

eunni_1-1712835313232.png

but sometime it appear like this.. 

eunni_2-1712835356896.png

 

Here is my question

I think the main problem is noise of my HW system.

but I'm not sure.

so plz check whether my code is wrong or not.

1. Do I need more or less Delay time?

2. Is it okay to use polling mode in Master and interrupt mode in Slave? what's the recommendation?

3.I need double data type. Can I use 8byte double type in I2C function? How??

4. Is there any other problem in my code??

 

It's my first time to use STM32..

Thank you 

1 ACCEPTED SOLUTION

Accepted Solutions

Use external pullups. The internal pullups are 40kOhm nominally and usually not adequate.

JW

View solution in original post

2 REPLIES 2

Use external pullups. The internal pullups are 40kOhm nominally and usually not adequate.

JW

I change pullups resistor into 4.7kohm.

It still have various problem ;( but your solution helped a lot, thank you 🙂