Difference between revisions of "84PCE:Ports:D000"

From WikiTI
Jump to: navigation, search
(Known Working Commands)
(Updated based on FTSSP010 driver for Linux)
(11 intermediate revisions by one other user not shown)
Line 7: Line 7:
 
'''Function:''' LCD Interface
 
'''Function:''' LCD Interface
  
This appears to be an SPI controller that interfaces with the LCD.  Non-extended commands from [https://cdn-shop.adafruit.com/datasheets/ILI9340.pdf] appear to work, but there's plenty of unknown commands used by the boot code.
+
This appears to be an FTSSP010 or compatible SPI controller that interfaces with the LCD.  Non-extended commands from [https://cdn-shop.adafruit.com/datasheets/ILI9340.pdf] appear to work, but there's plenty of unknown commands used by the boot code.
  
  
Line 19: Line 19:
 
|
 
|
 
|0000F38C
 
|0000F38C
|Boot code writes 180B/09 before/after turning on/off the lcd.<br/>Bits 0-2 could be transfer size.
+
|CR0: Boot code writes 180B/09 before/after turning on/off the lcd.
 
|-
 
|-
 
|D004<br/>F80004
 
|D004<br/>F80004
 
|0000182B
 
|0000182B
 
|007FFFFF
 
|007FFFFF
|Boot code initializes to 02000B.
+
|CR1: Boot code initializes to 02000B. Bits 0-15 are clock divider - 1, bits 16-23 are data length - 1, and bits 24-31 are padding length.
 
|-
 
|-
 
|D008<br/>F80008
 
|D008<br/>F80008
 
|0002000B
 
|0002000B
 
|00000F8F
 
|00000F8F
|Boot code initializes to 010C.<br/>Bit 0 is set to transfer data.<br/>Bit 7 is set/reset for reading/writing.
+
|CR2: Boot code initializes to 010C.<br/>Bit 0 is set to transfer data.<br/>Bit 7 is set/reset for reading/writing.
 
|-
 
|-
 
|D00C<br/>F8000C
 
|D00C<br/>F8000C
 
|
 
|
|000004F2
+
|000007F6
|Status bits.<br/>Bit 2 appears to be set if data is sending, and bits 12-15 the number of values queued.<br/>Boot code waits for bits 2 and 12-15 to be 0 before/after reading/writing.
+
|Status bits.<br/>Bit 2 is set if data is being sent or received and bits 12-15 are the number of bits queued.<br/>Boot code waits for bits 2 and 12-15 to be 0 before/after reading/writing.
 
|-
 
|-
 
|D010<br/>F80010
 
|D010<br/>F80010
 
|00002100
 
|00002100
 
|
 
|
|Unknown
+
|Interrupt control.
 
|-
 
|-
 
|D014<br/>F80014
 
|D014<br/>F80014
 
|00000008
 
|00000008
 
|
 
|
|Unknown
+
|Interrupt status.
 
|-
 
|-
 
|D018<br/>F80018
 
|D018<br/>F80018
Line 54: Line 54:
 
|0E0F0F1F
 
|0E0F0F1F
 
|
 
|
|Constant, could be an ID or status.
+
|Inside reserved range. Appears to be a copy of the feature register at D064.
 
|-
 
|-
 
|D060<br/>F80060
 
|D060<br/>F80060
 
|00012100
 
|00012100
 
|
 
|
|Constant, could be an ID or status.
+
|Revision (read-only)
 
|-
 
|-
 
|D064<br/>F80064
 
|D064<br/>F80064
 
|0E0F0F1F
 
|0E0F0F1F
 
|
 
|
|Constant, could be an ID or status.
+
|Features (read-only): 32-bit data width, 16-bit FIFOs, list of extra protocols supported.
 
|}
 
|}
  
Line 146: Line 146:
 
|-
 
|-
 
|3A ?<br/>3A 66
 
|3A ?<br/>3A 66
|Unknown?
+
|Interface Pixel Format
|
+
|Upper and lower nibbles are modes for the two interfaces: 3 is 12bpp, 5 is 16bpp, 6 is 18bpp (msb is ignored, invalid uses 18bpp).
 
|-
 
|-
 
|B0 ? ?<br/>B0 11 F0
 
|B0 ? ?<br/>B0 11 F0
|Interface Control?
+
|Interface Control
|First Param:<br/>Bit 4: Get GRAM data from lcd controller instead of spi interface.<br/> Bit 7: Bypass GRAM and output directly to lcd.
+
|First Param:<br/>Bit 0: Use lcd controller clocks instead of internal clocks.<br/>Bit 4: Get GRAM data from lcd controller instead of spi interface.<br/> Bit 7: Bypass GRAM and output directly to lcd.<br/>Second Param:<br/>Polarity of clocks?
 
|-
 
|-
 
|B1 ? ? ?<br/>B1 01 05 14<br/>B1 01 15 14
 
|B1 ? ? ?<br/>B1 01 05 14<br/>B1 01 15 14
Line 210: Line 210:
 
|Definitely affects gamma, parameters unknown and don't match docs.
 
|Definitely affects gamma, parameters unknown and don't match docs.
 
|-
 
|-
|E9 ? ? ?
+
|E9 ? ? ?<br/>E9 08 08 08
|E9 08 08 08
+
 
|Unknown?
 
|Unknown?
|
+
|-
 +
|EB
 +
|Something!
 +
|-
 +
|F0
 +
|Gamma?
 +
|-
 +
|F1
 +
|Gamma?
 +
|-
 +
|F2
 +
|Gamma?
 
|}
 
|}
  

Revision as of 14:07, 8 April 2020

Synopsis

Port Number: D000

Memory-mapped Address: F80000

Function: LCD Interface

This appears to be an FTSSP010 or compatible SPI controller that interfaces with the LCD. Non-extended commands from [1] appear to work, but there's plenty of unknown commands used by the boot code.


Port    Default    Bits    Information   
D000
F80000
0000F38C CR0: Boot code writes 180B/09 before/after turning on/off the lcd.
D004
F80004
0000182B 007FFFFF CR1: Boot code initializes to 02000B. Bits 0-15 are clock divider - 1, bits 16-23 are data length - 1, and bits 24-31 are padding length.
D008
F80008
0002000B 00000F8F CR2: Boot code initializes to 010C.
Bit 0 is set to transfer data.
Bit 7 is set/reset for reading/writing.
D00C
F8000C
000007F6 Status bits.
Bit 2 is set if data is being sent or received and bits 12-15 are the number of bits queued.
Boot code waits for bits 2 and 12-15 to be 0 before/after reading/writing.
D010
F80010
00002100 Interrupt control.
D014
F80014
00000008 Interrupt status.
D018
F80018
FIFO in/out.
D01C
F8001C
0E0F0F1F Inside reserved range. Appears to be a copy of the feature register at D064.
D060
F80060
00012100 Revision (read-only)
D064
F80064
0E0F0F1F Features (read-only): 32-bit data width, 16-bit FIFOs, list of extra protocols supported.

Known Commands

Hex
Defaults
Command Details
01 Software Reset
10
10
Enable Sleep Mode Turns pixels black, low power mode?
11
11
Disable Sleep Mode
12 Enable Partial Mode Resets vertical scrolling start to 0.
13 Disable Partial Mode Also disables vertical scrolling mode and resets vertical scrolling start to 0.
20 Uninvert Colors
21 Invert Colors
26 <8:GC>
26 00
26 02
Set Gamma Selects between 4 preset gamma curves: Valid values are 1, 2, 4, 8, invalid values appear to use 1.
28 Turn Off Display Turns all pixels white.
29
29
Turn On Display Restore GRAM pixels.
2A <BE16:StartCol> <BE16:EndCol>
2A 0000 013F
Set Window Columns Set the pixel update window from StartCol to EndCol inclusive.
2B <BE16:StartLine> <BE16:EndRow>
2B 0000 00EF
Set Window Rows Set the pixel update window from StartRow to EndRow inclusive.
30 <BE16:StartRow> <BE16:EndRow> Set Partial Area Rows Only displays from StartRow to EndRow inclusive, other lines white.
33 <BE16:TopArea> <BE16:ScrollArea> <BE16:BottomArea> Vertical Scrolling Definition TopArea/BottomArea are static (non-scrolling) line counts before and after the ScrollArea whose value is ignored.
36 <8:MAC>
36 08
Memory Address Control Bit 2: Horizontal Refresh Order
Bit 3: BGR Order
Bit 4: Vertical Refresh Order
Bit 5: Column Major Update
Bit 6: Column Update Order
Bit 7: Row Update Order
37 <BE16:VSP> Vertical Scrolling Start Position First line of ScrollArea starts at this GRAM line.
38 Disable Idle Mode Restore 18bpp mode.
39 Enable Idle Mode 3bpp 8 color mode (only uses msb of each color component).
3A ?
3A 66
Interface Pixel Format Upper and lower nibbles are modes for the two interfaces: 3 is 12bpp, 5 is 16bpp, 6 is 18bpp (msb is ignored, invalid uses 18bpp).
B0 ? ?
B0 11 F0
Interface Control First Param:
Bit 0: Use lcd controller clocks instead of internal clocks.
Bit 4: Get GRAM data from lcd controller instead of spi interface.
Bit 7: Bypass GRAM and output directly to lcd.
Second Param:
Polarity of clocks?
B1 ? ? ?
B1 01 05 14
B1 01 15 14
Unknown?
B2 ? ? ? ? ?
B2 0C 0C 00 33 33
Unknown?
B7 ?
B7 35
Unknown?
BB ?
BB 17
BB 1B
Unknown?
C0 ?
C0 2C
C0 22
Unknown?
C2 ?
C2 01
Unknown?
C3 ?
C3 03
C3 15
Unknown?
C4 ?
C4 20
Unknown?
C6 ?
C6 0F
Unknown?
D0 ? ?
D0 AF A1
Unknown?
D2 ?
D2 00
Unknown?
DC Unknown? One parameter "read" and checked if equal to 0x35, but reading doesn't appear to work in the first place...
E0 ? ? ? ? ? ? ? ? ? ? ? ? ? ?
E0 D0 00 00 10 0F 1A 2D 54 3F 3B 18 17 13 17
E0 D0 00 00 10 0F 1A 2D 54 3F 3B 18 17 13 17
Positive Gamma Correction Definitely affects gamma, parameters unknown and don't match docs.
E1 ? ? ? ? ? ? ? ? ? ? ? ? ? ?
E1 D0 00 00 10 0F 09 2B 43 40 3B 18 17 13 17
E1 D0 00 00 10 0F 09 2B 43 40 3B 18 17 13 17
Negative Gamma Correction Definitely affects gamma, parameters unknown and don't match docs.
E9 ? ? ?
E9 08 08 08
Unknown?
EB Something!
F0 Gamma?
F1 Gamma?
F2 Gamma?

Example

Sending

 ld a,036h ; Flips the lcd horizontally, vertically, and swaps the b and r components
 call spiCmd
 ld a,0C0h
 call spiParam

 ld a,002h ; Resetting the lcd on exit
 call spiCmd
 jp boot_InitializeHardware

; Input: A = parameter
spiParam:
 scf ; First bit is set for data
 .db 030h ; jr nc,? ; skips over one byte
; Input: A = command
spiCmd:
 or a,a ; First bit is clear for commands
 ld hl,0F80818h
 call spiWrite
 ld l,h
 ld (hl),001h
spiWait:
 ld l,00Dh
spiWait1:
 ld a,(hl)
 and a,0F0h
 jr nz,spiWait1
 dec l
spiWait2:
 bit 2,(hl)
 jr nz,spiWait2
 ld l,h
 ld (hl),a
 ret
spiWrite:
 ld b,3
spiWriteLoop:
 rla
 rla
 rla
 ld (hl),a ; send 3 bits
 djnz spiWriteLoop
 ret

Receiving

This does not appear to work, always returning 0 on the calcs I've tested, due to either a TI bug or hardware issue.

; Input: A = command
; Ouput: A = data
spiRead:
 ld hl,0F80808
 ld (hl),00Ch
 ld l,018h
 or a,a
 call spiWrite
 xor a,a ; not sure what this is for
 call spiWrite
 ld l,009h
 ld (hl),001h
 dec l
 ld (hl),081h
 call spiWait
 ld l,$18
 ld a,(hl) ; dummy read
 ld a,(hl)
 ld a,(hl) ; Why is there no wait after dummy read?
 ld a,(hl)
 rla
 rla
 rla
 rla
 rla
 and a,0E0h
 ld c,a
 ld a,(hl)
 rla
 rla
 and a,01Ch
 or a,c
 ld c,a
 ld a,(hl)
 rra ; why are we throwing away the lsb instead of the msb
 and a,003h
 or a,c
 ret