Difference between revisions of "84PCE:LCD Controller"

From WikiTI
Jump to: navigation, search
m (remove empty newline)
(Add and update commands)
Line 58: Line 58:
 
Access to the display RAM is provided to both the RGB and SPI interfaces. Which interface is currently given access is determined by the RM bit of [[#B0: RAM Control|RAM Control]], and the data format for each interface is determined by [[#3A: Interface Pixel Format|Interface Pixel Format]].
 
Access to the display RAM is provided to both the RGB and SPI interfaces. Which interface is currently given access is determined by the RM bit of [[#B0: RAM Control|RAM Control]], and the data format for each interface is determined by [[#3A: Interface Pixel Format|Interface Pixel Format]].
  
Before accessing RAM, a rectangular window should be configured using the [[#2A: Column Address Set|Column Address Set]] and [[#2B: Row Address Set|Row Address Set]] commands. Data is accessed using a Frame Memory Pointer which starts at a corner of the configured window and moves in the major (X) direction configured by the [[#36: Memory Data Access Control|Memory Data Access Control]] command. Once the opposite edge of the window is reached, it wraps around and moves the pointer in the minor (Y) direction. Once the opposite ''corner'' of the window has been reached, it wraps around to the beginning.
+
Before accessing RAM, a rectangular window should be configured using the [[#2A: Column Address Set|Column Address Set]] and [[#2B: Row Address Set|Row Address Set]] commands. Data is accessed using a Frame Memory Pointer (unique to each interface) which starts at a corner of the configured window and moves in the major (X) direction configured by the [[#36: Memory Data Access Control|Memory Data Access Control]] command. Once the opposite edge of the window is reached, it wraps around and moves the pointer in the minor (Y) direction. Once the opposite ''corner'' of the window has been reached, it wraps around to the beginning.
  
 
TI configures a full-screen row-major window by default (starting in the upper-left corner of the screen, moving left to right across a row, and proceeding through each row from top to bottom). This causes the diagonal screen tearing effect commonly seen on the CE, because each line (column) is only partially updated when scanned to the display.
 
TI configures a full-screen row-major window by default (starting in the upper-left corner of the screen, moving left to right across a row, and proceeding through each row from top to bottom). This causes the diagonal screen tearing effect commonly seen on the CE, because each line (column) is only partially updated when scanned to the display.
Line 66: Line 66:
 
Each pixel output by the [[84PCE:Ports:4000|Primecell PL111]] is sent over the RGB interface and written to display RAM, if access is enabled. This method has the most performance, and allows using Primecell features such as DMA and color palettes.
 
Each pixel output by the [[84PCE:Ports:4000|Primecell PL111]] is sent over the RGB interface and written to display RAM, if access is enabled. This method has the most performance, and allows using Primecell features such as DMA and color palettes.
  
The frame synchronization pulse resets the Frame Memory Pointer to the start of the configured window, equivalent to the [[#2C: Write Memory|Write Memory]] command. Pixels can be written over the RGB interface until the end of the window is reached, after which no more pixels are accepted until the next frame synchronization pulse.
+
The frame synchronization pulse resets the Frame Memory Pointer to the start of the configured window, similar to the [[#2C: Write Memory|Write Memory]] command. Additionally, the Frame Memory Pointer is reset when changing the RM bit of [[#B0: RAM Control|RAM Control]] from 0 to 1, which can be useful when the window is changed after frame synchronization and before active video.
 +
 
 +
Pixels can be written over the RGB interface until the end of the window is reached, after which no more pixels are accepted until the Frame Memory Pointer is reset again.
  
 
On the CE, an RGB565 data signal is connected to the RGB666 interface by duplicating the MSB of the red and blue components to the LSB of each. If the RGB interface color format is set to 18bpp, this color is written directly to display RAM. On the other hand, if set to 16bpp, the interface interprets the original RGB565 signal and generates the LSBs of red and blue based on the EPF field of [[#B0: RAM Control|RAM Control]].
 
On the CE, an RGB565 data signal is connected to the RGB666 interface by duplicating the MSB of the red and blue components to the LSB of each. If the RGB interface color format is set to 18bpp, this color is written directly to display RAM. On the other hand, if set to 16bpp, the interface interprets the original RGB565 signal and generates the LSBs of red and blue based on the EPF field of [[#B0: RAM Control|RAM Control]].
 +
 +
Note: The Primecell's 12bpp mode outputs an RGB444 data signal, but the RGB interface doesn't support a 12bpp color format for some reason, so it's effectively expanded to RGB565 first with the unspecified bits as 0: <span style="color: #f00">RRRR0</span><span style="color: #0c0">GGGG00</span><span style="color: #00f">BBBB0</span>
  
 
== SPI Interface ==
 
== SPI Interface ==
Line 98: Line 102:
  
 
== 01: Software Reset ==
 
== 01: Software Reset ==
Resets most parameters to their factory default values. Must wait 5ms before sending another command, or 120ms if done in sleep mode.
+
Resets most parameters to their factory default values, and enters both Sleep mode and Display Off mode. Must wait 5ms before sending another command, or 120ms if initiated in Sleep mode.
  
 
Display RAM is unaffected by this operation, as well as the [[#36: Memory Data Access Control|Memory Data Access Control]] and [[#3A: Interface Pixel Format|Interface Pixel Format]] parameters.
 
Display RAM is unaffected by this operation, as well as the [[#36: Memory Data Access Control|Memory Data Access Control]] and [[#3A: Interface Pixel Format|Interface Pixel Format]] parameters.
  
 
== 10: Sleep In ==
 
== 10: Sleep In ==
Enters sleep mode. Must wait 5ms before sending another command.
+
Enters Sleep mode. Must wait 5ms before sending another command.
  
 
== 11: Sleep Out ==
 
== 11: Sleep Out ==
Exits sleep mode. Must wait 5ms before sending another command. Must wait 120ms before entering sleep mode again.
+
Exits Sleep mode. Must wait 5ms before sending another command. Must wait 120ms before entering Sleep mode again.
  
 
== 12: Partial Display Mode On ==
 
== 12: Partial Display Mode On ==
Line 122: Line 126:
 
== 20: Display Inversion Off ==
 
== 20: Display Inversion Off ==
 
Disables display inversion immediately. This may require frame synchronization to avoid tearing.
 
Disables display inversion immediately. This may require frame synchronization to avoid tearing.
 +
 +
If the XINV bit is set in [[#C0: LCM Control|LCM Control]], this command enables display inversion instead.
  
 
== 21: Display Inversion On ==
 
== 21: Display Inversion On ==
 
Enables display inversion immediately. This may require frame synchronization to avoid tearing.
 
Enables display inversion immediately. This may require frame synchronization to avoid tearing.
 +
 +
If the XINV bit is set in [[#C0: LCM Control|LCM Control]], this command disables display inversion instead.
  
 
== 26: Gamma Set ==
 
== 26: Gamma Set ==
Line 157: Line 165:
 
The X dimension is always the "major" dimension of the window, depending on the MV bit in [[#36: Memory Data Access Control|Memory Data Access Control]]. In other words, the Frame Memory Pointer always moves in the X dimension first. The selected dimension also determines whether the maximum value is 239 or 319.
 
The X dimension is always the "major" dimension of the window, depending on the MV bit in [[#36: Memory Data Access Control|Memory Data Access Control]]. In other words, the Frame Memory Pointer always moves in the X dimension first. The selected dimension also determines whether the maximum value is 239 or 319.
  
The Address Order configured on the X dimension determines the edge of the display RAM referred to by the 0 address. The X value effectively always increases as it moves through the range, thus the range should always be configured with XS?XE.
+
The Address Order configured on the X dimension determines the edge of the display RAM referred to by the 0 address. The X value effectively always increases as it moves through the range, thus the range should always be configured with XS&le;XE.
  
 
'''Parameter word 1:'''
 
'''Parameter word 1:'''
Line 190: Line 198:
 
The Y dimension is always the "minor" dimension of the window, depending on the MV bit in [[#36: Memory Data Access Control|Memory Data Access Control]]. In other words, the Frame Memory Pointer always moves in the Y dimension second. The selected dimension also determines whether the maximum value is 239 or 319.
 
The Y dimension is always the "minor" dimension of the window, depending on the MV bit in [[#36: Memory Data Access Control|Memory Data Access Control]]. In other words, the Frame Memory Pointer always moves in the Y dimension second. The selected dimension also determines whether the maximum value is 239 or 319.
  
The Address Order configured on the Y dimension determines the edge of the display RAM referred to by the 0 address. The Y value effectively always increases as it moves through the range, thus the range should always be configured with YS?YE.
+
The Address Order configured on the Y dimension determines the edge of the display RAM referred to by the 0 address. The Y value effectively always increases as it moves through the range, thus the range should always be configured with YS&le;YE.
  
 
'''Parameter word 1:'''
 
'''Parameter word 1:'''
Line 219: Line 227:
  
 
== 2C: Write Memory ==
 
== 2C: Write Memory ==
Resets the Frame Memory Pointer to (XS, YS) as specified in the [[#2A: Column Address Set|Column Address Set]] and [[#2B: Row Address Set|Row Address Set]] commands.
+
All parameters to this command are written to display RAM in order. See [[#RAM access|RAM Access]].
  
All parameters to this command are written to memory in order. See [[#RAM access|RAM Access]].
+
Before the first pixel is written, resets the Frame Memory Pointer to (XS, YS) as specified in the [[#2A: Column Address Set|Column Address Set]] and [[#2B: Row Address Set|Row Address Set]] commands. If no pixels are written, the Frame Memory Pointer is not reset.
  
 
== 30: Partial Area ==
 
== 30: Partial Area ==
Line 354: Line 362:
 
Can be inverted by the XMV bit in [[#C0: LCM Control|LCM Control]]. '''Important: TI-OS inverts this bit by default!'''
 
Can be inverted by the XMV bit in [[#C0: LCM Control|LCM Control]]. '''Important: TI-OS inverts this bit by default!'''
  
Changing this before a [[#3C: Write Memory Continue|Write Memory Continue]] effectively swaps the horizontal and vertical coordinates of the Frame Memory Pointer.
+
Changing this before a [[#3C: Write Memory Continue|Write Memory Continue]] effectively swaps the absolute horizontal and vertical coordinates of the Frame Memory Pointer.
 
|-
 
|-
 
|6
 
|6
Line 362: Line 370:
 
Can be inverted by the XMX bit in [[#C0: LCM Control|LCM Control]].
 
Can be inverted by the XMX bit in [[#C0: LCM Control|LCM Control]].
  
Changing this before a [[#3C: Write Memory Continue|Write Memory Continue]] leaves the Frame Memory Pointer at the same physical address, meaning the X or Y address is subtracted from 239 in the new coordinate system.
+
Changing this before a [[#3C: Write Memory Continue|Write Memory Continue]] leaves the Frame Memory Pointer at the same absolute pixel, meaning the X or Y address is subtracted from 239 in the new coordinate system.
 
|-
 
|-
 
|7
 
|7
Line 370: Line 378:
 
Can be inverted by the XMY bit in [[#C0: LCM Control|LCM Control]].
 
Can be inverted by the XMY bit in [[#C0: LCM Control|LCM Control]].
  
Changing this before a [[#3C: Write Memory Continue|Write Memory Continue]] leaves the Frame Memory Pointer at the same physical address, meaning the X or Y address is subtracted from 319 in the new coordinate system.
+
Changing this before a [[#3C: Write Memory Continue|Write Memory Continue]] leaves the Frame Memory Pointer at the same absolute pixel, meaning the X or Y address is subtracted from 319 in the new coordinate system.
 
|}
 
|}
  
Line 400: Line 408:
  
 
== 38: Idle Mode Off ==
 
== 38: Idle Mode Off ==
Disables Idle Mode, allowing full range of color display.
+
Disables Idle Mode on the next frame, allowing full range of color display.
  
 
== 39: Idle Mode On ==
 
== 39: Idle Mode On ==
Enables Idle Mode, displaying 8 colors based on the most significant bit of each color component.
+
Enables Idle Mode on the next frame, displaying 8 colors based on the most significant bit of each color component.
  
 
Optionally uses a different refresh rate in MCU or VSYNC interface modes, according to [[#B3: Frame Rate Control 1|Frame Rate Control 1]] and [[#B2: Porch Setting|Porch Setting]].
 
Optionally uses a different refresh rate in MCU or VSYNC interface modes, according to [[#B3: Frame Rate Control 1|Frame Rate Control 1]] and [[#B2: Porch Setting|Porch Setting]].
 +
 +
== 3A: Interface Pixel Format ==
 +
Specifies the pixel format accepted through the RGB and SPI interfaces. See [[#RAM access|RAM Access]].
 +
 +
'''Parameter byte 1:'''
 +
{|-
 +
|<u>Bit</u>&nbsp;&nbsp;&nbsp;
 +
|<u>HW Default</u>&nbsp;&nbsp;&nbsp;
 +
|<u>TI Default</u>&nbsp;&nbsp;&nbsp;
 +
|<u>Description</u>
 +
|-
 +
|3:0
 +
|06h
 +
|06h
 +
|SPI interface color format. Invalid values default to 06h.
 +
* 03h: 12 bits per pixel (RGB444)
 +
* 05h: 16 bits per pixel (RGB565)
 +
* 06h: 18 bits per pixel (RGB666)
 +
|-
 +
|7:4
 +
|06h
 +
|06h
 +
|RGB interface color format. Invalid values default to 06h.
 +
* 05h: 16 bits per pixel (RGB565)
 +
* 06h: 18 bits per pixel (RGB666)
 +
|}
 +
 +
== 3C: Write Memory Continue ==
 +
All parameters to this command are written to display RAM in order. See [[#RAM access|RAM Access]].
 +
 +
The Frame Memory Pointer resumes from the location following the last pixel written in a [[#2C: Write Memory|Write Memory]] or Write Memory Continue command. This location is not affected by memory writes through the RGB interface.
 +
 +
Note: This command is buggy when the first written pixel's X address is equal to the X End Address in [[#2A: Column Address Set|Column Address Set]]. When the Y address is updated during the wrap-around to the X Start Address, the pixel at the X End Address is written to the new Y address instead of the old one. To avoid this bug, write multiple pixels in the same Write Memory Continue command and ensure the wrap-around does not occur on the first pixel.

Revision as of 22:19, 3 March 2024

The CE contains two LCD controllers which work in tandem. This page primarily focuses on the one directly driving the LCD, the Sitronix ST7789.

See also the Primecell PL111 which drives the RGB interface, and the SPI Controller which provides the command interface.

Quick Specs

  • Sitronix ST7789 family LCD controller
  • TFT color LCD
  • Supports RGB and SPI interfaces
  • 172,800 bytes internal RAM
  • 76,800 pixels (240x320 resolution)
  • Power-saving 8-color mode
  • 262,144 = 2^18 = 6x6x6 colors
  • Data sheet: https://www.rhydolabz.com/documents/33/ST7789.pdf
  • Physical LCD:

Overview

The LCD is a 240x320 pixel display rotated 90 degrees. To make terminology consistent, directions will be described relative to the CE itself, not relative to the display. As such, each scanline appears in a vertical orientation and the display is scanned from left to right. Note that the datasheet will not agree with this page when it comes to the terms "row" and "column". When appropriate, columns (which correspond to scanlines) will be referred to as "lines" to be more consistent with the datasheet.

Operating modes

The controller operates in one of three modes, dictating the refresh rate and scan timing:

RGB Interface

In this mode, the controller accepts the following signals from the Primecell PL111:

  • Frame synchronization pulse (CLFP)
  • Line synchronization pulse (CLLP)
  • Pixel clock (CLCP)
  • RGB pixel data (CLD)
  • Data enable (CLAC)

This is TI's default setting, and causes the scan timing to be completely controlled by the Primecell.

To prevent scan errors, the Primecell must be configured with at least 240 pixel clocks per line and at least 320 lines per frame, plus the back porch values configured in RGB Interface Control. Note that these pixel clocks and lines are not required to be during active video of the Primecell, as it drives the pixel clock and line sync pulses even during porches.

Active video on the Primecell will drive the data enable and RGB pixel data signals, which are accepted by the RGB interface and written to display RAM, if enabled.

The RGB interface may also be configured with the WO bit of RGB Interface Control to bypass display RAM entirely and output the RGB pixel data signals directly to the display. Of course, this requires precisely a 240x320 active video configuration on the Primecell (in CE memory, represented in column-major order).

MCU Interface

In this mode, all scan timings are internal. Signals from the RGB interface are ignored, aside from display RAM writes if enabled. Scan timings are determined by Frame Rate Control 1, Frame Rate Control 2, and Porch Setting.

VSYNC Interface

In this mode, all scan timings are internal except for the frame synchronization pulse. Other signals from the RGB interface are ignored, aside from display RAM writes if enabled.

This mode allows the frame rate alone to be controlled by the RGB interface, while allowing much more flexibility with the timing of the line configuration, pixel clock, and RAM writes.

Note that if the MCU interface timings are not configured to complete a frame faster than the RGB interface, some frame synchronization pulses will be ignored and the framerate will be effectively halved or more.

RAM access

Access to the display RAM is provided to both the RGB and SPI interfaces. Which interface is currently given access is determined by the RM bit of RAM Control, and the data format for each interface is determined by Interface Pixel Format.

Before accessing RAM, a rectangular window should be configured using the Column Address Set and Row Address Set commands. Data is accessed using a Frame Memory Pointer (unique to each interface) which starts at a corner of the configured window and moves in the major (X) direction configured by the Memory Data Access Control command. Once the opposite edge of the window is reached, it wraps around and moves the pointer in the minor (Y) direction. Once the opposite corner of the window has been reached, it wraps around to the beginning.

TI configures a full-screen row-major window by default (starting in the upper-left corner of the screen, moving left to right across a row, and proceeding through each row from top to bottom). This causes the diagonal screen tearing effect commonly seen on the CE, because each line (column) is only partially updated when scanned to the display.

RGB Interface

Each pixel output by the Primecell PL111 is sent over the RGB interface and written to display RAM, if access is enabled. This method has the most performance, and allows using Primecell features such as DMA and color palettes.

The frame synchronization pulse resets the Frame Memory Pointer to the start of the configured window, similar to the Write Memory command. Additionally, the Frame Memory Pointer is reset when changing the RM bit of RAM Control from 0 to 1, which can be useful when the window is changed after frame synchronization and before active video.

Pixels can be written over the RGB interface until the end of the window is reached, after which no more pixels are accepted until the Frame Memory Pointer is reset again.

On the CE, an RGB565 data signal is connected to the RGB666 interface by duplicating the MSB of the red and blue components to the LSB of each. If the RGB interface color format is set to 18bpp, this color is written directly to display RAM. On the other hand, if set to 16bpp, the interface interprets the original RGB565 signal and generates the LSBs of red and blue based on the EPF field of RAM Control.

Note: The Primecell's 12bpp mode outputs an RGB444 data signal, but the RGB interface doesn't support a 12bpp color format for some reason, so it's effectively expanded to RGB565 first with the unspecified bits as 0: RRRR0GGGG00BBBB0

SPI Interface

Pixels can also be sent over the SPI command interface if access is enabled. It has rather slow throughput, but is the only way to write full 18bpp data, or reconfigure the window independently of frame timing. Pixel writes are initiated by the Write Memory or Write Memory Continue commands, and pixels are written as a sequence of parameter bytes.

The SPI interface supports RGB444, RGB565, and RGB666 formats. The first two are expanded to RGB666 based on the EPF field of RAM Control.

Note: Each parameter byte is 9 bits in the SPI protocol, including the leading 1 bit indicating a parameter. X bits are ignored.

RGB444 format (1.5 bytes per pixel): 1RRRRGGGG 1BBBBRRRR 1GGGGBBBB

RGB565 format (2 bytes per pixel): 1RRRRRGGG 1GGGBBBBB (or bytes swapped if the ENDIAN bit of RAM Control is 1)

RGB666 format (3 bytes per pixel): 1RRRRRRXX 1GGGGGGXX 1BBBBBBXX

Command List

This is the list of commands usable via the SPI Controller. All command IDs are listed in hexadecimal.

The SPI transfer format is 9 bits per byte. The first 9-bit transfer of every command is a 0 bit followed by the command ID byte, and each following transfer is a 1 bit followed by a parameter byte. All 16-bit parameters are two byte transfers in big-endian order, except for pixel parameters depending on configuration.

It's allowed to send fewer parameter bytes than the maximum the command takes; each parameter byte is immediately applied as it's received. A partial byte transfer can be cancelled safely by disabling the chip select signal (bit 0 of CR2 on the SPI controller).

Read commands don't seem to work properly on CE hardware, so they aren't described here.

00: No Operation

Takes no parameters and does nothing. It can be used to leave the controller in a state where an accidentally sent parameter has no effect.

01: Software Reset

Resets most parameters to their factory default values, and enters both Sleep mode and Display Off mode. Must wait 5ms before sending another command, or 120ms if initiated in Sleep mode.

Display RAM is unaffected by this operation, as well as the Memory Data Access Control and Interface Pixel Format parameters.

10: Sleep In

Enters Sleep mode. Must wait 5ms before sending another command.

11: Sleep Out

Exits Sleep mode. Must wait 5ms before sending another command. Must wait 120ms before entering Sleep mode again.

12: Partial Display Mode On

Enables Partial Display mode on the next frame. See Partial Area and Partial Control.

As a side effect, this resets the Vertical Scroll Start Address to zero.

Optionally uses a different refresh rate in MCU or VSYNC interface modes, according to Frame Rate Control 1 and Porch Setting.

13: Normal Display Mode On

Disables Partial Display mode and Vertical Scroll mode on the next frame.

As a side effect, this resets the Vertical Scroll Start Address to zero.

20: Display Inversion Off

Disables display inversion immediately. This may require frame synchronization to avoid tearing.

If the XINV bit is set in LCM Control, this command enables display inversion instead.

21: Display Inversion On

Enables display inversion immediately. This may require frame synchronization to avoid tearing.

If the XINV bit is set in LCM Control, this command disables display inversion instead.

26: Gamma Set

Applies a gamma preset.

Parameter byte 1:

Bit    HW Default    TI Default    Description
3:0 01h 02h GC: Gamma curve. Invalid values default to 01h.
  • 01h: G2.2
  • 02h: G1.8
  • 04h: G2.5
  • 08h: G1.0

28: Display Off

Enables Display Off mode on the next frame. This mode's only effect is forcing all-white frames to be output.

29: Display On

Disables Display Off mode on the next frame.

2A: Column Address Set

Sets the X address range for the memory access window.

The X dimension is always the "major" dimension of the window, depending on the MV bit in Memory Data Access Control. In other words, the Frame Memory Pointer always moves in the X dimension first. The selected dimension also determines whether the maximum value is 239 or 319.

The Address Order configured on the X dimension determines the edge of the display RAM referred to by the 0 address. The X value effectively always increases as it moves through the range, thus the range should always be configured with XS≤XE.

Parameter word 1:

Bit    HW Default    TI Default    Description
8:0 0000h 0000h XS: X Start Address. Should be between 0 and XE, inclusive.

Parameter word 2:

Bit    HW Default    TI Default    Description
8:0 00EFh 013Fh XE: X End Address. Should be between XS and 239 or 319, inclusive.

2B: Row Address Set

Sets the Y address range for the memory access window.

The Y dimension is always the "minor" dimension of the window, depending on the MV bit in Memory Data Access Control. In other words, the Frame Memory Pointer always moves in the Y dimension second. The selected dimension also determines whether the maximum value is 239 or 319.

The Address Order configured on the Y dimension determines the edge of the display RAM referred to by the 0 address. The Y value effectively always increases as it moves through the range, thus the range should always be configured with YS≤YE.

Parameter word 1:

Bit    HW Default    TI Default    Description
8:0 0000h 0000h YS: Y Start Address. Should be between 0 and YE, inclusive.

Parameter word 2:

Bit    HW Default    TI Default    Description
8:0 013Fh 00EFh YE: Y End Address. Should be between YS and 239 or 319, inclusive.

2C: Write Memory

All parameters to this command are written to display RAM in order. See RAM Access.

Before the first pixel is written, resets the Frame Memory Pointer to (XS, YS) as specified in the Column Address Set and Row Address Set commands. If no pixels are written, the Frame Memory Pointer is not reset.

30: Partial Area

Sets the display line range for Partial Mode.

Changes to the partial area only take effect at the next frame start.

Lines inside the inclusive range [PSL, PEL] are displayed normally, and lines outside the range are displayed in a solid white or black depending on the NDL bit in Partial Control.

If PSL>PEL, then the two inclusive ranges [0, PEL] and [PSL, 319] are displayed normally, while the exclusive range (PEL, PSL) is displayed in solid white or black.

If the ML bit is set in Memory Data Access Control, line 0 refers to the right edge of the display, and line numbers increase to the left.

Parameter word 1:

Bit    HW Default    TI Default    Description
8:0 0000h N/A PSL: Partial Start Line. Should be between 0 and 319, inclusive.

Parameter word 2:

Bit    HW Default    TI Default    Description
8:0 013Fh N/A PEL: Partial End Line. Should be between 0 and 319, inclusive.

33: Vertical Scrolling Definition

Sets the display line range for Vertical Scroll mode. Note since the display is rotated, this is actually a horizontal scroll mode.

Changes to the scroll area only take effect at the next frame start.

The TFA lines on the left side of the screen are displayed normally, as well as the TBA lines on the right side of the screen. The lines in the middle range [TFA, 320-BFA) participate in horizontal scrolling.

If the ML bit is set in Memory Data Access Control, the scrolling range is interpreted from right to left, making it [TFA, 320-BFA) under normal line numbering.

The datasheet specifies that VSA should hold the number of lines in the scrolling range such that TFA+VSA+BFA=320, but VSA seems to have no effect in practice.

Parameter word 1:

Bit    HW Default    TI Default    Description
8:0 0000h N/A TFA: Top Fixed Area. Should be between 0 and 320-BFA, inclusive.

Parameter word 2:

Bit    HW Default    TI Default    Description
8:0 013Fh N/A VSA: Vertical Scrolling Area. Seems to be ignored, but recommended to set to 320-(TFA+BFA).

Parameter word 3:

Bit    HW Default    TI Default    Description
8:0 013Fh N/A BFA: Bottom Fixed Area. Should be between 0 and 320-TFA, inclusive.

34: Tearing Effect Line Off

Disables the Tearing Effect output signal. Unlikely this signal can be used on CE.

35: Tearing Effect Line On

Enables the Tearing Effect output signal. Unlikely this signal can be used on CE.

36: Memory Data Access Control

Determines the behavior of the Frame Memory Pointer, display scan order, and RGB/BGR output.

Note: Most bits in this register can be inverted by bits in LCM Control.

Parameter byte 1:

Bit    HW Default    TI Default    Description
2 0 0 MH: Display data latch order. 0 means scan each line from top to bottom, 1 means from bottom to top.

This does not change the order of the display pixels unless in RGB Interface RAM bypass mode. Can be inverted by the XMH bit in LCM Control.

3 0 1 RGB: RGB/BGR order. 0 means RGB order, 1 means BGR order.

Can be inverted by the XBGR bit in LCM Control. Important: TI-OS inverts this bit by default!

4 0 0 ML: Line address order. 0 means scan the frame from left to right, 1 means from right to left.

This does not change the order of the displayed pixels unless in RGB Interface RAM bypass mode. Some features are affected by line address order, see Partial Area and Vertical Scrolling Definition.

5 0 0 MV: Page/column order. 0 means X address moves vertically and Y address moves horizontally, 1 means X address moves horizontally and Y address moves vertically.

Can be inverted by the XMV bit in LCM Control. Important: TI-OS inverts this bit by default!

Changing this before a Write Memory Continue effectively swaps the absolute horizontal and vertical coordinates of the Frame Memory Pointer.

6 0 0 MX: Column address order. 0 means addresses increase from top to bottom, 1 means addresses increase from bottom to top.

Can be inverted by the XMX bit in LCM Control.

Changing this before a Write Memory Continue leaves the Frame Memory Pointer at the same absolute pixel, meaning the X or Y address is subtracted from 239 in the new coordinate system.

7 0 0 MY: Page address order. 0 means addresses increase from left to right, 1 means addresses increase from right to left.

Can be inverted by the XMY bit in LCM Control.

Changing this before a Write Memory Continue leaves the Frame Memory Pointer at the same absolute pixel, meaning the X or Y address is subtracted from 319 in the new coordinate system.

37: Vertical Scroll Start Address

Sets the starting line address in frame memory to be displayed in the scroll area in Vertical Scroll mode. Note since the display is rotated, this is actually a horizontal scroll mode.

Changes to the scroll address only take effect at the next frame start.

See Vertical Scrolling Definition to set up the scroll area.

VSP is set to the line to display on the left-hand side of the scroll area between [TFA, 320-BFA). This means setting VSP=TFA means no scrolling, and increasing the value scrolls the area to the left.

If the ML bit is set in Memory Data Access Control, the line address is interpreted from right to left and VSP is the line to display on the right-hand side, so while VSP=TFA still means no scrolling, increasing the value scrolls the area to the right instead.

The scrolling is designed such that only the lines within the scroll area are rotated; when line 320-BFA is reached in frame memory, the line address returns to TFA. Strictly speaking, the first time in a frame that the line address is at least 320-BFA, (320-BFA)-TFA is subtracted from the line address. This can be useful knowledge when using the scroll mode for unintended behavior like showing the same lines in multiple parts of the screen.

Parameter word 1:

Bit    HW Default    TI Default    Description
8:0 0000h N/A VSP: Vertical Scroll Pointer. Should be between [TFA, 320-BFA), but can be set outside that range for other effects.

38: Idle Mode Off

Disables Idle Mode on the next frame, allowing full range of color display.

39: Idle Mode On

Enables Idle Mode on the next frame, displaying 8 colors based on the most significant bit of each color component.

Optionally uses a different refresh rate in MCU or VSYNC interface modes, according to Frame Rate Control 1 and Porch Setting.

3A: Interface Pixel Format

Specifies the pixel format accepted through the RGB and SPI interfaces. See RAM Access.

Parameter byte 1:

Bit    HW Default    TI Default    Description
3:0 06h 06h SPI interface color format. Invalid values default to 06h.
  • 03h: 12 bits per pixel (RGB444)
  • 05h: 16 bits per pixel (RGB565)
  • 06h: 18 bits per pixel (RGB666)
7:4 06h 06h RGB interface color format. Invalid values default to 06h.
  • 05h: 16 bits per pixel (RGB565)
  • 06h: 18 bits per pixel (RGB666)

3C: Write Memory Continue

All parameters to this command are written to display RAM in order. See RAM Access.

The Frame Memory Pointer resumes from the location following the last pixel written in a Write Memory or Write Memory Continue command. This location is not affected by memory writes through the RGB interface.

Note: This command is buggy when the first written pixel's X address is equal to the X End Address in Column Address Set. When the Y address is updated during the wrap-around to the X Start Address, the pixel at the X End Address is written to the new Y address instead of the old one. To avoid this bug, write multiple pixels in the same Write Memory Continue command and ensure the wrap-around does not occur on the first pixel.