没辙了,把代码改成直接操作寄存器也不行,先不管了。
unsigned char spi_send (unsigned short outb) {
/* Write and Read a byte on SPI interface. */
SPI3->DR = outb;
while (!(SPI3->SR & 0x02)); /* Wait for transfer to finish */
// while (!(SPI3->SR & 0x01));
return (SPI3->DR); /* Return received value */
unsigned char spi_send (unsigned short outb) {
/* Write and Read a byte on SPI interface. */
SPI3->DR = outb;
while (!(SPI3->SR & 0x02)); /* Wait for transfer to finish */
// while (!(SPI3->SR & 0x01));
return (SPI3->DR); /* Return received value */
}
一周热门 更多>