TimWJ
Posts: 7
Joined: Sun Jun 17, 2018 7:19 am

can a camera share an i2c bus with other devices?

Thu Jun 21, 2018 11:32 am

I am just starting with the Compute module.

We would like to connect 2 cameras, a RTC and possibly other i2c devices to the CM3.

In general multiple i2c devices can share the bus, but I have it in my mind that the camera needs exclusive access.

Is this correct?

Many thanks

Tim

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1860
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: can a camera share an i2c bus with other devices?

Thu Jun 21, 2018 11:51 am

I think the answer is yes, but not in a way that would be useful to you.

The SoC has two I2C busses. In theory the VPU and the ARM(s) have equal access to both, but in practice they get one each. There isn't a sharing/interlocking mechanism for guaranteeing that either side can access either bus when needed (and there are technical reason why this hasn't been done), hence the split.

The camera is driven by the ISP software on the VPU, so the camera(s) must be on the "VPU"/"VC" bus. The split means that any peripherals you put on the same I2C bus are effectively out of reach of the ARMs, so there is little point in doing so.

TimWJ
Posts: 7
Joined: Sun Jun 17, 2018 7:19 am

Re: can a camera share an i2c bus with other devices?

Thu Jun 21, 2018 12:08 pm

Very many thanks for such a rapid and full explanation, I think I now understand the situation.

Tim.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5663
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: can a camera share an i2c bus with other devices?

Thu Jun 21, 2018 12:26 pm

To extend Phil's comment, if the VPU has the I2C peripheral open then it will have registered an interrupt handler for it. That is the point where you'll get issues if the ARM also tries to use the peripheral, as the VPU typically has lower interrupt latency.
With the camera subsystem it pretty much holds the I2C peripheral open the whole time that the camera component is enabled/executing, mainly as it is normally adjusting exposure and gain settings every frew frames. If you could arrange to shut the camera down at the point where you want to talk to other I2C devices then you should be safe.
You will also need to be aware of pinmuxing though. The VPU will switch the I2C peripheral muxing to the configured GPIO pins whenever it wants to talk to the camera and doesn't restore it afterwards (it sees no reason to). If your extra peripherals aren't on the same pins the ARM isn't likely to check the muxing and therefore you'll see no devices.

If you're running 2 camera modules then you'll also need to reserve two sets of I2C pins for them (0/1, 28&29, or 44&45) as the camera modules have the same address. (I guess one OV5647 and one IMX219 could run at the same time on the same pins as they have different addresses, but that is unlikely to be that useful).

If you really need to split the bus up due to other I2C address conflicts then there are various I2C mulitplexer chips available that are supported by Linux. The TCA/PCA9548a 8 way I2C controlled mux works well, and can be cascaded if you really need to go that far.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

bartya43
Posts: 8
Joined: Thu Apr 26, 2018 10:05 am

Re: can a camera share an i2c bus with other devices?

Fri Jul 13, 2018 10:02 am

Yes it is possible and if your are using multiple I2C sensors then you should use this I2C shield https://store.ncd.io/product/i2c-shield ... -i2c-port/ with raspberry pi extend and help you to access the sensor I2C network to more than 100 sensor devices

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5663
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: can a camera share an i2c bus with other devices?

Fri Jul 13, 2018 10:22 am

bartya43 wrote:
Fri Jul 13, 2018 10:02 am
Yes it is possible and if your are using multiple I2C sensors then you should use this I2C shield https://store.ncd.io/product/i2c-shield ... -i2c-port/ with raspberry pi extend and help you to access the sensor I2C network to more than 100 sensor devices
This is the Compute Module forum. Most users of the Compute Module will be designing their own carrier boards, so anything plugging in to the 40pin header on a standard Pi is pretty irrelevant.

I note that your most recent few posts have all been promoting products from store.ncd.io. Spamming is frowned upon here.
A product announcement is one thing (General Discussion or For Sale forums), but promotion on random other threads is likely to find the naughty step.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 20465
Joined: Sat Jul 30, 2011 7:41 pm

Re: can a camera share an i2c bus with other devices?

Fri Jul 13, 2018 10:30 am

And I've found the naughty step!
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

Return to “Compute Module”

Who is online

Users browsing this forum: No registered users and 5 guests