2025-06-04 8:07 PM - last edited on 2025-06-05 2:43 AM by Andrew Neil
I am using the STM32N6570-DK kit, and I want to use the camera to capture 224*160 size image, but I don't know how to do this, the sample programs are all about 800*480,and I can't understand the configuration of the downsize.
The lines below can change the original 2592*1944 size into 800*480, but how? When initializing the IMX335 sensor, it was set to capture the 2592*1944 size image.
/* Configure the downsize */
DonwsizeConf.HRatio = 25656;
DonwsizeConf.VRatio = 33161;
DonwsizeConf.HSize = 800;
DonwsizeConf.VSize = 480;
DonwsizeConf.HDivFactor = 316;
DonwsizeConf.VDivFactor = 253;
2025-06-12 12:21 AM
Hi @Z-YF,
Were you able to understand this configuration? If yes, could you please share the details with me?
2025-06-12 3:03 AM - edited 2025-06-12 3:12 AM
Hi everyone,
I am currently working with the MB1854B ST camera module and have successfully changed the camera resolutionfrom default configuration 2592x1944 to 256x256. However, the image now appears too small on the display, making it difficult to view clearly.
I would like to scale up the image feed on the LCD screen while keeping the camera resolution at 256x256, in order to make the image more visible.
While reviewing the code, I came across parameters in MX_DCMIPP_Init() function that were previously used to map a 2592x1944 camera resolution to an 800x480 LCD screen.
I believe modifying similar parameters could help scale the 256x256 image appropriately on the LCD.
DonwsizeConf.HRatio = 25656;
DonwsizeConf.VRatio = 33161;
DonwsizeConf.HSize = 800;
DonwsizeConf.VSize = 480;
DonwsizeConf.HDivFactor = 316;
DonwsizeConf.VDivFactor = 253;
These parameters appear to be located at line 389 in the code. However, there is no documentation or tutorial explaining how to adjust these values correctly.
Could someone please guide me on how to properly modify these parameters to achieve the desired scaling effect on the LCD?
2025-06-12 8:20 AM - edited 2025-06-12 8:20 AM
Hello,
For downsize , refer to the chapter 39.7.4 Downsize in the referance Manual of N6 for software configuration:
STM32N647/657xx Arm<Sup>®</Sup>-based 32-bit MCUs - Reference manual
For each value a formula is provided withinregiter description part (sections 39.14.71 & 39.14.72)
The division factor is an unsigned integer based on the source/destination ratio:
div = max(int(1024 / (source/destination)), 1023)
The down scale ratio is expressed in unsigned 3.13 format:
ratio = max(int((SourceSize - 1) / (DestinationSize -1)) * 8192), 8 * 8192 - 1)
Best Regards.
2025-06-13 12:46 AM
I think it is duplicate of this.
2025-06-13 12:47 AM
Hi @Ch_JE ,
I believe both of the formulas should use min instead of max, as I was calculating the default configuration required to downsize a 2592x1944 camera resolution to 800x480 for the LCD on the STM32N6570-DK. Based on the formula from 39.14.71, the result would be:
HDivFactor = max(int(1024/(2592/800)),1023)
= max(int(316.04),1023)
= 1023
But in the default configuration here (Line 393) it is given to be
DonwsizeConf.HDivFactor = 316;
Similarly, I think this applies to the other three parameters as well. Could you kindly confirm this?
2025-06-13 1:09 AM
Yeah, but I believe this error is caused by floating-point number calculation. I have not tried the new one, but I believe both will work.
2025-06-19 2:33 AM
Hello mr,@athern27 .
I came across your post where you mentioned:
"I am currently working with the MB1854B ST camera module and have successfully changed the camera resolution from the default configuration of 2592x1944 to 256x256."
1.Could you please explain how you were able to change the resolution from 2592x1944 to 256x256 ?
2.Did you modify any camera register values to achieve this?
3.If possible, could you share the part of the firmware where the resolution change was made?
It would be very helpful if you could provide the modified section of the code .
Thank you!
2025-06-27 1:41 AM
hello @athern27 .
You mentioned that you successfully configured the IMX335 sensor to output from 2592x1944 down to 256x256 resolution using window cropping.
I'm trying to configure the sensor to output at 640x480 resolution, but it’s not working as expected. Below are the changes I’ve made, based on the datasheet (Window Cropping Mode):
1 . HNUM
{0x302e, 0x80},
{0x302f, 0x02}, // 0x0280 = 640 pixels
2 . AREA3_WIDTH_1
{0x3076, 0xc0},
{0x3077, 0x03}, // 0x03C0 = 960 (480 lines * 2)
>>> Set AREA3_WIDTH_1 to twice the number of the lines . given in datasheet
3. Y_OUT_SIZE
{0x3056, 0xe0},
{0x3057, 0x01}, // 0x01E0 = 480 lines
4. changes for DCMIPP Configuration.
pPipeConf.PixelPipePitch = 1280 ; // 640 * 2
DonwsizeConf.HSize = 640 ; //800 ;
DonwsizeConf.VSize = 480 ;
5 . changes for LTDC Configuration :
pLayerCfg.WindowX0 = 0;
pLayerCfg.WindowX1 = 640 ; //Width;
pLayerCfg.WindowY0 = 0;
pLayerCfg.WindowY1 = 480 ; //Height;
Even after applying all these settings, the image appears not as expected on the display.
Could anyone please help me understand what might be missing here?
@athern27 — If possible, could you please share your working source code and sensor config ZIP file?
Any help from the community would be greatly appreciated.
Thank you!