Our uCam-TTL is connected to the hardware UART on a Teensy++ 2.0 http://pjrc.com/teensy/pinout.html . We've added the SD card socket and 3.3v regulator from the same site. We are programming with Arduino 1.0.1 For those of you finding this in the future, our code should probably work on the new Leonardo Arduino.
With the uC running a simple sketch that forwards all UART characters to the USB com port and vice versa(functionally equivalent to a blank sketch on a real Arduino), the example test application running on a pc works correctly about 90% of the time. It usually synchs between 3 and 12 attempts and most images look fine. But 1 out of 10 times it refuses to synch at all and occasionally an image will have horizontal lines of varying sizes, usually red when it occurs. We are mainly concerned with 80x60 RAW 8bit(332) color but will occasionally send a 640x480 JPEG.
The problem is much worse when we try the camera in its intended application running independently on the Teensy++. I've attached our unfinished actual source code which does occasionally work (uCam.zip). The last time it sort of worked I captured the serial monitor debug output.
Card failed, or not present //this was expected, no card was insertedSync successful. // yay!!! it worksInitial successful.Package size successful.Light frequency successful.RAW snapshot successful.Get RAW picture failed. // bummer. Why fail here?JPEG snapshot failed.RAW snapshot failed.JPEG snapshot failed.RAW snapshot failed.JPEG snapshot failed.RAW snapshot failed.JPEG snapshot failed.RAW snapshot failed.JPEG snapshot failed.RAW snapshot failed.JPEG snapshot failed.RAW snapshot failed.JPEG snapshot failed.RAW snapshot successful. // Why start working again here?Get RAW picture successful. // and here?JPEG snapshot failed. // only to die again.RAW snapshot failed.JPEG snapshot failed.
I then added debug code to print all UART transmissions on the serial monitor and noticed that sometimes the 6 hex elements of the commands did not result in 12 ASCII characters. (wish I had saved that output) This is because(I think) Serial.print(_command[i],HEX) does not print leading zeros. So 0xAA is AA, but 0x07 is 7, and 0x00 is 0. So I changed to Serial.write(_command[i]) instead. Then in order to be absolutely sure what was happening on the serial lines I hooked up a logic analyzer. Output attached(totalFail.zip), in order to view you will need the analyzer software here http://www.saleae.com/downloads Start by scrolling past where reset goes high. That is where it first turns on.
The current result is sometimes correct behavior from the Teensy++ but absolutely no response from the camera. The voltage at the camera is a stable 3.31v The first time I ran the logic analyzer I saw several responses from the camera but I wanted to capture additional channels, label them, and correlate with the serial monitor. So I reconfigured before saving the first run.
Can someone please give me an idea what to try next? I am absolutely stumped. At least I learned a valuable lesson. Record your first result whatever it is, you may never see it again.Dustin Maki
Interesting, but inconsequential note: since changing Uart.print(x,HEX) to Uart.write(x) , the serial monitor only prints garbage in place of the command characters. A single garbage character in place of a 6 hex digit command. That character increases in ASCII value by 1 for each command ?! weirdness all over. Attached files totalFail.zip (1009.2 KB) uCam.zip (7.4 KB)
With the uC running a simple sketch that forwards all UART characters to the USB com port and vice versa(functionally equivalent to a blank sketch on a real Arduino), the example test application running on a pc works correctly about 90% of the time. It usually synchs between 3 and 12 attempts and most images look fine. But 1 out of 10 times it refuses to synch at all and occasionally an image will have horizontal lines of varying sizes, usually red when it occurs. We are mainly concerned with 80x60 RAW 8bit(332) color but will occasionally send a 640x480 JPEG.
The problem is much worse when we try the camera in its intended application running independently on the Teensy++. I've attached our unfinished actual source code which does occasionally work (uCam.zip). The last time it sort of worked I captured the serial monitor debug output.
Card failed, or not present //this was expected, no card was insertedSync successful. // yay!!! it worksInitial successful.Package size successful.Light frequency successful.RAW snapshot successful.Get RAW picture failed. // bummer. Why fail here?JPEG snapshot failed.RAW snapshot failed.JPEG snapshot failed.RAW snapshot failed.JPEG snapshot failed.RAW snapshot failed.JPEG snapshot failed.RAW snapshot failed.JPEG snapshot failed.RAW snapshot failed.JPEG snapshot failed.RAW snapshot failed.JPEG snapshot failed.RAW snapshot successful. // Why start working again here?Get RAW picture successful. // and here?JPEG snapshot failed. // only to die again.RAW snapshot failed.JPEG snapshot failed.
I then added debug code to print all UART transmissions on the serial monitor and noticed that sometimes the 6 hex elements of the commands did not result in 12 ASCII characters. (wish I had saved that output) This is because(I think) Serial.print(_command[i],HEX) does not print leading zeros. So 0xAA is AA, but 0x07 is 7, and 0x00 is 0. So I changed to Serial.write(_command[i]) instead. Then in order to be absolutely sure what was happening on the serial lines I hooked up a logic analyzer. Output attached(totalFail.zip), in order to view you will need the analyzer software here http://www.saleae.com/downloads Start by scrolling past where reset goes high. That is where it first turns on.
The current result is sometimes correct behavior from the Teensy++ but absolutely no response from the camera. The voltage at the camera is a stable 3.31v The first time I ran the logic analyzer I saw several responses from the camera but I wanted to capture additional channels, label them, and correlate with the serial monitor. So I reconfigured before saving the first run.
Can someone please give me an idea what to try next? I am absolutely stumped. At least I learned a valuable lesson. Record your first result whatever it is, you may never see it again.Dustin Maki
Interesting, but inconsequential note: since changing Uart.print(x,HEX) to Uart.write(x) , the serial monitor only prints garbage in place of the command characters. A single garbage character in place of a 6 hex digit command. That character increases in ASCII value by 1 for each command ?! weirdness all over. Attached files totalFail.zip (1009.2 KB) uCam.zip (7.4 KB)
Comment