cancel
Showing results for 
Search instead for 
Did you mean: 

74HC138, One I2C bus - 4 I2C devices

Anej Knez
Associate II

Hi,

I am using 4 NFC 4 Clicks in combination with 74HC138 to connect them directly to on I2C bus. Can anyone hep me how do I implement this in my code so that he controller would switch between every I2C device.

Rgrd,

Anej

5 REPLIES 5
Paul1
Lead

Options:

  • STM32 pin to each CS pin on NFC (4 STM32 GPO pins)
  • STM32 2 pins to 74HC138 Y0-Y3 to 4 NFC CS pins. 74HC138 has active Low outputs, are the NFC CS pins active Low or active Hi? (2 STM32 GPO pins)
  • STM32 SCL pin to 74HC138 E* pin, and Y0..Y3 to SCL of each NFC (2 STM32 GPO pins)

Paul

Javier1
Principal

I dont have any experience with those modules but it says they can be controlled via I2C.... you only need to connect a I2C bus (two wires + ground +vcc) and forget about the CS

we dont need to firmware by ourselves, lets talk

So you are decided to use the SPI interface? do you chose it for the speed?

Do you know that SPI and I2C are different things ,right?

we dont need to firmware by ourselves, lets talk

How's the 74HC138 wired in this contrivance?

Not sure it's something I'd use for I2C, is there some way to set or select I2C slave addresses?

How about sourcing SCL from different pins on the STM32 side, and then cycling who's using which one.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Paul1
Lead

Agree with Javier,

*) CS is for SPI only.

Like Tesla said

a) Configure each NFC for different I2C address (if possible?)

b) Use different I2C ports on MCU for each NFC

or

c) Use the HC138 to fan out the SCK, and use two GPIO pins to control the HC138.