我正在编写一个代码来连接带有AT91SAM7S ARM内核的微型SD卡,而调试我发现一切都正常但模块无法运行,因为启用位没有设置,但是我做了多次。
void SPI_Configure(AT91S_SPI * spi, unsigned int id, unsigned int配置) {
// Disable the interrupt first
AT91C_BASE_AIC->AIC_IDCR = 1 << id;
// Clear interrupt
AT91C_BASE_AIC->AIC_ICCR = 1 << id;
AT91C_BASE_PMC->PMC_PCER = 1 << id;
// Execute a software reset of the SPI twice
spi->SPI_CR = AT91C_SPI_SWRST ;
spi->SPI_CR = AT91C_SPI_SWRST | AT91C_SPI_SPIEN;
spi->SPI_MR = configuration;
// Disables the transmitter PDC transfer requests.
spi->SPI_PTCR = AT91C_PDC_RXTDIS | AT91C_PDC_TXTDIS;
spi->SPI_CR |= AT91C_SPI_SPIEN;
}
任何人都有任何想法可以帮助我解决这个问题 谢谢你