SparkFun Forums 

Where electronics enthusiasts find answers.

Have a good idea for a new product for SFE or Olimex? Let us know!
By KreAture
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.
By buffercam
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.
By buffercam
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.)
By KreAture
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.
By buffercam

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."

By KreAture
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...
By ma4826
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


Best regards,

By buffercam
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.
By KreAture
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?
By ma4826
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:

By KreAture
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!
By buffercam
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?
By ma4826
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


Best regards,

Last edited by ma4826 on Tue Nov 18, 2008 12:44 pm, edited 1 time in total.
By buffercam
Very helpful, thanks.
By KreAture
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.
  • 1
  • 11
  • 12
  • 13
  • 14
  • 15
  • 31
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]