SPI issues on SAMD-based boards
Published by Michael on
- January 16, 2020 at 2:47 am #20227MichaelParticipant
I’m using the Arducam-Mini-5MP-Plus(OV5642) with an Adafruit Feather M0 board. With this I’m facing the “SPI interface error”.
I use your example sketch for the normal 5MP-plus functions. The SPI is wired to the standard HW-SPI bus of the board. CS pin is adjusted to pin 12.
When I connect the OV5642 to an Aduino Micro (ATMega32U4) everything works well, no issues. I’m quite sure that this is no CS-pin issue on the Feather-board, since I always adjust the CS pin declaration accordingly. On the Feather-board for instance, I’m using digital pin 12 for CS.
I went through the few posts that exist and found maybe these possible reasons for the error:
1. Feather M0 (SAMD21) uses 3.3V logic, the Cam is connected to a 5V supply and hence might require 5V level on the SPI/CS pins?
2. Feather M0 (SAMD21) runs on 48MHz, hence the SPI clockrate might be too high for the cam (8MHz)?
3. The cam module requires 300mA and is fed in my setup by 5V through the USB output voltage pin of the Feather-board (supporting up to 500mA). In post
https://www.arducam.com/forums/topic/frequently-asked-questions-faq-about-arducam-spi-cameras/#post-14429 you stated that another board (the ESP8266 Nano V2) isn’t capable of delivering the requested current strength and hence the SPI communication fails.
So for point 1: Do I need to add a level shifter on the SPI bus? The Feather-board is not “officially” 5V-proof, but I saw that it withstands the 5V input levels. On the way out to Arducam, I would assume that the 3.3V level should be sufficient to still drive the SPI on camera side. So I wonder wheather I really would need a shifter at the end.
For point 2: How can I check which max level for the SPI clockrate is used? I’m not able to find this in the code. Can you give me a hint wheather this could be an issue and where I can check this?
For point 3: In the spec for the cam you mention that the cam can operate at 3.3V – 5V. Should I better connect the cam power supply to 3.3V instead of 5V? Does this cause even more current draw?
Thanks for your help.
- January 16, 2020 at 6:08 am #20228binKeymaster
Thanks for your choosing Arducam camera, don’t worry and I will try my best to help you.
1, For the SPI bus, you’d can use 4MHZ SPI frequency to try. Due to the influence of power conversion chips, I advise you use 4M SPI to try firstly.
2. Yes, you are right, you’d better use a big current power.
3. Our camera support 3.3 v, you don’t need level shifter.
- April 18, 2020 at 4:38 pm #21878katesfbParticipant
I am having a similar problem with an MKR 1400 board, SD shield and arducam mini OV5642. The sam d21 has a clock speed of 48MHz which would require a clock divider of 12 to get the 4MHz for the spi bus but i don’t think there is this clock divider option?
I also have another problem, when i use the modem on the MKR 1400, the SD card fails and the arducam cant save captured image files to the SD card. If i just save the captured images to the SD card without turning the modem on it works fine. Is there some sort of SPI conflict going on here.
Any help is much appreciated.
- April 19, 2020 at 6:24 pm #21885Arducam jyhModerator
Generally, SPI can divided to 4MHz, we don’t have an MKR1400 board, so we have not test it , or you can drop it to 2MHz.
You can check whether the modem and camera share the SPI bus, if so, then the modem may occupied the SPI bus and not released.
- You must be logged in to reply to this topic.