ArduCAM / Arducam_Mega

MIT License
14 stars 12 forks source link

Misleading documentation #14

Open anujdeshpande opened 1 year ago

anujdeshpande commented 1 year ago

Hi

I am running the Arduino example on a Raspberry Pi PicoW board.

[16:59:16]: Port Connect Success
[16:59:18]: Command:55 FF AA, Send Success!
[16:59:18]: Command:55 0F AA, Send Success!
[16:59:18]: Command:55 0F AA, Send Success!
[16:59:18]: Command:55 0F AA, Send Success!
[16:59:18]: Command:55 0F AA, Send Success!
[16:59:21]: Parser timeout error.
[16:59:21]: Port Close Success.

I get the above error in the Arducam app image

I am running the 2.0.4 version of the library

image

I think communication between the camera and the GUI app is happening correctly. But there's something malformed on either end - not sure what.

Also, is there documentation on how to use the GUI application with the Pico SDK instead of Arduino? I see that it's supported, but the docs website doesn't say much about the Pico C SDK https://www.arducam.com/docs/arducam-mega/arducam-mega-getting-started/packs/example/PICO.html#

anujdeshpande commented 1 year ago

image

The code and documentation says that we need to connect pin 7 to the CS line. The documentation that came with the camera says it's pin 17. Pin 17 makes more sense as it's actually a SPI0 CSn pin - pin 7 is mapped to SPI0 MOSI

What's the right approach here? 7 or 17?

anujdeshpande commented 1 year ago

I was able to fix this by changing the SPI pins in pins_arduino.h for the Pico to the following on line 44 -

// SPI
#define PIN_SPI_MISO  (4u)
#define PIN_SPI_MOSI  (3u)
#define PIN_SPI_SCK   (2u)
#define PIN_SPI_SS    (5u)

I kept the example code the same i.e. CS=7. This pins_arduino.h was located at "C:\Users\anuj\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\4.0.2\variants\RASPBERRY_PI_PICO\pins_arduino.h" on my machine.

rmazur commented 9 months ago

Hi.

If this helps. It works for me with this SPI config within pins_arduino.h and i'm using Arduino Mbed OS RP2040 Board package v4.0.10

C:\Users\yourusername\AppData\Local\Arduino15\packages\arduino\hardware\mbed_rp2040\4.0.10\variants\RASPBERRY_PI_PICO\pins_arduino.h

// SPI
#define PIN_SPI_MISO  (16u)
#define PIN_SPI_MOSI  (19u)
#define PIN_SPI_SCK   (18u)
#define PIN_SPI_SS    (17u)

I just needed to change the following code from ino example "full_featured": From const int CS = 7; toconst int CS = 17;

Then everything works fine with the Arducam Mega v2.0 windows client app.