Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 11:04 01 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : I've found an interesting module for I2C

Author Message
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 04:24pm 27 Jul 2025
Copy link to clipboard 
Print this post

TCA9548A
Modules are very cheap on AE.
Basically, it splits a single I2C port into eight. You send it the board's address and the number of the port you want access to. It then connects the ports together until a different one is selected. It's more than that though. All the ports are open drain (like they should be) so you can add your own pullups. So you can have a mixture of 5V and 3V3 I2C ports. The module can be powered from 1V8 to 5V and the level shifting is automatic and invisible, just connect the input port pullups to your system voltage. Looks interesting, I might get one to play with.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2566
Posted: 05:09pm 27 Jul 2025
Copy link to clipboard 
Print this post

https://www.ebay.co.uk/itm/335701328995
why do we need it when you can connect multiple i2c anyway?
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 06:22pm 27 Jul 2025
Copy link to clipboard 
Print this post

You can only connect multiple devices if they all have different addresses. The WII game controllers only have one or possibly two addresses. If you want three on the same machine (as on the later CMM2) you can't unless you have three I2C ports. Using this module you could have eight on a single I2C port of a Pico. And another eight on the other. :)

Note that you could also, if you level shift to get the I2C connection up to 5V from the Pico, mix 5V, 3.3V and 1.8V I2C devices on the eight I2C lines. I don't think it supports 3V3 output with 3V3 input, unfortunately, I think you have to level shift. I'm still investigating the data sheet.

Oh, and you can get five for that price on AE. :)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5089
Posted: 06:50pm 27 Jul 2025
Copy link to clipboard 
Print this post

  Mixtel90 said  You can only connect multiple devices if they all have different addresses. The WII game controllers only have one or possibly two addresses. If you want three on the same machine (as on the later CMM2) you can't unless you have three I2C ports. Using this module you could have eight on a single I2C port of a Pico. And another eight on the other. :)

Note that you could also, if you level shift to get the I2C connection up to 5V from the Pico, mix 5V, 3.3V and 1.8V I2C devices on the eight I2C lines. I don't think it supports 3V3 output with 3V3 input, unfortunately, I think you have to level shift. I'm still investigating the data sheet.

Oh, and you can get five for that price on AE. :)


Yes that works. 3v3 in and 3v3 out in any mix. We use them with I2C devices a lot. Specifically those that have a default I2C address that can be re-programmed in sw. We always keep them on default since there is no surprise if you ever need to replace one.

Example: the melexis thermal cameras, like MLX90614.

Volhou
PicomiteVGA PETSCII ROBOTS
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 1383
Posted: 01:53pm 28 Jul 2025
Copy link to clipboard 
Print this post

Is there such an animal for UART?
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 1383
Posted: 02:06pm 28 Jul 2025
Copy link to clipboard 
Print this post

I found this and they are $7 at LCSC (has buffers)
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2566
Posted: 07:45pm 28 Jul 2025
Copy link to clipboard 
Print this post

I ordered a TCA9548A. I will probably ask for help cos don't use i2c much.  V53L0X, MCP23017, ssd1306
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 06:49am 29 Jul 2025
Copy link to clipboard 
Print this post

The info for using I2C is in the manual, Appendix B, and it's pretty good! It's not much more difficult than using a COM port. The main thing is that it's up to you to create the protocol that you want for a particular job.

The module is easy to work with. If the address pins are all grounded it's address is &h70 The individual channels are then &h0 to &h7 so you send &H70 for the first, &h71 for the second, &h72 for the third etc. There are no other registers in it. Once you have selected the channel like that you just use the I2C as normal to talk to the device that you want.

I found that, for me, the best way to play was to use two Picomites as master and slave. Set the slave up to print whatever it gets over I2C then send it stuff from the master. That way you have full control over setting the number of bytes sent and received and how they are handled - and how the 7-bit addressing system works!
.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2566
Posted: 03:31pm 29 Jul 2025
Copy link to clipboard 
Print this post

dunno if a0 to a2 are hardwired or go to gp pins.

 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5089
Posted: 03:35pm 29 Jul 2025
Copy link to clipboard 
Print this post

Easy, connect the module to your desired I2C bus, and run an I2C scan. From the address found you know the wiring.

Volhout
PicomiteVGA PETSCII ROBOTS
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2566
Posted: 07:39pm 29 Jul 2025
Copy link to clipboard 
Print this post

this is just the devices i2c addresses itself which can be 0x70 to 0x77. mines in the post. solder it up and post
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2566
Posted: 07:13pm 31 Jul 2025
Copy link to clipboard 
Print this post

I don't get this. the tca has address so writing 2 bytes to it to set up a device and the register so what channel conected to for each device

 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 09:21pm 31 Jul 2025
Copy link to clipboard 
Print this post

It's easy enough.
You are sending one byte (B7-B0) to the address of the TCA.

The TCA address is [0]1110[A2][A1][A0] - that's 70 to 77 depending on the address pins.
The next bit is 0 to read from it or 1 to write to it. You are selecting a device, so this will be a 1 so that you can write to the device select strobe.
The next 8 bits after the ACK (which is automatic) are the device strobes, one per I2C port. So a 1 on B0 will select port 0, a 1 on B1 will select port 1 etc. All non-used ports have their strobes set to 0.

It's possible to select two I2C ports at the same time (not sensible for many devices) by setting both their strobe bits high.
.
Edited 2025-08-01 07:23 by Mixtel90
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025