spi
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
spi [2025/01/11 20:09] – arisotura | spi [2025/04/17 15:44] (current) – arisotura | ||
---|---|---|---|
Line 17: | Line 17: | ||
| 0xF000440C | FIFO status | | | 0xF000440C | FIFO status | | ||
| 0xF0004410 | Data input/ | | 0xF0004410 | Data input/ | ||
- | | 0xF0004414 | ?? | | + | | 0xF0004414 | SPI low-level control |
| 0xF0004418 | IRQ enable | | | 0xF0004418 | IRQ enable | | ||
| 0xF0004420 | Number of bytes to read | | | 0xF0004420 | Number of bytes to read | | ||
Line 28: | Line 28: | ||
^ Bits ^ Desc. ^ | ^ Bits ^ Desc. ^ | ||
- | | 0-2 | Clock multiplier | + | | 0-2 | Clock source |
| 3-10 | Clock divider | | | 3-10 | Clock divider | | ||
+ | | 11-14 | ?? | | ||
| 15 | SPI enable (possibly just clock enable) | | | 15 | SPI enable (possibly just clock enable) | | ||
- | The clock multiplier | + | The clock source |
- | The following | + | The clock source |
- | ^ Multiplier ^ Clock ^ | + | |
- | | 0 | 32MHz | | + | |
- | | 1 | 12MHz | | + | |
- | | 2 | ??? | | + | |
- | | 3 | ??? | | + | |
- | | 4 | ~857MHz | | + | |
- | | 5 | 3.38MHz | | + | |
- | | 6 | 15.9MHz | | + | |
- | | 7 | 3.38MHz | | + | |
- | + | ||
- | Not sure how these values are generated internally. I couldn' | + | |
- | + | ||
- | The clock divider | + | |
Observed settings in the stock firmware are the following: | Observed settings in the stock firmware are the following: | ||
- | ^ Register value ^ Destination ^ Clock speed ^ | + | ^ Register value ^ Destination ^ Clock speed ^ |
- | | 0x808C | + | | 0x808C |
- | | 0x8018 | + | | 0x8018 |
- | | 0x835C | + | | 0x835C |
- | | 0x83F8 | + | | 0x83F8 |
- | | 0x8400 | + | | 0x8400 |
Line 116: | Line 104: | ||
WARNING: if the write FIFO is already full, writes to this register are discarded. There seems to be no error signal in this case, so you have to be mindful of this. | WARNING: if the write FIFO is already full, writes to this register are discarded. There seems to be no error signal in this case, so you have to be mindful of this. | ||
- | In a similar vein, a read transfer will halt if the read FIFO is full. | + | In a similar vein, a read transfer will halt if the read FIFO is full (and resume when it is no longer full). |
Using [[DMA]] takes care of this automatically, | Using [[DMA]] takes care of this automatically, | ||
Line 125: | Line 113: | ||
**0xF0004414** | **0xF0004414** | ||
- | Unknown. Bits 0-1, 4, 15 set by firmware code. | + | Controls low-level aspects of the SPI protocol. |
+ | |||
+ | ^ Bits ^ Desc. ^ | ||
+ | | 0 | CPHA - Clock phase | | ||
+ | | 1 | CPOL - Clock polarity; 0=invert source clock, 1=use source clock as-is | | ||
+ | | 4 | ?? | | ||
+ | | 15 | ?? | | ||
+ | |||
+ | Clearing bit 15 has weird effects: seems to force CPOL to 1? This causes the transmitted data to be offset | ||
spi.1736626172.txt.gz · Last modified: 2025/01/11 20:09 by arisotura