Fixed the problem of reads from the SPI where the first byte was sometimes lost.The SPI read function now only generates an idle symbol if there is not a byte
already in the reception buffer.
This commit is contained in:
parent
91a4322d2b
commit
f59e89cfb9
1 changed files with 4 additions and 2 deletions
|
@ -84,7 +84,9 @@ sd_arch_spi_write_block(uint8_t *bytes, int amount)
|
|||
unsigned
|
||||
sd_arch_spi_read(void)
|
||||
{
|
||||
UART_TX = SPI_IDLE;
|
||||
UART_WAIT_RX();
|
||||
if((U1IFG & URXIFG1) == 0) {
|
||||
UART_TX = SPI_IDLE;
|
||||
UART_WAIT_RX();
|
||||
}
|
||||
return UART_RX;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue