2016-06-06 08:51 AM
I have the STM32F746 Discovery board and I have my project working with the OV9655 camera (which outputs RGB565).
I am trying to switch over to use the MT9V034 camera chip from Aptina/OnSemi, which outputs 8bit grayscale (really, it outputs 10bit, but I'm only using the top 8 bits). My problem can be replicated without a camera by initializing test pattern data into the camera buffer (in my project it's 0xC0260000 to 0xC027FE00). I'm filling with 0x00FF00FF (4 pixels, alternating black, white, black, white). I have selected CM_L8 as the input color and CM_ARGB8888 as the output color. My understanding is that L8 is 8-bit Luminance, meaning grayscale, so the conversion should basically copy the grayscale value into the R, G, and B portions of the new ARGB value and I�m forcing the Alpha to be FF, but here�s what I get: Input: 0x00FF00FF (4 pixels) Expected Out: 0x000000FF 0xFFFFFFFF 0x000000FF 0xFFFFFFFF (4 pixels) Actual Output: 0x64F356FF 0x426333FF 0x64F356FF 0x426333FF (4 pixels)Any assistance is greatly appreciated.
#dma2d-grayscale-monochrome2016-06-08 11:16 AM
We have resolved this issue by using DMA2D ColorMode A8 and setting the foreground color (FGCOLR register) to white and the background color (BGCOLR register) to black. The incoming pixels are then treated as an alpha value to blend black and white, and output the desired gray-scale values in ARGB8888 format.
We are not sure if this is the correct or best way, because we still haven't received any advice from ST forums or tech support, but it seems to work well. Here are the pertinent changes to DMA2D_Config.c, which is provided in the Camera-to-LCD example. /* Foreground Configuration */ hdma2d_eval.LayerCfg[1].AlphaMode = DMA2D_NO_MODIF_ALPHA; /* InputAlpha is used on two different registers! * Upper 8 bits hold the ALPHA value for the FGPFCCR or BGPFCCR registers (depending on layer). * Lower 24 bits hold the blending color FGCOLR or BGCOLR registers (depending on layer). */ hdma2d_eval.LayerCfg[1].InputAlpha = 0xFFFFFFFF; // Alpha and blending color for FGPFCCR and FGCOLR registers.2016-06-08 11:55 PM
> L8 is 8-bit Luminance, meaning grayscale,
No. From UM:
L field: luminance This field is the index to a CLUT to retrieve the three/four RGB/ARGB components. Disclaimer: I never used the DMA2D unit. JW2016-06-09 06:57 AM
So, what is ''monochrome format'', mentioned in section 17.6.2 of the STM32F746 Reference Manual (RM0385)?
2016-06-09 07:22 AM
I don't know. As I said, I never used these facilities, just read the RM.
My unqualified opinion is, that whole 17.6 subchapter is superfluous and only of ''glossy technicolour brochure'' value. There is nothing which would recognize the format of data and no way to tell the DCMI the format of data, except the data-chunk-packing and decimation facilities driven by fields in DCMI_CR. Particular settings of these then can be interpreted as ''can capture monochrome data'', but it would capture any 8-bit bus with signals acting as pixel clock and syncs in exactly the same way, whatever source and real meaning of those signals would be. Note that DCMI and DMA2D are two separate modules with no material relationship other than they both are hung onto the same bus. JW