为什么使用SPI的procedure中涉及对MMC/SD的设置 ?<br /><br />SPI OPERATION<br />Using the SPI interface, the S3C2410A can send/receive 8 –bit data simultaneously with an external device. A serial<br />clock line is synchronized with the two data lines for shifting and sampling of the information. When the SPI is the<br />master, transmission frequency can be controlled by setting the appropriate bit to SPPREn register. You can modify<br />its frequency to adjust the baud rate data register value. When the SPI is a slave, other master supplies the clock.<br />When the programmer writes byte data to SPTDATn register, SPI transmit/receive operation will start<br />simultaneously. In some cases, nSS should be activated before writing byte data to SPTDATn.<br />Programming Procedure<br />When a byte data is written into the SPTDATn register, SPI starts to transmit if ENSCK and MSTR of SPCONn<br />register are set. You can use a typical programming procedure to operate an SPI card.<br />To program the SPI modules, follow these basic steps:<br />1. Set Baud Rate Prescaler Register (SPPREn).<br />2. Set SPCONn to configure properly the SPI module.<br />3. Write data 0xFF to SPTDATn 10 times in order to initialize MMC or SD card.<br />4. Set a GPIO pin, which acts as nSS, to low to activate the MMC or SD card.<br />5. Tx data ® Check the status of Transfer Ready flag (REDY = 1), and then write data to SPTDATn.<br />6. Rx data(1): SPCONn's TAGD bit disable = normal mode<br />® write 0xFF to SPTDATn, then confirm REDY to set, and then read data from Read Buffer.<br />7. Rx data(2): SPCONn's TAGD bit enable = Tx Auto Garbage Data mode<br />® confirm REDY to set, and then read data from Read Buffer (then automatically start to transfer).<br />8. Set a GPIO pin, which acts as nSS, to high, to deactivate MMC or SD card. |
|