So I have this project in my mind where I want to read pixel data from an image sensor via a microcontroller (e.g. STM32F103) and then display the image on a screen.

The image sensor I have in mind is the AR0103CS which is capable of max. 1280 x 960 @ 45 fps. I am aware that the Cortex-M3 is not able to handle 45fps but I am pretty sure that 1 or two pictures per second are possible.

Now there is a problem: The image sensor expects either a direct clock input of 74.25MHz or something inbetween 6 - 50 MHz (the AR0103CS would then increase this input clock to 74.25MHz with its own built-in PLL). In either case it is going to put out one pixel data (12-bit parallel) after the other in a progressive scan-line fashion at a rate of 74.25MHz.

I currently don't know if the STM32F103 is able to generate something above 50MHz as output clock (I think the GPIOs max out in high-speed mode at 50MHz)? Is there a way to route a timer to a pin which could then be used as the input clock?

Even if the STM32 isn't able to create 74.25MHz for the image sensor, I can still go with something lower in the range of 6 - 50MHz as the mentioned PLL will generate the necessary system clock for the sensor.

But in this case the Pixel-Clock-Output signal from the sensor (PXCLK) is still going to be 74.25MHz. This means I have to be able to read values from 12 GPIO pins at a rate of 74.25MHz for a short time frame (16.55ms to be exact).

The way I thought this could work is to create an interrupt for a specific GPIO which is in input mode and receives the PXCLK signal from the sensor. Every time the input value goes from low to high, an interrupt is generated.

In this interrupt handler I then read from 12 GPIO pins. In the 8-bit uC I worked with, the values of 8 GPIOs were combined into a single register such that one is able to read them in parallel. As the STM32 is a 32-bit CPU I don't know if there is a Port with 12 or more GPIOs which can be read in parallel?

Maybe there is other kind of hardware on the STM32 which is more high-speed because I assume doing this with GPIOs is not the best way possible.

Anyway, someone where who has more expertise with this controller and what it is capable of?

  • 1
    \$\begingroup\$ There are many stm32 parts with a DCMI peripheral, this would make your life a lot easier \$\endgroup\$ – Colin May 19 '20 at 11:05
  • \$\begingroup\$ Thank you! Never heard about that. \$\endgroup\$ – binaryBigInt May 19 '20 at 11:27

No, it simply is not capable in any way. The F103 MCU has a maximum frequency of 72 MHz so it cannot do anything past that, and it has no DCMI camera interface to assist in receiving parallel video data either.

  • \$\begingroup\$ It is possible to overclock the STM32F103 to 128MHz: amitesh-singh.github.io/stm32/2018/06/17/… \$\endgroup\$ – binaryBigInt May 19 '20 at 11:23
  • 1
    \$\begingroup\$ @binaryBigInt Read that page carefully. The author was able to overclock the board they had...that's no guarantee that you can overclock the one on your bench. Overclocking makes USB unusable...what else stops working? How long will the board function reliably when overclocked? Does it overheat? Do you need to increase the supply voltage? \$\endgroup\$ – Elliot Alderson May 19 '20 at 13:27
  • 1
    \$\begingroup\$ Additionally there's nowhere to put the data. \$\endgroup\$ – Chris Stratton May 19 '20 at 13:45
  • \$\begingroup\$ @ElliotAlderson You are absolutely correct. But as I am a pure hoobyist I am willing to "take the risk". Chris: You are right, I thought about directly streaming the data to the display without storing more than, let's say, a few kbytes. I find it quite frustrating why the image sensor has to run at such a high speed when there really is no need for it (in case one doesn't need 45 or 60fps, a much lower PXCLK would do the job as well) \$\endgroup\$ – binaryBigInt May 19 '20 at 16:21
  • 1
    \$\begingroup\$ No need to take the risk - there is no way you can receive data, you can't even make a loop so tight to receive data even by overclocking. You have the wrong MCU or wrong camera and they don't work together. \$\endgroup\$ – Justme May 19 '20 at 17:19

Your Answer

