Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have you tried this with a Pico W? #3

Closed
sgbaird opened this issue Oct 5, 2022 · 8 comments
Closed

Have you tried this with a Pico W? #3

sgbaird opened this issue Oct 5, 2022 · 8 comments

Comments

@sgbaird
Copy link
Contributor

sgbaird commented Oct 5, 2022

No description provided.

@Xraydylan
Copy link
Owner

Xraydylan commented Oct 6, 2022

Unfortunately not.
I uploaded the code, I used for a university project since there was not quite much useful other code for the Arducam and Raspberry Pi Pico around.

In theory, it should work with the Pico W.

Have you been able to try it with a Pico W?

@sgbaird
Copy link
Contributor Author

sgbaird commented Oct 6, 2022

@Xraydylan I'll give it a try and let you know how it goes 👍

@sgbaird
Copy link
Contributor Author

sgbaird commented Oct 6, 2022

Ah, does this use a custom UF2? Pico W has it's own UF2. I don't know all the nuances about the differences between Pico W's version and the Pico version.

@sgbaird
Copy link
Contributor Author

sgbaird commented Oct 6, 2022

Tried it out with the Pico W firmware and slightly modified the SPI call with polarity=1 and phase=1 based on this DigiKey tutorial.

self.spi.configure(baudrate=4000000, polarity=0, phase=0, bits=8)

Past that, I'm kind of stumped. It seems to recognize that the device is there but then fails to write:

[8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "Pico_imager.py", line 37, in <module>
  File "Arducam_OV2640.py", line 172, in Camera_Detection
  File "Arducam_OV2640.py", line 205, in wrSensorReg8_8
  File "Arducam_OV2640.py", line 211, in iic_write
OSError: [Errno 19] No such device

I also needed to modify a line:

if ((id_h == 0x26) and ((id_l == 0x40) or (id_l == 0x42))):

to identify the "48" address of the ArduCam 2 MP SPI OV2640 (48 comes from the ArduCam docs):

if ((id_h == 0x26) and ((id_l == 0x40) or (id_l == 0x42) or (id_l == 0x48))):

Lmk if there are any oversights I've made here.

Note also that I don't have anything connected to the UART pins, but I don't think that's an issue by the time it reaches the error above.

I'm using this with a Maker Pi Pico base, and I'm not sure if it's worth mentioning that the GP3 LED doesn't light up when I run the program. GP0, GP2, GP4, GP5, GP7, and GP8 have their blue indicator lights lit up.

I also tried changing self.I2cAddress = 0x30 to self.I2cAddress = 0x48 in multiple places. Very stumped.

@Xraydylan
Copy link
Owner

Ok, I took a small look at it again.

And as for your error, I assume that the I2C address may be wrong in my code. (Probably vaild for a different model)
What you could do is to confirm the I2C address for sure is to hook up the camera and perform a simple I2C scan.

Have a look here: Arduino I2C Scanner

In some datasheets I saw that apperently it may be 0x60 (or 0x61).

Also, where the changes to the SPI configuration necessary?
Since for our original usecase changes for the polarity and phase were not needed.

@sgbaird
Copy link
Contributor Author

sgbaird commented Oct 6, 2022

Thanks for the response!

Ok, I took a small look at it again.

And as for your error, I assume that the I2C address may be wrong in my code. (Probably vaild for a different model) What you could do is to confirm the I2C address for sure is to hook up the camera and perform a simple I2C scan.

Have a look here: Arduino I2C Scanner

This seems like it would be the same functionality as self.i2c.scan(), correct? Is there something additional to be gained from troubleshooting using this Arduino version? Given that the error occurs during the write, not during the scanning.

In some datasheets I saw that apperently it may be 0x60 (or 0x61).

If it's just the I2C address of the ArduCam camera module you're talking about, then I'm pretty sure 0x48 is correct. I also verified that self.I2cAddress is assigned the value of 48. Is there a different place this would be hardcoded that I should look at or change?

Also, where the changes to the SPI configuration necessary? Since for our original usecase changes for the polarity and phase were not needed.

Yes - I'm pretty sure I tried it with the original polarity and phase and got an earlier error, then switched to the other polarity and phase and got a later error. I might need to go back to double check though.

@Xraydylan
Copy link
Owner

If you can do the I2C scan in micropython that is fine too.
The Arduino code was just an example if you had one of them lying around.

Hm... If the error isn't with the address then the only other option I can think of is to check if the i2c bus has appropriate pullup resistors (if there are no internal pullups).

Other than that, I am not sure where the compadability issue then is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants