I’m busy pulling my hair out at the moment. I spent the whole day building my own Arduino project that uses the Alcam camera. But now I cannot seem to get the SPI interface to work,. The problem is that hangs up at the point where first tries to use the SPI interface.
I then decided to go back to basics and use the Arduino Shield that came with the camera and the original example code that GHI provided just to make sure that it works there. But even with the official shield I still had no luck getting SPI communications working. I can communicate with the camera when I’m using a normal serial UART FTDI cable, but I do not seem to have any luck with the SPI.
So I was thinking that maybe if the schematics of the camera and the Arduino shield was available it would help a bit.
Here is a summary of the issues I have:
- When I press the button on the camera it does not pull Pin3 of the Arduino low. I re soldered the header connectors, but it does not seem like its a dry joint. I would like to know if the button is wired directly to the header pins, or is this driven by the STM32?
- When I fake the button by pulling pin3 low with a piece of wire, then the program hangs up right after displaying “Read the banner:”
@ KiwiSaner -
As I know pin 3 of the Adruino just for trigger to start the demo, instead of starting automatically when the board is powered up. It is just for easier to monitor the demo application.
The button on the camera is not related to SPI or any interface. They are separated.
Arduino pulls ALCAM RESET pin to low, pull SSEL and MOSI to high, then release RESET pin to let ALCAM enters SPI interface. After that Arduino will release SSEL and MOSI pin for SPI. The demo application does that for you.
So make sure all pins are connected correctly, and the example is in SPI mode.
The shield just a connector. Check your arduino, make sure they are controlled by that way, and your SPI is working.
@ Dat - Thanks for your reply.
Yeah, but for the demo to work, this pin is supposed to go low when you press the button on the camera right? Otherwise there is possibly a hardware fault somewhere. I’ve looked carefully to see if I can spot any dry joints anywhere, but all seems ok.
Hmm, thanks I better check out the reset line as well. If the button pin has given me problems, then maybe there is a chance the reset line is also not connected. Not sure to which Aduino pin the reset line is supposed to connect, but according to my multimeter it is connected to A5 on the Arduino… I could not see any defines or usage in the Arduino code referring to the reset line though.
I’ve decided I 'll give this one last shot, but if I cannot get this to work properly with SPI then I’ll be very disappointed. I could modify my design to use a soft serial interface between Arduino and the camera, but the fact that the camera works on 115200 by default rules that out as well. (I need the real serial interface for other purposes in my design).
PS : By the way, found the circuit diagram for the Arduino shield here : https://www.ghielectronics.com/downloads/schematic/ALCAM_OEM_Shield_Schematic.pdf
:wall: Still not having much luck with the SPI stuff.
Another question… Say I change the default configuration to 9600, is it possible to save it in the configuration file so it remains like that each time the came starts up? (I tried, but that did not seem to work either. It looked to me like baud rate changes are not part of the configurations file settings, or am I wrong?)
Also my camera’s pictures are quite blurry and out of focus. Is it possible to tune its focus somehow?
@ KiwiSaner [quote]-
Yeah, but for the demo to work, this pin is supposed to go low when you press the button on the camera right?[/quote]
No, this button is used once at begin of main(), and this is input pin. Instead your Arduino runs automatically when connects to power, you have to pull this pin to low to start application. This is for debug purpose, nothing else.
[quote]Arduino pulls ALCAM RESET pin to low, pull SSEL and MOSI to high, then release RESET pin to let ALCAM enters SPI interface. After that Arduino will release SSEL and MOSI pin for SPI. The demo application does that for you.
So make sure all pins are connected correctly, and the example is in SPI mode.[/quote]
I was wrong on this statement. It is only available on NETMF example.
You have to config your ALCAM in SPI interface. The document , page 55 will tell you more. Basically, keep SSEL and MOSI to high then reset ALCAM, after that, remember to release your these SPI pins.
The button on ALCAM is for standalone mode, it is not related to SPI, UART or I2C.
Baudrate is not saved, see document page 56:
[quote]At boot time the SPI_SCK pin is internally pulled high. If this pin is pulled low during
reset or power-up, the UART baud rate will be 9600 instead of 115200 baud.[/quote]
Just keep that pin to low, no command is needed.
Thank you for this detailed answer. Very happy to hear 9600 baud mode is possible. It sounds like it will be the easiest option for me and also make it easy to debug. Will modify my circuit thos weekend and give it another go.