TCM8240MD connector and example

Have a good idea for a new product for SFE or Olimex? Let us know!

Moderator: phalanx

KreAture
Posts: 158
Joined: Thu Apr 24, 2008 2:57 pm

Post by KreAture » Sun Nov 16, 2008 5:30 am

Here's what I found on the subject:

"MJPEG in AVIs having the MJPG fourcc, is restricted JPEG with a fixed -- and *omitted* -- Huffman table. The JPEG must be YCbCr colorspace, it must be 4:2:2, and it must use basic Huffman encoding, not arithmetic or progressive. "

This means it should be quite easy to get the cam to output right format as long as you can force the huffman table to standard and then omit it in the stream.

buffercam
Posts: 32
Joined: Wed Sep 10, 2008 4:00 pm

Post by buffercam » Sun Nov 16, 2008 10:58 am

rgbphil wrote:a FIFO RAM might be of more use than a SRAM
You're absolutely right. Thanks for pointing me to this chip.
Last edited by buffercam on Mon Nov 17, 2008 9:04 am, edited 1 time in total.

buffercam
Posts: 32
Joined: Wed Sep 10, 2008 4:00 pm

Post by buffercam » Sun Nov 16, 2008 12:58 pm

I edited my previous message about HCOUNT and VCOUNT calculations.

Here is what I added (although it still may not be correct):
buffercam wrote:It seems that the HCOUNT calculation is based on counting the clocks in a single row of image data at 1/2 the DSP clock frequency.
So for the Full Mega size, note that the data output is output at 1 x DSP frequency. This means you divide the number of clocks by two when calculating HCOUNT.
Smaller images are output at 1/4 the DSP clock rate, so you need to *multiply* the number of clocks by 2.
The result is that for every picture size, HCOUNT comes out to be approximately the default value of 713 (after you subtract the offset of 677). (I actually calculate 715.)

KreAture
Posts: 158
Joined: Thu Apr 24, 2008 2:57 pm

Post by KreAture » Sun Nov 16, 2008 3:45 pm

I also wish there were better docs. All we know are whats in the appnote together with the list of names and addresses in the datasheet.
what HCOUNT actually does appears to be a bit vague.

I have issues with my cams not delivering the entire frame and suspect this to be a small setting-error simply due to poor docs.
Best I can do is adjust so I get about half a image. Still, the image is then completely wrong colorwise. It's like it's YUV or something even though RGB is active.

buffercam
Posts: 32
Joined: Wed Sep 10, 2008 4:00 pm

Post by buffercam » Sun Nov 16, 2008 5:34 pm

Kreature,

Are you sure your camera is outputting at 15 fps (the maximum output rate specified in the datasheet)?

My camera tries to output at 30 fps when the frame rate is set to the max.

We have three settings for FRMSPD (specified in the Application Note):
Max frame rate
Half frame rate
Quarter frame rate

The datasheet only specified two frame rates: 15fps and 7.5fps.

Based on what I've measured, I think this is the relationship between the two:

Max frame rate = 30 fps, doesn't work properly?
Half frame rate = 15 fps
Quarter frame rate = 7.5 fps

Perhaps they initially designed the camera to do 30 fps, but couldn't get it to work in hardware, so they changed the datasheet to say 15 fps (instead of 30 fps)?

At any rate, try setting frame speed to "Half frame rate."

-David

KreAture
Posts: 158
Joined: Thu Apr 24, 2008 2:57 pm

Post by KreAture » Mon Nov 17, 2008 12:16 am

I have been using lowest framerate as I am focusing on still capture to start with. What settings are you guys using for the rest of the parameters? Like RGB/YUV and audo-contrast/exposure...

ma4826
Posts: 8
Joined: Wed Oct 29, 2008 3:56 am

Victory!!!

Post by ma4826 » Tue Nov 18, 2008 6:15 am

After a lot of attempts:

Address Data Comments
0x0B 0x00 White Line OFF
0x58 0x20 Exposure Time
0x05 0x00 Frame Rate Quarter
0x1A 0xFF
0x1B 0xB3
0x11 0x4A
0x14 0x33
0x04 0x0D RGB, 352x288, OUT ON
0x1F 0x0B
0x1E 0xC3
0x0E 0x1E

Image

Best regards,

ma4826

buffercam
Posts: 32
Joined: Wed Sep 10, 2008 4:00 pm

Post by buffercam » Tue Nov 18, 2008 10:53 am

Thank you and congratulations.

Where did you find info on this secret register?
0x0B 0x00 White Line OFF

EDIT: I'm starting to get the feeling you captured this image with the TCM8230MD. Is that the case? EDIT: Nevermind.
Last edited by buffercam on Tue Nov 18, 2008 11:54 am, edited 2 times in total.

KreAture
Posts: 158
Joined: Thu Apr 24, 2008 2:57 pm

Post by KreAture » Tue Nov 18, 2008 11:00 am

Agreed, that is brilliant!
I will be testing this soon.

I've been writing structs for this cam and will incorporate all the details I find.

Anyone know how to define structs endian?

ma4826
Posts: 8
Joined: Wed Oct 29, 2008 3:56 am

Post by ma4826 » Tue Nov 18, 2008 11:28 am

Thank you and congratulations.

Where did you find info on this secret register?
0x0B 0x00 White Line OFF

EDIT: I'm starting to get the feeling you captured this image with the TCM8230MD. Is that the case?
Testing the registers one for one until 0x19.
With the TCM8240MD.

With 0x0B default value:

Image

KreAture
Posts: 158
Joined: Thu Apr 24, 2008 2:57 pm

Post by KreAture » Tue Nov 18, 2008 11:49 am

OMG! That is the problem I have been having!
Basically, the pink stuff on the left side is over-exposed and with wrong colors. If you take into account me not setting the exposure that leaves the right side black on my shot and the left hidiously pink!

I think I'll have to play around a bit to get this right but wohooo!
Finally the missing piece!

buffercam
Posts: 32
Joined: Wed Sep 10, 2008 4:00 pm

Post by buffercam » Tue Nov 18, 2008 11:54 am

Thanks for clarifying.

How did you calculate SPCOUNT?
The AppNote says SPCOUNT = 2 x (H_COUNT + 191) for that PICSIZ. That's different than what you used.

Also, what is Register 0x0E?

Code: Select all

 0x02 0x00  //Set Camera Active (I assume you did this?)

 0x0B 0x00  // White Line OFF
 0x58 0x20  // Exposure Time
 0x05 0x00  // Frame Rate Quarter
 0x1A 0xFF  // HCOUNT = 0x3FF = 1023
 0x1B 0xB3  // VCOUNT = 0x21B = 539 // Assuming Register 0x1C is left at the default (0xA1)
 0x11 0x4A  // Changed b/c of PICSIZE
 0x14 0x33  // Changed b/c of PICSIZE
 0x04 0x0D  // RGB  352x288  OUT ON
 0x1F 0x0B  // SPCOUNT = 0xBC3 = 3011 // Doesn't match formula?
 0x1E 0xC3  // SPCOUNT[7:0]
 0x0E 0x1E  // According to the AppNote it should be 0xAC for this PICSIZ?

ma4826
Posts: 8
Joined: Wed Oct 29, 2008 3:56 am

Post by ma4826 » Tue Nov 18, 2008 12:33 pm

With the values of appnote I got the same results as Kreature.

I got the correct values with these automatic tests.

Code: Select all

for (reg1f = 0; reg1f < 16; reg1f ++)
{
for (reg1e = 0; reg1e <= (255-15); reg1e = reg1e + 15)
{
for (reg0e = 0; reg0e <= (255-15); reg0e = reg0e + 15)
{

...
...
...

}
}
}
By changing these values the image moves within the "picture" and changes the color.

For example:

with 0x0E = 0x3C

Image

Best regards,

ma4826
Last edited by ma4826 on Tue Nov 18, 2008 12:44 pm, edited 1 time in total.

buffercam
Posts: 32
Joined: Wed Sep 10, 2008 4:00 pm

Post by buffercam » Tue Nov 18, 2008 12:41 pm

Very helpful, thanks.

KreAture
Posts: 158
Joined: Thu Apr 24, 2008 2:57 pm

Post by KreAture » Tue Nov 18, 2008 12:44 pm

Haha. To do that rigorous testing would kill a year for me.
I have been reading my images out with a ATmega88!
It takes time and then I have to view them manually.

Post Reply