Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
memory_map [2021/09/21 21:53] – [IO special functions and usage] Removed incorrect data about io mappings. pulkomandymemory_map [2022/08/19 10:48] – [IO registers] pulkomandy
Line 31: Line 31:
 The direction register is 0 for input pins, 1 for output pins. The direction register is 0 for input pins, 1 for output pins.
  
 +===== Global configuration register =====
 +
 +  * Bit 0: IOA special functions select
 +  * Bit 1: IOB special functions select
 +
 +These two bits allow to select one of two special functions for the IOA and IOB registers. Then each pin in that IO register can be switched between normal GPIO and special function using the MASK register.
 +
 +For IOA, special = 0 selects the TFT display interface, special = 1 selects the STN LCD interface and I2S audio output.
 +
 +For IOB, only special = 0 is documented and it selects the CSB0, CSB1, CSB2 chip select pins for external memory (further configured by port 3D23)
 +
 +  * Bit 2: IOA Wakeup enable
 +  * Bit 3: IOB Wakeup enable
 +  * Bit 4: IOC Wakeup enable
 +
 +These bits enable system wakeup from sleep mode from activity on the corresponding IO ports. A typical setup on the V.Smile is to enable wakeup on port B to detect when the ON button is pressed.
 ===== Input pins configuration ===== ===== Input pins configuration =====
  
Line 279: Line 295:
   * 115200: FF F1   * 115200: FF F1
  
 +Before using the UART, the corresponding PINs need to be configured properly. IOC13 and IOC14 must be set to "special"/"mask" mode to disable the GPIO and assign the pin to UART.
 +The example below also forces CTS A (IOC8) low, allowing the first controller port to transmit data. Normally this would only be done after receiving an RTS from said controller.
 +
 + // Enable controller CTS
 + *PORTC_DIR = 0x89c0;
 + *PORTC_ATTR = 0x89c0;
 + *PORTC_DATA = 0xf77f;
 +
 + // Enable Uart RX (controller input)
 + *UART_BAUDRATE_LOW = 0xA0;
 + *UART_BAUDRATE_HIGH = 0xFE;
 + *UART_CONTROL = 0xc3;
 + *UART_STATUS = 3;
 +
 + *PORTC_SPECIAL |= 0x6000; // UART Tx and Rx in "special" mode
 + *PORTC_ATTR |= 0x6000;
 + *PORTC_DIR |= 0x4000;
 +
 +Reading from the UART then is quite simple:
 +
 +  * Wait until the status register indicates Rx ready (bit 0)
 +  * When Rx is ready, read the Rx data register to get the byte
 +
 +For transmitting, you need to check if the FIFO is cleared (bit 1 of status register) then you can push your bytes to the transmit register.
 ====== SPI ====== ====== SPI ======
  
memory_map.txt · Last modified: 2023/04/16 10:15 by pulkomandy
CC Attribution 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0