cancel
Showing results for 
Search instead for 
Did you mean: 

configuration

eunni
Associate III

Hi,

I now implementing i2c with 1 master (U575ZI-Q) and 3 slave (LK432KC).

I confirmed my code. It worked well.

but after changed title of the project and deleted some project, it made me confued,, 

so I made every(1master 3slave) project new.

 

Here is the problem.

I think I forgot some MX configuration...

When I debug master, slave didn't receive data.

 

1. I use 4.7kohm external pull up resistor, so I set GPIO pullup/pulldown mode as no pull up and no pull down both master and slaves.

eunni_0-1714758042670.pngeunni_1-1714758057098.png

2. of course I changed NVIC I2C event interrupt enabled both master and slaves.

3. pinout view is like this

eunni_2-1714758125923.png

eunni_3-1714758171256.pngeunni_4-1714758189674.png

well.. I think master configuration could be the problem... but I'm not sure

I'll attach my master and slave main.c file

 

Thank you 🙂

 

7 REPLIES 7
AScha.3
Chief II

Hi,

set all pin speed to low , to avoid ringing at xx MHz .

+

>When I debug master, slave didn't receive data.

And without debug : its working fine ?

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

I think that's not critical reason for this error.. because It worked well before with very high output,,

Also, I checked the signal with logic analyzer without debug (just run), it still doesn't work..

 

Should I change GPIO pull up/pull down mode into "pull up" ?? 

now I set both master and slave "no pull up and no pull down" mode... 

is it correct??

I always set for I2C : pin speed : low ; pullups on .

+ For hi speed always need external pullups , but have internal on, is just some safety , if an external pullup has bad contact...run with low clock speed 100kHz or less, to test it.

Otherwise : if 4k7 pullups connected, internal on (40k) or off doesn't matter.

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

Thank you for your help 🙂

I change both master and slave.

"no pull up and no pull down & Low"

 

but it still doesn't work....

+ set all pullups on . Doesn't hurt...

but also doesn't help, if your program wrong and cannot work. Just try.

+

Just question : why you use INT call - if you anyway wait , until finished ? 

HAL_I2C_Master_Transmit_IT()

 why not blocking then:

HAL_I2C_Master_Transmit(..)

Would be better...it waits "auto" until finished. (Same for receive.) 

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

I just wondering,,

Pullup and nopullup.. why doesn't it matter?

because external resistance is much smaller than internal one??

 

I set all pullup on ! thank you for new info (still not working though)

 

Well I consider both interrupt and pooling mode, and if the system have complex parallel functions (maybe inthe future...) I think interrupt is nessaray.

because external resistance is much smaller than internal one??

Right. 

+

>I think interrupt is nessaray.

Maybe...but useless, if you wait for finished. (And : sure its finished, if tx empty ? It might still shift out last bits from shifter, but you do not wait for this. Did you proof , that all transfer finished and I2C stop done ? )

If using INT function, you have to use the INT , that tells you : finished now.

AScha3_0-1714766739222.png

 

And "if the system have complex parallel functions" its the right way - but only if you not wait for finished, but do many other things in the time of transfer; 

But if anyway need waiting, because communication is this way, use blocking function. Not more slow, same speed.

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