cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103VCT6 as a CSI (camera) reader

lkcl
Associate II
Posted on October 14, 2013 at 20:54

hi i am in the middle of an R&D phase setting up a tablet where audio and camera will be controlled by an STM32F as a general-purpose peripheral (status is here: http://rhombus-tech.net/community_ideas/kde_tablet/news/)

before going for a 3rd revision of the PCB i'd very much appreciate some guidance on how to do this properly.  the original software i planned the schematics around does bit-banging in an ISR (https://github.com/adamgreig/followingrobot)

as the STM32F103VCT6 needs to do other tasks, 100% CPU load reading the camera data isn't acceptable!  so i have looked around and learned that it may be possible to read up to 6mhz of GPIO via DMA.  the problem i have is that it's an external pixel clock coming from the camera.

what i've done so far:

* confirmed with a scope that the camera runs (at 12mhz) by directing HSE to PA8 as a MCO

* confirmed that the camera is then contactable over I2C (it is)

* initialised it (successfully)

* asked it to set its Pixel Clock to 6mhz (also successful)

note here that whilst there is a master-clock in to the camera, the camera then has an *output* (called Pixel Clock) which, obviously, syncs the 8 (or 10) bits of data out.  there's also an HSYNC and a VSYNC output: these are also connected up to GPIO lines.

the next phase is, clearly, to read the data.  here is the plan that i believe is necessary:

* connect the camera's Pixel Clock line to e.g. PE0/TIM4_ETR

* set DMA2 to sync to TIM4

* set up DMA2 to do memory-to-memory transfer from PD8-15

* have EINT connect to the camera HSYNC line which starts DMA

the rest i can deal with (USB transfer of the data) but i wanted to get people's opinions on whether this looks like a viable plan.

i'm well aware that the STM32F207VCT6 already has DCMI but the project is cost-sensitive: although it would be nice to be capable of doing 720p24 using the STM32F207, we have to do 320x240 using a chip that's almost half the cost, first!

so - is there anything unreasonable about this plan to connect ETR to Timer to DMA to PD8-15 to USB? :)

thanks in advance for any guidance.

l.

2 REPLIES 2
zzdz2
Associate II
Posted on October 15, 2013 at 11:35

* set up DMA2 to do memory-to-memory transfer from PD8-15

 

mem2mem won't work it should be peripheral to mem.

IMO the whole setup might work if you are lucky, worth trying.

lkcl
Associate II
Posted on October 15, 2013 at 23:21

knik, hi, yes well spotted - in cut/paste of some code which does adc dma reading i noticed that one - thank you for confirming i'm on the right track!

i'm currently attempting just plain timer-controlled dma gpio reading: the next phase will be to do timer-externally-triggered.