Set state of DSI/CAM1 switch

Hi,

Does someone have experience on how to turn the DSI/CAM1 switch ON or OFF? Is it a physical task or a task that can be done from software side?

I’m asking because the switch is sealed and I’m not sure if I shall break the seal or not.

Thank you

Hi @sicabboy,

In order to change between CAM/DIS you can follow these instructions - https://www.balena.io/fin/1.1/docs/developers/#Dual-camera-mode. You need to replace the dt-blob.bin file in the root directory of the fin, with the one provided in the link, when mounting the boot partition.

You can remove the plastic sticker on top of the switch; the CAM/DSI requires a physical toggling of the switch to set the desired mode. Please ensure that your device is powered off when you do this as performing this action whilst powered on may damage the device.

Let me know if this resolves your question! :slight_smile:

Hi bucknalla,

Thanks for the suggestion. It worked like a charm!

1 Like

Hi sicabboy,

noob question: How does one “Replace the ‘dt-blob.bin’ file in the boot partition of the board” ?

Hi Hegazi,

  1. Remove the power adapter from board

  2. Connect the USB micro into Fin and the other side into your laptop.

  3. A partition will be mounted automatically by your OS.

  4. Download the dt-blob.bin file from here

  5. Overwrite the existing dt-blob.bin from the mounted partition with the one you have downloaded.

Hope it helps!

1 Like

Hi sicabboy,

For some reason connecting the Fin to my laptop via USB doesn’t get a partition mounted!
Here is what I did (running Windows 10 Home):

balenaOS booted on the board:
1. Move ‘dt-blob.bin’ downloaded from ‘https://github.com/balena-io/balena-fin/blob/master/software/dt-blob/cam0_cam1/dt-blob.bin’ onto a usb storage.
2. Connect that usb to the balenaFin board
3. Run the following inside HostOS terminal on balena-cloud dashboard

mount -o remount,rw /
mkdir /media/usb
mount /dev/sda1 /media/usb
cp /media/usb/dt-blob.bin /resin-boot

Raspbian-Fin booted on the board:
1. Open terminal and run:

wget https://github.com/balena-io/balena-fin/blob/master/software/dt-blob/cam0_cam1/dt-blob.bin
sudo cp dt-blob.bin /resin-boot

However, I don’t think the ‘dt-blob.bin’ file enables CAM1 on Raspbian. In fact I think it disabled both CAM0&1. I didn’t test it fully on balenaOS since I don’t know how to write containerized apps. The only repo I found was ‘GitHub - balena-io-experimental/balena-fin-arducam-dual-camera: simple project for testing 2 arducam MIPI modules connected to dual-camera enabled balenaFin’ and running that gave me a single static image from CAM1 which I think means the blob file worked?

For now, I am trying to look for / learn to write an app to run on balenaOS/balenaFin that enables both CAM0&1 with python and opencv as that is my end goal.

Thank you for the reply.

Hi

Have you installed the RPi foundations usbboot drivers? You can find instructions for the same here.
I think that’s the step that missing. Please let me know if that works

Also, I just realised that Etcher should have prompted you to install the drivers.
Did that happen already? Or did you not get that prompt? If so it might be an issue with your Etcher and please let me know the version of your Etcher that you are running

Hi,

Thanks for the reply. My etcher is version 1.5.86. Also, yes, it did prompt me, and I did install the drivers.
Here is what I did:

  1. Push GitHub - balena-labs-projects/balena-cam: Network Camera with Raspberry Pi and WebRTC. Tutorial: onto the board. Works fine. Video stream from CAM0 is perfect. Doesn’t this confirm that the drivers are fine?
  2. Switched cv2.VideoCapture(0) in server.py to cv2.VideoCapture(1) to get the feed of the second camera. I also changed the Fleet Configuration. Got the following output:

balena-cam select timeout
balena-cam VIDIOC_DQBUF: Resource temporarily unavailable
balena-cam Failed to open default camera. Exiting…
balena-cam Video device is ready
balena-cam select timeout
balena-cam VIDIOC_DQBUF: Resource temporarily unavailable
balena-cam Failed to open default camera. Exiting…
Service exited ‘balena-cam’
Restarting service ‘balena-cam’

Note: changing to cv2.VideoCapture(-1) as was suggested on some stack exchange posts gives me CAM0 feed. So not successful in getting CAM1 feed so far.

Another note: perhaps it would be a good idea for balena-cloud to have an option asking if the user wants the second cam enabled and then download an already configured balenaOS image.

Hi

  • Have you followed the steps given here for enabling the dual camera mode? You can’t do it with the default device tree file that comes with the balenaOS image. So changing the dtbo is necessary.
  • To do that you can mount the fin as a storage device and then make the required changes (i.e. replace the dtbo file with the one linked in the above link). It is not just about drivers, but also about what each pin is configured to do. You will also have to toggle the switch that is there on the bottom of the fin (See documentation link above).

Once you do all of this, you should be able to use 2 cameras together. To come back to your other question - have you been able to mount the fin as a storage yet? I see that you have installed the drivers through the prompt that Etcher gave you.

If not, we have to first fix that so that we can move on to the dual cameras bit.

Yes. I did all that. If by dtbo file you mean ‘dt-blob.bin’ then yes. I also toggled the switch. I haven’t been able to mount the fin as storage so I edited the img file before flashing. I followed all the steps in your link.

Okay - this should definitely not be happening then.

  • Can you share your dockerfile as well as your code? You can share the barebones part that deals with the camera. No need to share the entire application
  • If possible, please share support access to the device from balenaCloud so that I can take a better look at it. Once you enable support access, share the UUID of the device as a direct message to me so that I can take a closer look at the application.

Cheers

Hi,

I pushed this app ‘https://github.com/balenalabs/balena-cam’. It is not mine. UUID sent to your inbox and support access enabled.

Hi
I am trying to check the device, but looks like the support access has been disabled. Can you reenable it and ensure that cameras are connected to the cam0 and cam1 ports?

Hi,

I just enabled it for a week. It should be working now.

Hey Mohammed

I checked the device again right now - was able to see the device on the dashboard but it’s coming up as offline. Can you check if it’s powered on and if so it is connected to the Internet?

Hi,

Not sure why it went offline. I restarted it and now it is online.

Hey,

We’ve checked and you have the dt-blob.bin file. Both cams are also coming up when we run dmesg. Can you switch to a public url and confirm that both cams are working now?

Lucy-Jane

Yes. It is working fine with CAM0. Switching to CAM1 gets this:

Restarting service ‘balena-cam sha256:
Video device is not ready
Trying to load bcm2835-v4l2 driver…
Video device is not ready
Trying to load bcm2835-v4l2 driver…
Service exited 'balena-cam sha256:

Restarting service ‘balena-cam sha256:*****************************************’

Hey @hegazi,

balena-cam uses the first video device. Can you confirm if you’ve modified the source code here. That is changing /dev/video0 to dev/video1 ?

Thanks