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
Next revisionBoth sides next revision
memory_map [2021/09/05 18:12] – [Misc. peripherals] simermemory_map [2021/09/23 22:48] – [UART] pulkomandy
Line 44: Line 44:
  
 If the attribute bit is 1, there is no inversion, and the data bit is output as is. If the attribute bit is 1, there is no inversion, and the data bit is output as is.
- 
-===== IO special functions and usage ===== 
- 
-FIXME this does not match the info from the V.Smile motion schematics (see [[IO]] page). Where does this info come from (except from bmx spreadsheet) and which is correct? 
- 
-  * IOA15: act 
-  * IOA14-0: 15 bit RGB 
-  * IOA15: SCK 
-  * IOA14: SDA 
-  * IOA13: SWS 
-  * IOA12: CKV 
-  * IOA11: FM 
-  * IOA10: FP 
-  * IOA9: LP 
-  * IOA8: CP 
-  * IOA7-0: D7-0 
-  * IOC15: SPI clock 
-  * IOC14: RX 
-  * IOC13: TX 
-  * IOC12: SPI SSB 
-  * IOC11: TFT Clock 
-  * IOC10: timebase 1 
-  * IOC9: TAPWM 
-  * IOC8: VSYNC 
-  * IOC7: HSYNC 
-  * IOC1: timebase 2 / external clock 1 input 
-  * IOC0: TBPWM / external clock 2 input 
  
  
Line 306: Line 279:
   * 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