- Where did you get the camera module(s)?
- Model number of the product(s)?
Arducam Mini Module Camera Shield with OV2640 2 Megapixels, i.e.
https://www.amazon.com/dp/B012UXNDOY
- What hardware/platform were you working on?
AtSAMV71 with MCC / Harmony libraries.
- Instructions you have followed. (link/manual/etc.)
I’ve ported the low-level functions of the tflmicro example and have carefully read over ArduCAM Camera Shield Series SPI Camera Software Application Note Rev 3.0, Feb 2018
- Problems you were having?
The code runs fine for a while, capturing consecutive images in YUV422 96 x 96 format. But after a indeterminte amount of tie (sometimes 5 seconds, sometimes 5 minutes), spi_read_bit(ARDUCHIP_TRIG, CAP_DONE_MASK) continually returns zero, as if the camera did not complete its capture. As a result, my program hangs waiting for the camera to report capture complete.
- The dmesg log from your hardware?
I see no dmesg here!
- Troubleshooting attempts you’ve made?
- Examined SPI signals with a multi-channel scope – they look solid.
- Tried different SPI clock rates between 0.5 MHz and 3MHz. (Note: I want to fetch frames as quickly as possible, so faster SPI rates are preferable.)
- Inserted delays between consecutive calls to spi_read_bit(ARDUCHIP_TRIG, CAP_DONE_MASK)
- Inserted a delay after performing a burst read from the FIFO
- What help do you need?
I apologize for the paraphrased code, but do you see any errors in the following loop? My intent is to start capturing a frame, wait for the frame to complete, read the data from the fifo and immediately start capturing another frame:
while(1) {
flush_fifo();
start_capture();
while (!spi_get_bit(ARDUCHIP_TRIG, CAP_DONE_MASK)) {
asm("nop");
}
if (read_fifo_length() != sizeof(user_buf)) {
error();
}
// Note: On this hardware, spi_read_bytes() writes BURST_FIFO_READ followed by
// sizeof(user_buf) zeros as it reads MISO bytes into user_buf, holding CS low for the
// entire transaction. At any rate, it fetches the correct data.
spi_read_bytes(BURST_FIFO_READ, user_buf, sizeof(user_buf));
print_frame_rate();
}
As mentioned, it runs for a while, but then spi_get_bit(ARDUCHIP_TRIG, CAP_DONE_MASK)
fails to go true.
Do you have suggestions on how to diagnose this, or changes I should make to the code? (The code was lifted more or less directly from the tflmicro code example.)