STM32F7 18 LCD-TFT display controller (LTDC)

Started by tha, December 08, 2022, 08:38:41 AM

Previous topic - Next topic

tha

Dithering

The dithering pseudo-random technique โดยใช้ an LFSR ถูกใช้เพื่อเพิ่ม a small random value (threshold) ไปยังแต่ละ pixel color channel (R, G or B) value, ดังนั้นจะปัดเศษ the MSB ขึ้นในบางกรณีเมื่อแสดง a 24-bit data บน 18-bit display. ดังนั้น the Dithering technique ถูกใช้เพื่อปัดเศษ data ที่แตกต่างจากเฟรมหนึ่งไปยังอีกเฟรมหนึ่ง.

The dithering pseudo-random technique นั้นเหมือนกับการเปรียบเทียบ LSBs กับค่าขอบเขตและเพิ่ม a 1 ไปยัง the MSB part เท่านั้น, ถ้า the LSB part >= the threshold. The LSBs โดยทั่วไปจะถูกทิ้งทันทีที่ dithering ถูกนำมาใช้.

ความกว้างของ the added pseudo-random value คือ 2 bits สำหรับแต่ละ color channel: 2 bits สำหรับ red, 2 bits สำหรับ green และ 2 bits สำหรับ blue.

ทันทีที่ the LCD-TFT controller ถูกเปิดใช้งาน, the LFSR สตาร์ทการรันด้วย the first active pixel และมันรันต่อไปแม้ว่าในระหว่าง blanking periods และเมื่อ dithering ถูกปิด. ถ้า the LTDC ถูกปิดใช้งาน, the LFSR จะถูกรีเซ็ต.

The dithering สามารถถูกสวิทช์ On and Off ได้ทันทีผ่านทาง the LTDC_GCR register.

tha

Reload shadow registers

บาง configuration registers ถูก shadowed. The shadow registers values สามารถถูกโหลดใหม่ทันทีไปยัง the active registers เมื่อเขียนไปยัง registers เหล่านี้หรือที่การเริ่มต้นของ the vertical blanking period ตาม the configuration ใน the LTDC_SRCR register. ถ้า the immediate reload configuration ถูกเลือก, the reload ควรถูกทำให้ทำงานเฉพาะเมื่อทุก new registers ถูกเขียนแล้ว.

The shadow registers ไม่ควรถูกแก้ไขอีกครั้งก่อน the reload ถูกทำแล้ว. การอ่านจาก the shadow registers จะส่งคืนกลับ the actual active value. The new written value สามารถถูกอ่านเฉพาะหลังจาก the reload เกิดขึ้นแล้ว.

A register reload interrupt สามารถถูกสร้างถ้าถูกเปิดใช้งานใน the LTDC_IER register.

The shadowed registers คือทุก the layer1 and layer2 registers ยกเว้น the LTDC_LxCLUTWR register.

Interrupt generation event

ดูที่ Section 18.5: LTDC interrupts สำหรับ interrupt configuration.

tha

18.4.2 Layer programmable parameters

มากถึง two layers สามารถถูกเปิดใช้งาน, ถูกปิดใช้งานและถูกกำหนดค่าแยกกัน. The layer display order ถูกคงที่และจากล่างขึ้นบน. ถ้า two layers ถูกเปิดใช้งาน, the layer2 เป็น the top displayed window.

Windowing

ทุกๆ layer สามารถถูกวางตำแหน่งและปรับขนาดได้ และมันต้องอยู่ภายใน the active display area.

The window position and size ถูกกำหนดค่าผ่านทาง the top-left และ bottom-right X/Y positions และ the internal timing generator ซึ่งรวมถึง the synchronous, back porch size และ the active data area. ดูที่ LTDC_LxWHPCR and LTDC_WVPCR registers.

The programmable layer position and size กำหนด the first/last visible pixel of a line และ the first/last visible line in the window. มันยอมให้แสดงผลอย่างใดอย่างหนึ่ง the full image frame หรือเฉพาะส่วนหนึ่งของ the image frame. ดูที่ Figure 113.
•   The first and the last visible pixel in the layer ถูกเซ็ตโดยการกำหนดค่า the WHSTPOS[11:0] และ WHSPPOS[11:0]
     ใน the LTDC_LxWHPCR register.
•   The first and the last visible lines in the layer ถูกเซ็ตโดยการกำหนดค่า the WVSTPOS[10:0] และ WVSPPOS[10:0] ใน
     the LTDC_LxWVPCR register.



tha

Pixel input format

The programmable pixel format ถูกใช้สำหรับ the data ที่เก็บใน the frame buffer ของ a layer.

มากถึง 8 input pixel formats สามารถถูกกำหนดค่าสำหรับทุกๆ layer ผ่านทาง the LTDC_LxPFCR register

The pixel data ถูกอ่านจาก the frame buffer แล้วแปลงเป็น the internal 8888 (ARGB) format ดังนี้: ส่วนประกอบที่มีความกว้างน้อยกว่า 8 บิตจะขยายเป็น 8 บิตโดย bit replication. The selected bit range จะถูกต่อเข้าด้วยกันหลายครั้งจนกว่าจะยาวขึ้นมากกว่า 8 บิต. จากเวกเตอร์ผลลัพธ์, the 8 MSB bits ถูกเลือก. ตัวอย่าง: 5 bits ของ an RGB565 red channel กลายมาเป็น (bit positions): 43210432 (the 3 LSBs ถูกเติมด้วย the 3 MSBs of the 5 bits)

Table 118 อธิบาย the pixel data mapping ขึ้นอยู่กับ the selected format.




tha

Color look-up table (CLUT)

The CLUT สามารถถูกเปิดใช้งานในขณะ run-time สำหรับทุกๆ layer ผ่านทาง the LTDC_LxCR register และมันมีประโยชน์เฉพาะในกรณีของสีที่จัดทำดัชนีเมื่อใช้ the L8, AL44 and AL88 input pixel format.

ขั้นแรก, the CLUT ต้องถูกโหลดด้วย the R, G and B values ที่แทนที่ the original R, G, B values ของ pixel นั้น(indexed color). แต่ละ color (RGB value) มี address ของมันเองซึ่งคือ the position ภายใน the CLUT.

The R, G and B values และ respective address ของพวกมันเองถูกโปรแกรมผ่านทาง the LTDC_LxCLUTWR register.
•   ในกณีของ L8 and AL88 input pixel format, the CLUT ต้องถูกโหลดโดย 256 colors. The address ของแต่ละ color จะถูก
     กำหนดค่าใน the CLUTADD bits ใน the LTDC_LxCLUTWR register.
•   ในกณีของ AL44 input pixel format, the CLUT ต้องถูกโหลดเพียง 16 colors เท่านั้น. The address ของแต่ละ color ต้องถูก
     เติมโดยการทำซ้ำ the 4-bit L channel เป็น 8-bit ดังนี้:
     –   L0 (indexed color 0), at address 0x00
     –   L1, at address 0x11
     –   L2, at address 0x22
     –   .....
     –   L15, at address 0xFF

tha

Color frame buffer address

ทุก layer มี a start address สำหรับ the color frame buffer ที่กำหนดค่าผ่านทาง the LTDC_LxCFBAR register.

เมื่อ a layer ถูกเปิดใช้งาน, the data จะถูกดึงจาก the color frame buffer.

tha

Color frame buffer length

ทุก layer มี a total line length setting สำหรับ the color frame buffer เป็น bytes และจำนวนของ lines ใน the frame buffer สามารถกำหนดค่าได้ใน the LTDC_LxCFBLR and LTDC_LxCFBLNR register ตามลำดับ

The line length และ the number of lines settings ถูกใช้เพื่อหยุดการดึงล่วงหน้าของ data ไปยัง the layer FIFO ที่ the end of the frame buffer.
•   ถ้ามันถูกเซ็ตเป็น bytes น้อยกว่าที่ต้องการ, a FIFO underrun interrupt จะถูกสร้างถ้ามันถูกเปิดใช้งานไว้ก่อนหน้าแล้ว.
•   ถ้ามันถูกเซ็ตเป็น bytes มากกว่าที่ต้องการจริงๆ, the useless data ที่อ่านจาก the FIFO จะถูกทิ้ง. The useless data จะไม่ถูก
     แสดงผล.

tha

Color frame buffer pitch

ทุก layer มี a configurable pitch สำหรับ the color frame buffer, ซึ่งคือระยะระหว่าง the start of one line และ the beginning of the next line เป็น bytes. มันถูกกำหนดค่าผ่านทาง the LTDC_LxCFBLR register.