cancel
Showing results for 
Search instead for 
Did you mean: 

Configuring DCMI / DMA to truncate 2 least significant bits of 10-bit pixel stream

vrbadev
Associate II

I currently use the STM32H7 MCU with CMOS monochrome imaging sensor connected via 10-bit parallel DCMI interface. However, when wired this way to the MCU the grayscale pixels are stored as 16-bit unsigned integers in the memory.

Is there any way to configure the DCMI peripheral (or the DMA transferring the pixel values to the SRAM memory) to truncate the 2 least significant bits of the values (so they can be stored as 8-bit unsigned integers)? I didn't find any solution or suggestions in the documentation of the peripherals.

Thanks for any help.

EDIT: The question is about the 2 least significant bits. The DCMI_D[1:0] are the least significant bits I need to remove and keep only DCMI_D[9:2]. The DMA/DCMI would have to be able to perform logical shift right by 2 bits to remove them and to get the desired 8-bit result, which is the point of this question.

6 REPLIES 6

Couldn't you just simply set DCMI to 8-bit data?

0693W00000aIO26QAG.png 

JW

No, because the pins DCMI_D[0] and DCMI_D[1] are the least significant bits. So I need to keep DCMI_D[9:2] when using 10-bit interface, not DCMI_D[7:0] as presented in the docs. I corrected the question to two least significant bits.

FBL
ST Employee

Hello @Vojtěch Vrba​ 

I am not sure if this helps but you may need to check AN5020. 0693W00000aIOOvQAO.pngHope this helps!

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


I'm out of offce with limited access to my emails.
Happy New Year!

Thanks, but no, this does not explain how to store D[9:2] to form 8-bit image in memory.

> No, because the pins DCMI_D[0] and DCMI_D[1] are the least significant bits. So I need to keep DCMI_D[9:2] when using 10-bit interface, not DCMI_D[7:0] as presented in the docs.

> The DMA/DCMI would have to be able to perform logical shift right by 2 bits to remove them

If you can't find it in RM, it's not there.

Meantime, couldn't you simply connect camera's data pins 2..9 to mcu's data pins 0..7?

JW

Well if the peripherals don't support it, I cannot do anything about it. I would have to desing a new PCB for the CMOS sensor to solve it by wiring the interface as you suggest.