Open XFer012 opened 6 years ago
@XFer012 ArduCAM library has not added support for Teensy 3.2 and 3.6 boards. Please tell me more information about the Teensy 3.2 and 3.6 boards and I will help you add support for it.
Thanks for your support. Teensy is a very powerful platform, way faster then any Arduino (and with much more RAM and fast SD interface), so it's quite interesting for camera-based projects! It is an ARM mcu board which works with Arduino IDE after installing "Teensyduino": https://www.pjrc.com/teensy/ https://www.pjrc.com/teensy/teensyduino.html
Time ago, user "sumotoy" already contributed patches here, to have Teensy 3.x work with Arducam:
https://github.com/ArduCAM/Arduino/pull/7
but looks like they were ignored. :(
Just updating those patches to current source should do the trick; "sumotoy" even started a branch to work on Arducam library for Teensy but now won't compile anymore (too many changes): https://github.com/sumotoy/ArduCAM
@XFer012 Hi, I have updated the ArduCAM library code to support teensyduino , please download the new library to try.
@XFer012 What's the main chip type of your teensy and I plan to buy one.
Wow, that's great, thanks a lot !!! :) :) :) Will try and report back. :)
Teensy is actually a whole family of dev boards. The cheapest board is Teensy LC and its main chip is a NXP Kinetis MKL26Z64VFT4 (ARM Cortex M0+) The "middleweight" is Teensy 3.2; main chip is NXP Kinetis MK20DX256VLH7 (ARM Cortex M4) The most powerful is Teensy 3.6, with MK66FX1M0VMD18 (ARM Cortex M4 with hw floating point) On Teensy boards, there's a companion chip as a bootloader: https://www.pjrc.com/store/ic_mkl02.html
Hello, I've installed your latest library and tried again, on Teensy 3.6, "ArduCAM_Mini_2MP_OV2640_functions.ino" using Arduino IDE 1.8.5, Teensyduino 1.44
This time the sketch builds correctly :) but unfortunately I get this error:
ACK CMD ArduCAM Start! END ACK CMD SPI interface Error! END
I've attached SPI pins to Teensy SPI#0 (default SPI), which means: MOSI on pin 11 MISO on pin 12 SCK on pin 13 and CS is pin 10 (configured appropriately in the sketch: const int CS = 10)
Anything I may try? Thanks for your support!
@XFer012 Can you measure the waveform with an oscilloscope? I don't have this board yet. So I need your help to debug it. Please detected the SPI interface's signal.
Hello, sorry, I don't have access to an oscilloscope. :( Maybe I could set some sort of serial debug (Serial.print) somewhere in the library and report back?
I purchased a logic analyzer. This is the track I sampled:
Update: I purchased an Arduino Uno (original, brand new) and get the very same error. So I think I have a faulty Arducam Mini 2mp Module. :(
Sorry: faulty jumper. Works OK with Arduino Uno (not yet with Teensy 3.6).
New (clearer?) capture from Teensy 3.6. Overall from start:
Zooming in on bus event around 3200ms:
Resolved!
Sorry I can't send a patch file now (not to mention a pull request), but the correction is very easy: Arducam.cpp Line 133:
- #if (defined(ESP8266)||defined(ESP32))
+ #if (defined(ESP8266)||defined(ESP32)||defined(TEENSYDUINO))
It would be great to also add SPI transaction, as suggested in "sumotoy" patches
With this patch for current Arducam.cpp, Teensy error is fixed and SPI transactions are automatically supported (with compatible SPI libraries). Backward compatible with SPI libraries without transactions support. All thanks to "sumotoy", I just updated his patches.
Sorry I'm not able to issue a proper git pull request:
@XFer012 Great to hear you have solved your problems. We will update our library as soon as possible.
@XFer012 and @UCTRONICS
The current version does not build on a Teensy.
That is the last || TEENSYDUINO at about line 3226 causes the issue where it then tries to use ESP specific register names which are not defined for Teensy.
That is it should go back to
#if defined(ESP8266)
inline void ArduCAM::setDataBits(uint16_t bits) {
const uint32_t mask = ~((SPIMMOSI << SPILMOSI) | (SPIMMISO << SPILMISO));
bits--;
...
@KurtE Thank you very much. I will optimize it now.
Hello, just purchased an Arduino Mini Module 2MP to use with my Teensy 3.2 and 3.6 boards.
I'm using your latest library (https://github.com/ArduCAM/Arduino) and trying to build this example https://github.com/ArduCAM/Arduino/tree/master/ArduCAM/examples/mini/ArduCAM_Mini_2MP_OV2640_functions
I already edited "memorysaver.h" to define (only) the 2mp Mini module.
I use Arduino IDE v1.8.7 and latest Teensyduino add-on v1.44, but when I select a Teensy 3.2 or 3.6 board and try to build the sketch, I get many errors, for example:
`In file included from d:\temp\arduino_modified_sketch_232629\ArduCAM_Mini_2MP_OV2640_functions.ino:11:0:
F:\Arduino\libraries\ArduCAM/ArduCAM.h:713:2: error: 'regtype' does not name a type
regtype *P_CS;
^
F:\Arduino\libraries\ArduCAM/ArduCAM.h:714:2: error: 'regsize' does not name a type
regsize B_CS;
^
ArduCAM_Mini_2MP_OV2640_functions: In function 'void loop()': ArduCAM_Mini_2MP_OV2640_functions:471: warning: unused variable 'temp_last' uint8_t temp, temp_last;
Using library Wire at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Wire Using library ArduCAM in folder: F:\Arduino\libraries\ArduCAM (legacy) Using library SPI at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\SPI Error compiling for board Teensy 3.2 / 3.1. `
It looks like the patches proposed by "sumotoy" to get Arducam library work with Teensy were reverted, and Teensy does not work anymore?