KurtE
Senior Member+
Quick follow up: @mjs513 and myself are making some progress on some of the above 
For now, I turned off the output rotation, to make it easier to concentrate on the other stuff.
We fixed the issues with it wiping out memory. I am running a variant of the function mentioned earlier that has
a lot of input parameters. I am also bypassing some of the functions in the library.
The key to not screwing up memory is to make sure the PITCH members are correct as well as the OUT_PS_LRC.
Some answers to the above:
a) output image one or both directions is smaller than the screen. You set the: OUT_PS_ULC and OUT_PS_LRC,
to the offsets to where the image should start and image should end within your output buffer, like:
When the actual size of the output is in:
b) and c) - Input image clipping - You setup the PS_BUF: 70000020 to the
memory address of the first pixel you wish to output: That is if you wish for your image to start at ROW: 50 COL: 100,
you would setup the buffer to something like buffer + (50 * CAMERA_WIDTH + 100)
You need to make sure that the pitch is set properly such that it will increment the correct number of bytes per row.
It is also up to your code to make sure that your offsets are correct in that you don't extend outside the bounds of your actual image.
With the above understanding, the sketch is now setup to allow me to type in a scale factor and it now centers and/or clips the images.
Which is working better. Started off doing this with VGA input using HM0360 as being monochrome, the VGA image will fit into normal memory.
I am now playing again with the OV5640 and trying VGA/SVGA, which requires PSRAM on T4.1. Having some luck, but there are issues
with the PSRAM, probably not keeping up. It is doing better now that I updated it to run at 120mhz:
Changed in startup.c (configure_external_ram):
I tried the 133Mhz version, but it failed to work on the current board.
Next up: A little more trying to get the PSRAM sizes to work.
Then to add some support into the sketch that when zoomed in, add panning of the camera area...
For now, I turned off the output rotation, to make it easier to concentrate on the other stuff.
We fixed the issues with it wiping out memory. I am running a variant of the function mentioned earlier that has
a lot of input parameters. I am also bypassing some of the functions in the library.
The key to not screwing up memory is to make sure the PITCH members are correct as well as the OUT_PS_LRC.
Some answers to the above:
a) output image one or both directions is smaller than the screen. You set the: OUT_PS_ULC and OUT_PS_LRC,
to the offsets to where the image should start and image should end within your output buffer, like:
Code:
OUT_PS_ULC: 40, 10
OUT_PS_LRC: 439,309
Code:
OUT_LRC: 479,319
b) and c) - Input image clipping - You setup the PS_BUF: 70000020 to the
memory address of the first pixel you wish to output: That is if you wish for your image to start at ROW: 50 COL: 100,
you would setup the buffer to something like buffer + (50 * CAMERA_WIDTH + 100)
You need to make sure that the pitch is set properly such that it will increment the correct number of bytes per row.
It is also up to your code to make sure that your offsets are correct in that you don't extend outside the bounds of your actual image.
With the above understanding, the sketch is now setup to allow me to type in a scale factor and it now centers and/or clips the images.
Which is working better. Started off doing this with VGA input using HM0360 as being monochrome, the VGA image will fit into normal memory.
I am now playing again with the OV5640 and trying VGA/SVGA, which requires PSRAM on T4.1. Having some luck, but there are issues
with the PSRAM, probably not keeping up. It is doing better now that I updated it to run at 120mhz:
Changed in startup.c (configure_external_ram):
Code:
CCM_CBCMR = (CCM_CBCMR & ~(CCM_CBCMR_FLEXSPI2_PODF_MASK | CCM_CBCMR_FLEXSPI2_CLK_SEL_MASK))
| CCM_CBCMR_FLEXSPI2_PODF(5) | CCM_CBCMR_FLEXSPI2_CLK_SEL(1); // 720/5 = 120 MHz
I tried the 133Mhz version, but it failed to work on the current board.
Next up: A little more trying to get the PSRAM sizes to work.
Then to add some support into the sketch that when zoomed in, add panning of the camera area...