PLL mode (0 is off, 1-F is on). It does make a difference what value you use (1-F). Higher values → faster data clock. I believe JPEG needs at least 17 MHz data clock???
Can you be a bit more specific? I mean, which DCLK frequencies do you get with the 1-F PLL settings and what was your input EXTCLK frequency?
Aerospace:
2) Both error flags (0xFA) are set as soon as I turn the JPEG compression on. With JPEG off only FULL_ERRN is set.
Please post register settings. Especially register 4.
Also, has anybody discovered a way of getting just 8 bits per pixel? Raw 8-bit bayer RGB in particular would be great.
I’m asking because I’ll be trying to transfer data from this camera over a serial bus (SPI) at perhaps as little as 25 Mbit/s, so I need all the help I can get to reduce the output rate. Plan B is to convert RGB656 to RGB332 on the fly during parallel to serial conversion.
Page 25 of the datashit[1] says you must change a setting to operate the camera at 2.5 V instead of 2.8 V. Did anybody find it?
[1] Deliberate misspelling to avoid forbidden word filter.
04 : 50 //JPEG on, DOUT on, YUV sel, PICSIZE = full, Picmode = 1280x1024
05 : 00 //quarter speed (in JPEG, this doesn’t affect DCLK, just the time it takes to output a full frame… possibly means different compression ratios)
1A : FF //H_Count → 1023
1B : B3 //H_Count and V_Count adjust
1E : 6C //SP_Count (probably wrong)
1F : 09 //rest of SP_Count
58 : 20 //Exposure time (from other comments in this forum)
0B : 00 //White Line Off (from other comments as well)
0E : B0 //Change for different PIC size (probably wrong)
11 : 6A //same as ‘OE’
14 : 33 //same as ‘11’ and ‘OE’
E6 : 08 //Read JPEG in 4 byte units (cant tell if this does anything)
Hello…can i have a wiring connection between MCU and TCM8240MD camera??? cos i have little confuse about the EXTCLK pin should connect to where pins of MCU???
razvantgf:
The problem is that a cannot get any acknowledge bit. I saw on oscilloscope SDA and SCL(pullups=10k) signals and they seem to be fine.
razvantgf:
I’m confused because the Dclk outputs the same frequency as the Extclk input.
The i2c bus on the camera needs necessarly Extclck to work?(I’m thinikng that the frequency of the pwm is not proper, its about 5Mhz and not 6 the minimum)
IIRC, it’s been mentioned already that the camera just won’t initialise at less than 6 MHz.
lastid:
I want to read barcodes with this camera. The minimum distance I want to achieve is in the range of 2cm-10cm.
I tried the oldest trick in the book on a USB webcam: Using a needle I made a tiny hole in a piece of paperboard and placed in front of the camera lens, flush to the camera. Then it reads barcodes fine at distances of 6 cm - 14 cm. It does however reduce the amount of light reaching the camera and the size of the image. You will likely want to experiment with different hole diameters and distances between hole and camera.
04 : 50 //JPEG on, DOUT on, YUV sel, PICSIZE = full, Picmode = 1280x1024
05 : 00 //quarter speed (in JPEG, this doesn’t affect DCLK, just the time it takes to output a full frame… possibly means different compression ratios)
1A : FF //H_Count → 1023
1B : B3 //H_Count and V_Count adjust
1E : 6C //SP_Count (probably wrong)
1F : 09 //rest of SP_Count
58 : 20 //Exposure time (from other comments in this forum)
0B : 00 //White Line Off (from other comments as well)
0E : B0 //Change for different PIC size (probably wrong)
11 : 6A //same as ‘OE’
14 : 33 //same as ‘11’ and ‘OE’
E6 : 08 //Read JPEG in 4 byte units (cant tell if this does anything)
I too think you should first try without JPEG compression to see if you get a valid YUV image at all, especially with the modifications to HCOUNT, VCOUNT, SPCOUNT and such.
A possible aid in debugging the JPEG structure would be registers 0xF0:0xF1 Define Restart Interval to output a 0xFFDD DRI marker and periodic 0xFFD0…7 RST markers.
It looks like there are several registers related to JPEG in the 0xE9 to 0xFA area:
- 0xE9 Define (download?) Y quantisation table gain(s)?
Dmitry’s right… so far, I have run the TCM8230MD with DVDD=1.5V (low-dropout linear regulator) and with PVDD and I/O voltage up to 3.3V (for PIC18F2450/4450 microcontroller) without any trouble, and no sudden ramp-up in current that would indicate protection diodes becoming active. (Fair warning - PIC18xxxx do not have much memory, so you may be limited to buffering and sending 1 line at a time at 320x240 or 640x480 at full color, depending which. But the TCM8230 at least handles the voltage well.)
Undocumented registers is the worst thing I know of… Next to stuff that doesn’t work at all ofcource.
I have been writing a driver for the TCM8240 for Linux. (Running Linux on NGW100 card with AVR32.) I can thusly handle the data fairly easy now and am running the camera at 20 MHz input clock with PLL off.
I have tried using the initial values of the regs as well as the calculations in various sources but am having a hard time accepting the quality of the results. I get a lot of lines and such in the images, as well as horrible color reproduction.
I am grabbing data at 1280x960 for the moment. (4VGA)
Setting the cam to CBMODE 4 gives me lovely colorbars and comfirms that my transfer algorithm and driver structure is sane.
Has there been any more progress on the registers? Can we recap what we have learnt so far?
The datasheet and the appnote does not agree on many values.
For instance, SP_COUNT defaults to 1024 in the docs which also sais PICSIZ defaults to 0. It also states that H_COUNT defaults to 691.
When I check form power-on, All this is correct.
Appnote sais H_COUNT defaults to 713 and that internally 677 is added to make the count 1390.
It then states the formula SP_COUNT = (H_COUNT + 183) * 2 for PICSIZ=0. This would give an SP_COUNT of 1792 for H_COUNT=713 and of 1748 for H_COUNT=691.
This doesn’t make sence. Why should some stuff be correctly initialized and other stuff not?
I’ve also fiddled with some of the other registers and many seem to have the same effect of sliding the image left/right or corrupting it with vertical lines. If the H or V_count is too far off it looks like one is missing the image alltogether.
This really doesn’t add up at all.
Any insight would be apprechiated.
I could post some examples but without all the settings, they are meaningless.
Are you still using registers or have you started using the bitmapped fields I set up? I find the fields are great as they keep track of the different bits for you. Just be sure about the endian.
I had to rewrite the fields for the avr32 as the silly thing is big endian…
I guess the only safe way to use the structs is to use a define or something for the endianness. (I have it defined both for little and big now.)
ONe wierd platform I tried had bit fields internally as little endian, but addressing in memory was big endian… That was a nightmare.
It works sortof. I am still getting banding though.
After doubling the caps on my board it looked different.
Adding even more made it different again.
I say different, not necessarily better, but less blue though.
I think my regulators are not fast enough to handle the frequencys I run at. Maby there is also an issue with their rating. The TCM8240 can draw up to 150mA on the 1.6v rail.
I am running at 20 MHz so maby that amplifies the problem.
Your issue will be the datarate, but it is possible.
You will have to use a clock frequency to the sensor that is high enough for it to function even if it is lower than the specified 6 MHz minimum.
Further, you can reduce the output rate by setting the H and V count high I think.
If you want to save yourself a lot of issues with image quality, I do suggest you use TCM8230 instead of TCM8240 as it has a complete manual and is fully automatic. Very little has to be done to it’s registers in order to make it output good pictures. TCM8240 is a nightmare untill we manage to understand and document it fully.