Could STM32f429 save image data to sdram or sd card? Camera module outputs its data at a data rate of 50Mbit/s via 8 parallel ports. What I want to do is to save this data into the SDRAM or SD card as a file. It doesn't have to be sequence of files, because I need just one frame. In order to access the sd card, I would use SPI. But I wonder if there is any issue in this process. For example, one said that interrupts in cpu cause data loss and I must find FPGA or CPLD. But I'm afraid that I couldn't understand what he meant.

  • \$\begingroup\$ Are you using a specific device from the STM32F4 lineup? They differ quite a lot in terms of performance and peripherals available, the answer to your question will probably depend on the exact device you use. If possible link to a datasheet of the camera as well. \$\endgroup\$ – Arsenal Aug 6 '15 at 8:53
  • \$\begingroup\$ I added model number. But it's interesting that you mean some of the STM32F4 would be able to save data, but others wouldn't. Is it true? I heard that this is general issue for MCUs. \$\endgroup\$ – SD11 Aug 6 '15 at 9:19

As you are using one of the most powerful STM32F4, it might be possible. I haven't done something on the scale of that, but let's have a look at what the F429 can offer:

First to get the data (datasheet page 40):

Digital camera interface (DCMI)

The devices embed a camera interface that can connect with camera modules and CMOS sensors through an 8-bit to 14-bit parallel interface, to receive video data. The camera interface can sustain a data transfer rate up to 54 Mbyte/s at 54 MHz. It features:

• Programmable polarity for the input pixel clock and synchronization signals

• Parallel data communication can be 8-, 10-, 12- or 14-bit

• Supports 8-bit progressive video monochrome or raw bayer format, YCbCr 4:2:2 progressive video, RGB 565 progressive video or compressed data (like JPEG)

• Supports continuous mode or snapshot (a single frame) mode

• Capability to automatically crop the image

Sounds like a good fit for your application. You are running at 50Mbit/s (6.25MB/s), so it should be easily able to handle that and the interface is hopefully compatible with your camera module.

Next you will have to store that data somewhere. There are several options available there:

The SDIO interface supports a SD card with 4 bit data bus and 25MHz clock (refernece manual page 1013), so it should be able to put out the needed 6.25MB/s. I'm not sure about the overhead though. Also the question arises how you would handle a filesystem in that time. (How much data is actually needed?)

So another option is to use the external memory interface, the FMC. It offers a huge variety of options on what to use (see reference manual page 1588). At speeds up to 90MHz it should be able to easily cope with the 6.25MB/s.

At these kind of transaction speeds, you want to bring down the use of the core as much as possible. So you should use the DMA to handle most of the data shovelling. The DMA supports all the before mentioned peripherals, so it should be usable and doable.

Again, I haven't done anything on this scale and am mostly concerned with low power stuff, but based on the specs of the F429, it should be possible (not easily maybe but we all like a good challenge don't we?)

Edit: I just realized that you want to interface to the SD card via SPI. SPI won't cut it on the STM32F429 as it is limited to 45MBit/s, you have to use the mentioned SDIO interface for higher speeds.

  • \$\begingroup\$ Thank you for the nice explanation, but please let me ask once again. Could the interrupts make problem during the data writing process? I'm scared because one said that even we use DMA interrupts on cpu could cause some problem. I'm sorry for this question, but this is so serious for us that we would change whole plans, if it is the case... \$\endgroup\$ – SD11 Aug 6 '15 at 15:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.