Skip to main content
Associate III
April 11, 2024
Solved

I2C

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 

    This topic has been closed for replies.
    waclawek.jan
    waclawek.janBest answer
    Super User
    April 11, 2024

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

    JW

    2 replies

    waclawek.jan
    waclawek.janBest answer
    Super User
    April 11, 2024

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

    JW

    eunniAuthor
    Associate III
    April 22, 2024

    I change pullups resistor into 4.7kohm.

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