用stm32l4r9i-disco开发,使用板子上带的390 x 390 DSI屏显示ARGB8888图片。具体用到了 DMA2D,GFXMMU和LTDC,但是显示有问题。图片一分为二,而且是从屏幕中间开始显示。请问各位有没有什么建议? 谢谢! 程序与st firmware 中的 DSI_CmdMode_SingleBuffer 类似, GFXMMU #if defined ( __ICCARM__ ) /* IAR Compiler */ #pragma data_alignment = 16 uint32_t PhysFrameBuffer0[121680];; //91260 121680 #elif defined (__GNUC__) /* GNU Compiler */ uint32_t PhysFrameBuffer0[121680] __attribute__ ((aligned (16))); #else /* ARM Compiler */ __align(16) uint32_t PhysFrameBuffer0[121680];; #endif __HAL_GFXMMU_RESET_HANDLE_STATE(&GfxmmuHandle); GfxmmuHandle.Instance = GFXMMU; GfxmmuHandle.Init.BlocksPerLine = GFXMMU_192BLOCKS; GfxmmuHandle.Init.DefaultValue = 0xFFFFFFFF; GfxmmuHandle.Init.Buffers.Buf0Address = (uint32_t) PhysFrameBuffer0; GfxmmuHandle.Init.Buffers.Buf1Address = 0; /* Not Used */ GfxmmuHandle.Init.Buffers.Buf2Address = 0; /* Not Used */ GfxmmuHandle.Init.Buffers.Buf3Address = 0; /* Not Used */ GfxmmuHandle.Init.Interrupts.Activation = DISABLE; //DISABLE GfxmmuHandle.Init.Interrupts.UsedInterrupts = GFXMMU_AHB_MASTER_ERROR_IT; /* Not Used - GFXMMU_AHB_MASTER_ERROR_IT*/ if(HAL_OK != HAL_GFXMMU_Init(&GfxmmuHandle)) { return(LCD_ERROR); } /* Initialize LUT */ if(HAL_OK != HAL_GFXMMU_ConfigLut(&GfxmmuHandle, GFXMMU_LUT_FIRST, GFXMMU_LUT_LAST, (uint32_t) gfxmmu_lut_config_32)) { return(LCD_ERROR); } /* Disable non visible lines : from line 390 to 1023 (634 lines) */ if(HAL_OK != HAL_GFXMMU_DisableLutLines(&GfxmmuHandle, 390, 634)) { return(LCD_ERROR); } LTDC __HAL_LTDC_RESET_HANDLE_STATE(&LtdcHandle); LtdcHandle.Instance = LTDC; LtdcHandle.Init.HSPolarity = LTDC_HSPOLARITY_AL; LtdcHandle.Init.VSPolarity = LTDC_VSPOLARITY_AL; LtdcHandle.Init.DEPolarity = LTDC_DEPOLARITY_AL; LtdcHandle.Init.PCPolarity = LTDC_PCPOLARITY_IPC; LtdcHandle.Init.HorizontalSync = 0; /* HSYNC width - 1 */ LtdcHandle.Init.VerticalSync = 0; /* VSYNC width - 1 */ LtdcHandle.Init.AccumulatedHBP = 1; /* HSYNC width + HBP - 1 */ LtdcHandle.Init.AccumulatedVBP = 1; /* VSYNC width + VBP - 1 */ LtdcHandle.Init.AccumulatedActiveW = 391; /* HSYNC width + HBP + Active width - 1 */ LtdcHandle.Init.AccumulatedActiveH = 391; /* VSYNC width + VBP + Active height - 1 */ LtdcHandle.Init.TotalWidth = 392; /* HSYNC width + HBP + Active width + HFP - 1 */ LtdcHandle.Init.TotalHeigh = 392; /* VSYNC width + VBP + Active height + VFP - 1 */ LtdcHandle.Init.Backcolor.Red = 0; /* Not used default value */ LtdcHandle.Init.Backcolor.Green = 0; /* Not used default value */ LtdcHandle.Init.Backcolor.Blue = 0; /* Not used default value */ LtdcHandle.Init.Backcolor.Reserved = 0xFF; if(HAL_LTDC_Init(&LtdcHandle) != HAL_OK) { return(LCD_ERROR); } /* LTDC layer 1 configuration */ LayerCfg.WindowX0 = 0; LayerCfg.WindowX1 = 390; LayerCfg.WindowY0 = 0; LayerCfg.WindowY1 = 390; LayerCfg.PixelFormat = LTDC_PIXEL_FORMAT_ARGB8888; LayerCfg.Alpha = 0xFF; /* NU default value */ LayerCfg.Alpha0 = 0; /* NU default value */ LayerCfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_PAxCA; /* Not Used: default value */ LayerCfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_PAxCA; /* Not Used: default value */ LayerCfg.FBStartAdress = LAYER_ADDRESS_0; LayerCfg.ImageWidth = 390; LayerCfg.ImageHeight = 390; LayerCfg.Backcolor.Red = 0; /* Not Used: default value */ LayerCfg.Backcolor.Green = 0; /* Not Used: default value */ LayerCfg.Backcolor.Blue = 0; /* Not Used: default value */ LayerCfg.Backcolor.Reserved = 0xFF; if(HAL_LTDC_ConfigLayer(&LtdcHandle, &LayerCfg, 0) != HAL_OK) //LTDC_LAYER_1 --> 0 { return(LCD_ERROR); } if (HAL_LTDC_SetPitch(&LtdcHandle, 768, 0) != HAL_OK) { Error_Handler(); } DMA2D static void CopyInVirtualBuffer_single(uint32_t *pSrc, uint32_t *pDst, uint16_t xsize, uint16_t ysize) { //uint32_t destination = (uint32_t)pDst + (y * 768 + x) * 4; //390 -> 768 uint32_t source = (uint32_t)pSrc; Dma2dHandle.Instance = DMA2D; /*##-1- Configure the DMA2D Mode, Color Mode and output offset #############*/ Dma2dHandle.Init.Mode = DMA2D_M2M; Dma2dHandle.Init.ColorMode = DMA2D_OUTPUT_ARGB8888; Dma2dHandle.Init.OutputOffset = 768 - xsize; // Dma2dHandle.Init.AlphaInverted = DMA2D_REGULAR_ALPHA; /* No Output Alpha Inversion */ Dma2dHandle.Init.RedBlueSwap = DMA2D_RB_REGULAR; /* No Output Red & Blue swap */ Dma2dHandle.Init.BytesSwap = DMA2D_BYTES_REGULAR; /* Regular output byte order */ Dma2dHandle.Init.LineOffsetMode = DMA2D_LOM_PIXELS; /* Pixel mode */ /*##-2- Foreground Configuration ###########################################*/ Dma2dHandle.LayerCfg[1].InputColorMode = DMA2D_INPUT_ARGB8888; Dma2dHandle.LayerCfg[1].InputOffset = 0; Dma2dHandle.LayerCfg[1].AlphaMode = DMA2D_NO_MODIF_ALPHA; Dma2dHandle.LayerCfg[1].InputAlpha = 0; /* Not used */ Dma2dHandle.LayerCfg[1].RedBlueSwap = DMA2D_RB_REGULAR; //DMA2D_RB_REGULAR; /* No ForeGround Red/Blue swap */ Dma2dHandle.LayerCfg[1].AlphaInverted = DMA2D_REGULAR_ALPHA; /* No ForeGround Alpha inversion */ /* DMA2D Initialization */ if(HAL_DMA2D_Init(&Dma2dHandle) == HAL_OK) { if(HAL_DMA2D_ConfigLayer(&Dma2dHandle, 1) == HAL_OK) { if (HAL_DMA2D_Start(&Dma2dHandle, source, LAYER_ADDRESS_0, xsize, ysize) == HAL_OK) { /* Polling For DMA transfer */ HAL_DMA2D_PollForTransfer(&Dma2dHandle, 10); } } } } |
STM32H750的AD采样问题
加速度计非线性度参数
LSM6DSR是左手坐标系吗?
比LIS3DH更稳定的超低功耗加速度计有哪些可选择?
LSM6DS3TR-C使用时工作电流比datasheet上大很多可能是什么原因?
lsm6dsl的sensor hub驱动LIS2MDL问题
求一款3轴MEMS加速度计,超低功耗,可唤醒发中断信号的芯片
stm32h503的i3c读写lsm6dso失败问题咨询
关于LIS2HH12TR 读加速度计的问题
LSM6DS3TR-C数据读取异常
DMA2D的input是ARGB8888,但是output需要定义为RGB。
ldtc 的 pixel format 改为 rgb888
setpitch 为 1024.
dma2d 的 color mode 改为 output rgb888.
可不可以告诉我这个显示屏怎么用,怎么显示我想要它的内容,想设计一个数字锁触摸,有没有手册啊