在线时间410 小时
UID3006061
注册时间2015-3-23
NXP金币1264
TA的每日心情 | 开心 昨天 17:11 |
---|
签到天数: 821 天 [LV.10]以坛为家III
金牌会员
- 积分
- 5522
- 最后登录
- 2024-4-27
|
本帖最后由 leo121_3006061 于 2024-4-4 19:57 编辑
今天主要学习flexio来驱动16bit mpu8080 接口的TFT_LCD并记录下来和大家分享我的学习过程,flexio可以实现很多功能,例如pwm,can,spi,模拟camera,可见功能强大,开始本次实验之前,首先回顾以下mcxn947芯片的诸多令人兴奋的新特性。
FeaturesCore Platform- Arm® Cortex®-M33 @ 150 MHz (Dual core)
- DSP Accelerator (PowerQUAD, with Co-Processor interface)
- SmartDMA (co-processor for applications such as parallel camera interface and keypad scanning)
- eIQ® Neutron N1-16 Neural Processing Unit
- Power Line Communications (PLC) Controller
Memory- Up to 2 MB (2 x 1MB Bank) on chip Flash
- Supporting Flash Swap and Read While Write
- Cache Engine with 16 KB RAM
- Up to 512 KB RAM, configurable as up to 416 KB with ECC (support single bit correction two bits detection)
- Up to 4x 8 KB ECC RAM can be retained down to VBAT mode
- FlexSPI with 16 KB cache supporting XIP, Octal/Quad SPI flash, HyperFlash, HyperRAM, Xccela memory types
Peripherals- Analog
- 4x 16bit ADC (Single Ended) or 2x16bit (Differential)
- Up to 2 Msps in 16bit mode and 3.3 Msps in 12bit mode
- Integrated temperature sensor connected per ADC
- Three high-speed comparators with 17 input pins and 8-bit DAC as internal reference
- 2x CMP is functional down to Deep Power Down mode
- Two 12-bit DAC with sample rates of up to 1.0 MSample/sec
- One 14-bit DAC with sample rates of up to 10 MSample/sec
- Three OpAmps can be configured to:
- Programmable Gain Amplifier
- Differential Amplifier
- Instrument Amplifier
- Transconductance Amplifier
- Highly accurate VREF ±0.15 % and 15 ppm/deg C drift
- Timers
- Five 32-bit standard general-purpose asynchronous timers/counters, which support up to four capture inputs and four compare outputs, PWM mode and external count input. Specific timer events can be selected to generate DMA requests.
- SCTimer/PWM
- LPTimer
- Frequency measurement timer
- Multi-Rate Timer
- Windowed Watchdog Timer
- RTC with calendar
- Micro Timer
- OS Event Timer
- Communication interfaces
- USB high-speed (Host/Device) with on-chip HS PHY
- USB full-speed (Host/Device) with on-chip FS PHY, USB Device
- uSDHC (Micro SD High Speed Card Interface)
- 10x LP Flexcomms each supporting SPI, I2C, UART
- 2x FlexCAN with FD, 2x I3Cs, 2x SAI
- 1x Ethernet with QoS
- 1x FlexIO programmable as a variety of serial and parallel interfaces, including, but not limited to Display Driver and camera interface
- 2x EVM Smart Card Interfaces
- Programmable Logic Unit (PLU)
- Motor Control Subsystem
- 2x eFlexPWM each with 4 sub-modules, providing 12 PWM outputs
- 2x Quadrature Encoder/Decoder (ENC)
- 1x Event Generator (AND/OR/INVERT) module support up to 8 output trigger
- SINC Filter Module (3rd order, 5ch, break signals connections to PWM)
Security
再看一下架构图,图形是工程师语言,上边的千言万语汇集成一张图
开始今天的实验过程
【软件:】
OS:windows11
Dev tools:MDK Keil
sdk: mcuxpresso sdk 2.14
【硬件:】
mcxn947_brk开发板
HX8357A tft_lcd
杜邦线
dap link
【设置】
从原理图中可以看出点屏所需要的pin设置
由于屏的转接板不能和这个开发板很好的契合,所以二者之间需要用大量的杜邦线来连接。
【实验过程】
1. 为了快速开发,直接使用官方的例程,从sdk中打开lvgl_demo_widgets,
也可用drivers_example/flexio/mculcd来修改
先了解一下flexio驱动lcd的过程,1.先设置好flexio,并配置好pin =》 2. 初始化flexio及pin=》 3.设置lcd的属性=》4.初始化lcd。
由于我用的lcd是HX8357A,翻阅手册发现和例程里使用的ST7796s的寄存器完全不同,需要重新构造初始化,开窗函数等,过程费时
2.直接用st7796s修改初lcd始化参数。
附上初始化代码,如下
- 0x01, 0xFF,0x00, // Command page 0
- 0x01, 0x72,0xF6, // SUB_SEL=0xF6
- // Power saving for HX8357-A
- 0x01, 0xFF,0x00, // Command page 0
- 0x01, 0xF2,0x00, // GENON=0x00
- 0x01, 0xE4,0x00, // EQVCI_M1=0x00
- 0x01, 0xE5,0x1C, // EQGND_M1=0x1C
- 0x01, 0xE6,0x00, // EQVCI_M0=0x1C
- 0x01, 0xE7,0x1C, // EQGND_M0=0x1C
- 0x01, 0xEE,0x42, // For GRAM read/write speed
- 0x01, 0xEF,0xDB, // For GRAM read/write speed
- 0x01, 0x2E,0x98, //For Gate timing, prevent the display abnormal in RGB I/F
- // Gamma
- 0x01, 0x40,0x00,
- 0x01, 0x41,0x2E,
- 0x01, 0x42,0x2D,
- 0x01, 0x43,0x3F,
- 0x01, 0x44,0x3F,
- 0x01, 0x45,0x3F,
- 0x01, 0x46,0x2C,
- 0x01, 0x47,0x7F,
- 0x01, 0x48,0x07,
- 0x01, 0x49,0x05,
- 0x01, 0x4A,0x08,
- 0x01, 0x4B,0x13,
- 0x01, 0x4C,0x1E,
- 0x01, 0x50,0x00,
- 0x01, 0x51,0x00,
- 0x01, 0x52,0x00,
- 0x01, 0x53,0x12,
- 0x01, 0x54,0x11,
- 0x01, 0x55,0x3F,
- 0x01, 0x56,0x00,
- 0x01, 0x57,0x53,
- 0x01, 0x58,0x01,
- 0x01, 0x59,0x0C,
- 0x01, 0x5A,0x17,
- 0x01, 0x5B,0x1A,
- 0x01, 0x5C,0x18,
- 0x01, 0x5D,0xC3,
-
-
-
- // Set GRAM area 320x480
- 0x01, 0x02,0x00,
- 0x01, 0x03,0x00,
- 0x01, 0x04,0x01,
- 0x01, 0x05,0x3F,
- 0x01, 0x06,0x00,
- 0x01, 0x07,0x00,
- 0x01, 0x08,0x00,
- 0x01, 0x09,0xDF, //0xEF 320x240
-
- 0x01, 0x24,0x22, // Set VCOMH voltage, VHH=0x64
- 0x01, 0x25,0x64, // Set VCOML voltage, VML=0x71
- 0x01, 0x23,0x90, // Set VCOM offset, VMF=0x52
- 0x01, 0x1B,0x0E, // Set VERG1 voltage, VRH[5:0]=0x1E
- 0x01, 0x1D,0x11, // FS0[1:0]=01, Set the operating frequency of the step-up circuit 1
- // Power on Setting
- 0x01, 0x19,0x01, // OSC_EN=1, Start to Oscillate
- 0x01, 0x1C,0x03, // AP=011
- 0x01, 0x01,0x00, // Normal display(Exit Deep standby mode)
- 0x01, 0x1F,0x80, // Exit standby mode and Step-up circuit 1 enable
- // GAS_EN=1, VCOMG=0, PON=0, DK=0, XDK=0, DDVDH_TRI=0, STB=0
-
- 0x01, 0x1F,0x90, // Step-up circuit 2 enable
- // GAS_EN=1, VCOMG=0, PON=1, DK=0, XDK=0, DDVDH_TRI=0, STB=0
-
- 0x01, 0x1F,0xD4,
- // GAS_EN=1, VCOMG=1, PON=1, DK=0, XDK=1, DDVDH_TRI=0, STB=0
-
- // Display ON Setting
- 0x01, 0x28,0x08, // GON=0, DTE=0, D[1:0]=01
-
- 0x01, 0x28,0x38, // GON=1, DTE=1, D[1:0]=10
-
- 0x01, 0x28,0x3C, // GON=1, DTE=1, D[1:0]=11
-
- 0x01, 0x17,0x05, // 16-bit/pixel
-
- //HX8357-A_Update_GRAM
- // Set GRAM start address (0x0000, 0x0000)
- 0x01,0xFF,0x00, ////Select Command Page 0
- // If command page not change, the RFFh can remove
- 0x01,0x80,0x00, // Set CAC=0x0000
- 0x01,0x81,0x00,
- 0x01,0x82,0x00, // Set RAC=0x0000
- 0x01,0x83,0x00,
- 0x00,0x22, //Write GRAM command
-
复制代码 修改开窗函数
经过这一阵子的研究,重新画板子,终于成功了,补发几张图完善本贴。
表示已经成功了。
lvgl_demo_widgets.zip
(116.64 KB, 下载次数: 1)
|
|