2023-03-07 05:21 AM
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.
2023-03-07 05:52 AM
Couldn't you just simply set DCMI to 8-bit data?
JW
2023-03-07 06:16 AM
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.
2023-03-07 07:22 AM
Hello @Vojtěch Vrba
I am not sure if this helps but you may need to check AN5020. Hope 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.
2023-03-07 08:22 AM
Thanks, but no, this does not explain how to store D[9:2] to form 8-bit image in memory.
2023-03-07 08:27 AM
> 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
2023-03-07 08:41 AM
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.