2024-05-03 10:45 AM
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.
2. of course I changed NVIC I2C event interrupt enabled both master and slaves.
3. pinout view is like this
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 :)
2024-05-03 11:04 AM
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 ?
2024-05-03 11:11 AM
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??
2024-05-03 11:27 AM
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.
2024-05-03 11:38 AM
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....
2024-05-03 12:02 PM - edited 2024-05-03 12:08 PM
+ 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.)
2024-05-03 12:24 PM
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.
2024-05-03 01:02 PM - edited 2024-05-03 01:05 PM
> 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.
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.