Cool stuff for Raspberry Pi, Arduino and all electronics hobby projects
Notifications
Clear all

[Solved / Archived] Unstable register reads with Arducam Mega

4 Posts
2 Users
0 Likes
83 Views
(@neunz)
Posts: 3
Active Member
Topic starter
 

Hi, 

 

I have a witty Pi 4 connected on a Raspberry Pi 3 B+ and an Arducam Mega 3MP. 

The Arducam Mega use the following pins : 

GPIO-22 -> Chip Select 

GPIO-10 -> MOSI

GPIO-9 -> MISO 

GPIO-11 -> SCK 

VCC 3,3V and GND 

 

Everything is powered with an AC-DC adaptor (Output 12Vdc at 2.08A).

 

If I don't connect the camera the program WittyPi.sh get the following (right) values : 

================================================================================
>>> Current temperature: 28.5°C / 83.3°F
>>> Your system time is: 2024-12-09 17:05:47 GMT
>>> Your RTC time is: 2024-12-09 17:05:49 GMT
>>> Vin=13.19V, Vout=5.01V, Iout=0.66A
Now you can:
1. Write system time to RTC
2. Write RTC time to system
3. Synchronize with network time
4. Schedule next shutdown [09 13:11:30]
5. Schedule next startup [09 13:12:00]
6. Choose schedule script
7. Set low voltage threshold
8. Set recovery voltage threshold
9. Set over temperature action
10. Set below temperature action
11. View/change other settings...
12. Reset data...
13. Exit
What do you want to do? (1~13)
Please choose from 1 to 13

 

As soon as I connect the camera I get unstable and wrong values as below : 

================================================================================
>>> Current temperature: 28.5°C / 83.3°F
>>> Your system time is: 2024-12-09 17:04:39 GMT
>>> Your RTC time is: 2012-12-09 17:04:41 GMT
>>> Vin=6.19V, Vout=4.95V, Iout=0.51A
Now you can:
1. Write system time to RTC
2. Write RTC time to system
3. Synchronize with network time
4. Schedule next shutdown [04 13:11:18]
5. Schedule next startup [04 13:09:00]
6. Choose schedule script
7. Set low voltage threshold
8. Set recovery voltage threshold [12.7V]
9. Set over temperature action
10. Set below temperature action
11. View/change other settings...
12. Reset data...
13. Exit
What do you want to do? (1~13)
Please choose from 1 to 13

================================================================================
>>> Current temperature: 28.375°C / 83.075°F
>>> Your system time is: 2024-12-09 17:04:40 GMT
>>> Your RTC time is: 2012-12-04 11:04:42 GMT
>>> Vin=6.19V, Vout=2.00V, Iout=0.58A
Now you can:
1. Write system time to RTC
2. Write RTC time to system
3. Synchronize with network time
4. Schedule next shutdown [09 09:11:18]
5. Schedule next startup [09 09:12:00]
6. Choose schedule script
7. Set low voltage threshold [12.7V]
8. Set recovery voltage threshold
9. Set over temperature action
10. Set below temperature action
11. View/change other settings...
12. Reset data...
13. Exit
What do you want to do? (1~13)
Please choose from 1 to 13

================================================================================
>>> Current temperature: 28.5°C / 83.3°F
>>> Your system time is: 2024-12-09 17:04:40 GMT
>>> Your RTC time is: 2024-12-09 11:04:43 GMT
>>> Vout=5.02V, Iout=0.24A
Now you can:
1. Write system time to RTC
2. Write RTC time to system
3. Synchronize with network time
4. Schedule next shutdown [09 09:08:18]
5. Schedule next startup [04 13:09:00]
6. Choose schedule script
7. Set low voltage threshold
8. Set recovery voltage threshold
9. Set over temperature action
10. Set below temperature action
11. View/change other settings...
12. Reset data...
13. Exit
What do you want to do? (1~13)
Please choose from 1 to 13

================================================================================
>>> Current temperature: 28.375°C / 83.075°F
>>> Your system time is: 2024-12-09 17:04:41 GMT
>>> Your RTC time is: 2024-12-04 17:04:44 GMT
>>> Vin=13.19V, Vout=2.01V, Iout=0.53A
Now you can:
1. Write system time to RTC
2. Write RTC time to system
3. Synchronize with network time
4. Schedule next shutdown [04 13:11:30]
5. Schedule next startup [09 09:12:00]
6. Choose schedule script
7. Set low voltage threshold
8. Set recovery voltage threshold [12.7V]
9. Set over temperature action
10. Set below temperature action
11. View/change other settings...
12. Reset data...
13. Exit
What do you want to do? (1~13)
Please choose from 1 to 13

================================================================================
>>> Current temperature: 28.5°C / 83.3°F
>>> Your system time is: 2024-12-09 17:04:42 GMT
>>> Your RTC time is: 2024-12-09 11:04:44 GMT
>>> Vout=2.01V, Iout=0.30A
Now you can:
1. Write system time to RTC
2. Write RTC time to system
3. Synchronize with network time
4. Schedule next shutdown [09 13:11:30]
5. Schedule next startup [09 13:09:00]
6. Choose schedule script
7. Set low voltage threshold
8. Set recovery voltage threshold [12.7V]
9. Set over temperature action
10. Set below temperature action
11. View/change other settings...
12. Reset data...
13. Exit
What do you want to do? (1~13)
Please choose from 1 to 13

 

 

This behavior stay until the next reboot even if I remove de camera. 

Sometimes after aproximately 50 reboots, my schedule is not respected and the raspberry pi shutdown but the witty pi never cut the power and I think this can be the cause. 

 

What's very strange is that if I request the value by hand (for example the next startup day) I always get the same value as if there is no problem.

i2cget -y 1 8 30

0x09

 

Any idea about what's causing this strange behavior ? 

 

 
Posted : 09/12/2024 6:53 pm
(@admin)
Posts: 513
Member Admin
 

It seems some bytes were transferred incorrectly via I2C, but I can not tell the reason.

It is even mode difficult to explain, if you confirm the Arducam Mega 3MP doesn't use I2C at all.

Removing the camera doesn't immediately fix the issue, while a reboot does, that seems implying the problem was in the Pi's I2C stack.

 
Posted : 10/12/2024 10:37 am
(@neunz)
Posts: 3
Active Member
Topic starter
 

If I run the following script I start to see I2C read error after the 4th time.

max=1000
first_read=`i2cget -y 1 8 0`
false_count=0
for i in `seq 1 $max`
do
    r=`i2cget -y 1 8 0`
    if (($r != $first_read))
    then
	false_count=$((false_count + 1))
    fi
done
echo $false_count

Errors seems to increase over time up to 30%. 

But I can't find a significant change with the arducam, I have these errors even without the arducam... 

Do you have the same results ?

I will check if it's on the raspberry pi side or the witty pi side.

I already changed to a new raspberry just in case. 

This post was modified 3 weeks ago by Neunz
 
Posted : 10/12/2024 3:57 pm
(@neunz)
Posts: 3
Active Member
Topic starter
 

I switched for a Rapsberry Pi 4 and I have no errors. 

Maybe there is an issue with the Raspberry Pi 3.

 

 
Posted : 11/12/2024 10:30 am
Join Waitlist We will inform you when the product arrives in stock. Please leave your valid email address below.