mbed with 8bit databus at 2Mhz

27 Mar 2012

Hi,

I'm experimenting with a MT9D111 2MP camera. R/W of registers goes over I2C and pixel data can be captured using a 8bit databus. I've got the I2C communication part working. Next step is to read the pixel data that's submitted over this 8bit wide databus. A frame valid signal indicates a valid frame/image. The pixel clock is used to indicate a valid byte on the 8bit databus.

Is the mbed capable of clocking in this data at approx. 2Mhz? or should I switch to a 8bit to SPI (74HCT595) solution? If the SPI connection is capable of doing 12Mhz then it's still not enough..

Any suggestions solutions on how to read 8bit wide data at 2Mhz? The ultimate goal is to store the image data onto an SD card..

Suggestions/tips highly appreciated :)

Thanks, Sjoerd

27 Mar 2012

You can use Fast Port In, just mask the other 24 bits, I think there is a strate 8 bit block on the MBED,

MBED PinPort Pin
P30p0.4
P29p0.5
P8p0.6
P7p0.7
P6p0.8
P5p0.9
P28p0.10
P27p0.11

So then you can grab 8 Bits, in one go, Shift Right 4, Mask with 0xFF, Save to file.

If you post Data Sheet, supplyer, then others will respond or possably copy you.

Cheers

  • Ceri.
27 Mar 2012

Hi Ceri,

Thanks for your information. I read about the fast port and configured it like this:

D0: P0_15 p13 D1: P0_16 p14 D2: P0_17 p12 D3: P0_18 p11 D4: P0_23 p15 D5: P0_24 p16 D6: P0_25 p17 D7: P0_26 p18

This is the first step. Next question is how to clock in the data? Connecting the pixelclock to an interrupt is way to slow. I get 10ms as maximum interrupt frequency when testing with a 2Mhz clock on a input pin.

Is there a possibility to use DMA?

The datasheet of the MT9D111 camera can be found here: http://www.brandsite.nl/mt9d111/mt9d111_rev5.pdf (page 114 and more..)

Developers guide can be found here: http://www.brandsite.nl/mt9d111/MT9D111_dev_guide.pdf

Thanks, Sjoerd

29 Mar 2012

After some thinking and searching around on the web it might be a solution to use two 12bit counters (74HC2020) combined with the pixel clock to get the data in some temporary memory storage. An 8bit to SPI (74HC597) can be used to read out the data again after resetting the 12bit counters.

/media/uploads/sjoerd/mbed_mt9d111.png

Any thoughts about this idea? (I'm not an hardware design expert.. ;) )

Maybe better ideas?

Thanks, Sjoerd

06 May 2012

Sjoerd Brandsma wrote:

Hi Ceri,

Thanks for your information. I read about the fast port and configured it like this:

D0: P0_15 p13 D1: P0_16 p14 D2: P0_17 p12 D3: P0_18 p11 D4: P0_23 p15 D5: P0_24 p16 D6: P0_25 p17 D7: P0_26 p18

This is the first step. Next question is how to clock in the data? Connecting the pixelclock to an interrupt is way to slow. I get 10ms as maximum interrupt frequency when testing with a 2Mhz clock on a input pin.

Is there a possibility to use DMA?

The datasheet of the MT9D111 camera can be found here: http://www.brandsite.nl/mt9d111/mt9d111_rev5.pdf (page 114 and more..)

Developers guide can be found here: http://www.brandsite.nl/mt9d111/MT9D111_dev_guide.pdf

Thanks, Sjoerd

Do you try to write the data on the sd card in the interrupt subroutine ? If it's the case, I think that reason of the delay

11 May 2012

Hello0. Using interrupt to write data on a sd card causes a delay ?

11 May 2012

I did not test it with writing to sd card.

I did a performance test with a 2 Mhz input on an IO pin that triggers an interrupt. This interrupt only toggles another IO pin.

When connectiong a oscilloscope on the output IO pin, I measure approx. 10ms between two interrupts.

11 May 2012

Thanks for reply, so what you say means that a frequency of 100 hz is allowed for the interrupts ? Hum I can't go more than 10 hz whihout problems of instability if i want to write during an interrupt

11 May 2012

@Sjoerd, the 10ms can't possibly be the minimum time between two interrupts. Either your code is really busy with other stuff/your interrupt routine is huge, or it has issues with a 2MHz input, although that also kinda surprises me, the hardware should be able to handle it I would guess, really bad duty cycle could be a problem. (I am quite new to mbed/arm, so take everything i say with a grain of salt).

I think however this topic is useful for you: http://mbed.org/forum/mbed/topic/2326/

@Mat, same topic is also useful for you I think, I dont really understand your question, but there they get it up to 250khz