你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

12
返回列表 发新帖
楼主: wenyangzeng

[STM32F769-DISC] 【F769IDISCOVERY评测】评测三 硬件JPEG解码

[复制链接]

68

主题

3266

回帖

82

蝴蝶豆

社区小助手

最后登录
2020-12-9
 楼主| 发表于 2017-5-23 09:59:49 | 显示全部楼层
本帖最后由 wenyangzeng 于 2017-5-23 19:12 编辑
hpdell 发表于 2017-5-23 09:31
你好,硬件解码 jpg ,可否实现横竖屏显示功能啊 ??

这个一定可以的,关键在TFT初始化参数中关于横屏或竖屏的寄存器配置参数,比如SD1289的寄存器配置:
无标题.png

F769IDISCOVERY使用的是otm8009a。那就要去参考它的手册了。
otm8009a.rar (10.54 KB, 下载次数: 1)
回复 支持 反对

使用道具 举报

227

主题

601

回帖

32

蝴蝶豆

金牌会员

最后登录
2020-11-10
发表于 2017-5-23 19:28:31 | 显示全部楼层
本帖最后由 hpdell 于 2017-5-23 19:33 编辑
wenyangzeng 发表于 2017-5-23 09:59
这个一定可以的,关键在TFT初始化参数中关于横屏或竖屏的寄存器配置参数,比如SD1289的寄存器配置:

我现在使用的是rgb转 lvds的,没有寄存器可以设置,只有外部的 U/D, L/R 控制方向,但是这个控制方向是固定的,

那么使用硬件 解码 jpg 的话,实现四个方向的显示,该如何修改 硬件解码的显示函数啊 ??
另外我使用st官网提供的历程,使用 硬件 的dma功能解码 jpg 图片时,显示错位了,使用中断模式时,显示正常,

使用dma或者中断都是从sd卡读取相同的图片,那么这个dma模式解码出现图片错位的情况,是哪里没有对齐还是 ??????
回复 支持 反对

使用道具 举报

68

主题

3266

回帖

82

蝴蝶豆

社区小助手

最后登录
2020-12-9
 楼主| 发表于 2017-5-23 21:40:25 | 显示全部楼层
本帖最后由 wenyangzeng 于 2017-5-23 22:10 编辑
hpdell 发表于 2017-5-23 19:28
我现在使用的是rgb转 lvds的,没有寄存器可以设置,只有外部的 U/D, L/R 控制方向,但是这个控制方向是固 ...

OTM8009A寄存器的操作是在对OTM8009初始化函数里的:
  1. uint8_t OTM8009A_Init(uint32_t ColorCoding, uint32_t orientation)
  2. {
  3.   /* Enable CMD2 to access vendor specific commands                               */
  4.   /* Enter in command 2 mode and set EXTC to enable address shift function (0x00) */
  5.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
  6.   DSI_IO_WriteCmd( 3, (uint8_t *)lcdRegData1);

  7.   /* Enter ORISE Command 2 */
  8.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData2); /* Shift address to 0x80 */
  9.   DSI_IO_WriteCmd( 2, (uint8_t *)lcdRegData2);

  10.   /////////////////////////////////////////////////////////////////////
  11.   /* SD_PCH_CTRL - 0xC480h - 129th parameter - Default 0x00          */
  12.   /* Set SD_PT                                                       */
  13.   /* -> Source output level during porch and non-display area to GND */
  14.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData2);
  15.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData3);
  16.   OTM8009A_IO_Delay(10);
  17.   /* Not documented */
  18.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData4);
  19.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData5);
  20.   OTM8009A_IO_Delay(10);
  21.   /////////////////////////////////////////////////////////////////////

  22.   /* PWR_CTRL4 - 0xC4B0h - 178th parameter - Default 0xA8 */
  23.   /* Set gvdd_en_test                                     */
  24.   /* -> enable GVDD test mode !!!                         */
  25.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData6);
  26.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData7);

  27.   /* PWR_CTRL2 - 0xC590h - 146th parameter - Default 0x79      */
  28.   /* Set pump 4 vgh voltage                                    */
  29.   /* -> from 15.0v down to 13.0v                               */
  30.   /* Set pump 5 vgh voltage                                    */
  31.   /* -> from -12.0v downto -9.0v                               */
  32.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData8);
  33.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData9);

  34.   /* P_DRV_M - 0xC0B4h - 181th parameter - Default 0x00 */
  35.   /* -> Column inversion                                */
  36.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData10);
  37.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData11);

  38.   /* VCOMDC - 0xD900h - 1st parameter - Default 0x39h */
  39.   /* VCOM Voltage settings                            */
  40.   /* -> from -1.0000v downto -1.2625v                 */
  41.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
  42.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData12);

  43.   /* Oscillator adjustment for Idle/Normal mode (LPDT only) set to 65Hz (default is 60Hz) */
  44.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData13);
  45.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData14);

  46.   /* Video mode internal */
  47.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData15);
  48.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData16);

  49.   /* PWR_CTRL2 - 0xC590h - 147h parameter - Default 0x00 */
  50.   /* Set pump 4&5 x6                                     */
  51.   /* -> ONLY VALID when PUMP4_EN_ASDM_HV = "0"           */
  52.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData17);
  53.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData18);

  54.   /* PWR_CTRL2 - 0xC590h - 150th parameter - Default 0x33h */
  55.   /* Change pump4 clock ratio                              */
  56.   /* -> from 1 line to 1/2 line                            */
  57.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData19);
  58.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData9);

  59.   /* GVDD/NGVDD settings */
  60.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
  61.   DSI_IO_WriteCmd( 2, (uint8_t *)lcdRegData5);

  62.   /* PWR_CTRL2 - 0xC590h - 149th parameter - Default 0x33h */
  63.   /* Rewrite the default value !                           */
  64.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData20);
  65.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData21);

  66.   /* Panel display timing Setting 3 */
  67.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData22);
  68.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData23);

  69.   /* Power control 1 */
  70.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData24);
  71.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData25);

  72.   /* Source driver precharge */
  73.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData13);
  74.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData26);

  75.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData15);
  76.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData27);

  77.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData28);
  78.   DSI_IO_WriteCmd( 2, (uint8_t *)lcdRegData6);

  79.   /* GOAVST */
  80.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData2);
  81.   DSI_IO_WriteCmd( 6, (uint8_t *)lcdRegData7);

  82.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData29);
  83.   DSI_IO_WriteCmd( 14, (uint8_t *)lcdRegData8);

  84.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData30);
  85.   DSI_IO_WriteCmd( 14, (uint8_t *)lcdRegData9);

  86.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData31);
  87.   DSI_IO_WriteCmd( 10, (uint8_t *)lcdRegData10);

  88.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData32);
  89.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData46);

  90.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData2);
  91.   DSI_IO_WriteCmd( 10, (uint8_t *)lcdRegData11);

  92.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData33);
  93.   DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData12);

  94.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData29);
  95.   DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData13);

  96.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData30);
  97.   DSI_IO_WriteCmd( 10, (uint8_t *)lcdRegData14);

  98.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData31);
  99.   DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData15);

  100.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData32);
  101.   DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData16);

  102.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData34);
  103.   DSI_IO_WriteCmd( 10, (uint8_t *)lcdRegData17);

  104.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData35);
  105.   DSI_IO_WriteCmd( 10, (uint8_t *)lcdRegData18);

  106.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData2);
  107.   DSI_IO_WriteCmd( 10, (uint8_t *)lcdRegData19);

  108.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData33);
  109.   DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData20);

  110.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData29);
  111.   DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData21);

  112.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData30);
  113.   DSI_IO_WriteCmd( 10, (uint8_t *)lcdRegData22);

  114.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData31);
  115.   DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData23);

  116.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData32);
  117.   DSI_IO_WriteCmd( 15, (uint8_t *)lcdRegData24);

  118.   /////////////////////////////////////////////////////////////////////////////
  119.   /* PWR_CTRL1 - 0xc580h - 130th parameter - default 0x00 */
  120.   /* Pump 1 min and max DM                                */
  121.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData13);
  122.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData47);
  123.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData48);
  124.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData49);
  125.   /////////////////////////////////////////////////////////////////////////////

  126.   /* Exit CMD2 mode */
  127.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
  128.   DSI_IO_WriteCmd( 3, (uint8_t *)lcdRegData25);

  129.   /*************************************************************************** */
  130.   /* Standard DCS Initialization TO KEEP CAN BE DONE IN HSDT                   */
  131.   /*************************************************************************** */

  132.   /* NOP - goes back to DCS std command ? */
  133.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
  134.          
  135.   /* Gamma correction 2.2+ table (HSDT possible) */
  136.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
  137.   DSI_IO_WriteCmd( 16, (uint8_t *)lcdRegData3);
  138.   
  139.   /* Gamma correction 2.2- table (HSDT possible) */
  140.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);
  141.   DSI_IO_WriteCmd( 16, (uint8_t *)lcdRegData4);
  142.          
  143.   /* Send Sleep Out command to display : no parameter */
  144.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData36);
  145.   
  146.   /* Wait for sleep out exit */
  147.   OTM8009A_IO_Delay(120);

  148.   switch(ColorCoding)
  149.   {
  150.   case OTM8009A_FORMAT_RBG565 :
  151.     /* Set Pixel color format to RGB565 */
  152.     DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData37);
  153.     break;
  154.   case OTM8009A_FORMAT_RGB888 :
  155.     /* Set Pixel color format to RGB888 */
  156.     DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData38);
  157.     break;
  158.   default :
  159.     break;
  160.   }

  161.   /* Send command to configure display in landscape orientation mode. By default
  162.       the orientation mode is portrait  */
  163.   if(orientation == OTM8009A_ORIENTATION_LANDSCAPE)
  164.   {
  165.     DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData39);
  166.     DSI_IO_WriteCmd( 4, (uint8_t *)lcdRegData27);
  167.     DSI_IO_WriteCmd( 4, (uint8_t *)lcdRegData28);
  168.   }

  169.   /** CABC : Content Adaptive Backlight Control section start >> */
  170.   /* Note : defaut is 0 (lowest Brightness), 0xFF is highest Brightness, try 0x7F : intermediate value */
  171.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData40);

  172.   /* defaut is 0, try 0x2C - Brightness Control Block, Display Dimming & BackLight on */
  173.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData41);

  174.   /* defaut is 0, try 0x02 - image Content based Adaptive Brightness [Still Picture] */
  175.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData42);

  176.   /* defaut is 0 (lowest Brightness), 0xFF is highest Brightness */
  177.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData43);

  178.   /** CABC : Content Adaptive Backlight Control section end << */

  179.   /* Send Command Display On */
  180.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData44);

  181.   /* NOP command */
  182.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData1);

  183.   /* Send Command GRAM memory write (no parameters) : this initiates frame write via other DSI commands sent by */
  184.   /* DSI host from LTDC incoming pixels in video mode */
  185.   DSI_IO_WriteCmd(0, (uint8_t *)ShortRegData45);

  186.   return 0;
  187. }
复制代码
对其他型号TFT的初始化都类似,横屏或竖屏的参数就在初始化中设定。
再举一例RA8875横、竖屏:
  1. void RA8875_InitHard(void)
  2. {                        
  3.         RA8875_WriteCmd(0x88);// 初始化PLL.  晶振频率为25M
  4.         RA8875_Delaly1us();                // 延迟1us */
  5.         RA8875_WriteData(9);        // PLLDIVM [7] = 0 ;  PLLDIVN [4:0] = 10 */
  6.         RA8875_Delaly1ms();
  7.         RA8875_WriteCmd(0x89);
  8.         RA8875_Delaly1us();               
  9.         RA8875_WriteData(2);        //PLLDIVK[2:0] = 2, 除以4
  10.         /* REG[88h]或REG[89h]被设定后,为保证PLL 输出稳定,须等待一段「锁频时间」(< 100us)。*/
  11.         RA8875_Delaly1ms();
  12.         RA8875_WriteReg(0x10, (1 <<3 ) | (1 << 1));        /* 配置16位MCU并口,65K色 */
  13.   RA8875_WriteReg(0x04, 0x81);
  14.         RA8875_Delaly1ms();
  15.         /* OTD9960 & OTA7001 设置 */
  16.         RA8875_WriteReg(0x14, 0x63);
  17.         RA8875_WriteReg(0x15, 0x00);
  18.         RA8875_WriteReg(0x16, 0x03);
  19.         RA8875_WriteReg(0x17, 0x03);
  20.         RA8875_WriteReg(0x18, 0x0B);
  21.         RA8875_WriteReg(0x19, 0xDF);
  22.         RA8875_WriteReg(0x1A, 0x01);
  23.         RA8875_WriteReg(0x1B, 0x1F);
  24.         RA8875_WriteReg(0x1C, 0x00);
  25.         RA8875_WriteReg(0x1D, 0x16);
  26.         RA8875_WriteReg(0x1E, 0x00);
  27.         RA8875_WriteReg(0x1F, 0x01);
  28.         RA8875_WriteReg(0xC7, 0x01);        
  29.         RA8875_WriteReg(0x01, 0x80);
  30.         RA8875_WriteReg(0x40, 0x01);        // 选择绘图模式
  31.         RA8875_WriteReg(0x41, 0x00);        //选择绘图模式, 目的为CGRAM
  32.        RA8875_SetDispWin(0, 0, LCD_HEIGHT, LCD_WIDTH);
  33.       RA8875_WriteReg(0x20, (1 << 3));            // 水平扫描方向设定
  34. // RA8875_WriteReg(0x20, (1 << 2));            // 垂直扫描方向设定
  35.      RA8875_SetBackLight(150);

  36. }
复制代码




回复 支持 反对

使用道具 举报

91

主题

4603

回帖

4

蝴蝶豆

论坛元老

最后登录
2020-12-8
发表于 2017-5-29 23:25:50 | 显示全部楼层
wenyangzeng 发表于 2017-5-23 09:59
这个一定可以的,关键在TFT初始化参数中关于横屏或竖屏的寄存器配置参数,比如SD1289的寄存器配置:

0.png
回复 支持 反对

使用道具 举报

0

主题

32

回帖

0

蝴蝶豆

初级会员

最后登录
2020-2-13
发表于 2020-2-5 17:48:49 | 显示全部楼层
这什么图片,看着
回复 支持 反对

使用道具 举报

68

主题

3266

回帖

82

蝴蝶豆

社区小助手

最后登录
2020-12-9
 楼主| 发表于 2020-2-6 09:57:52 | 显示全部楼层

显微镜下的细菌
回复 支持 反对

使用道具 举报

关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
STM32N6 AI生态系统
STM32MCU,MPU高性能GUI
ST ACEPACK电源模块
意法半导体生物传感器
STM32Cube扩展软件包
关注我们
st-img 微信公众号
st-img 手机版