From f59e89cfb9d5783c6c870c85b777f5a392547478 Mon Sep 17 00:00:00 2001 From: nvt-se Date: Fri, 6 Nov 2009 14:02:59 +0000 Subject: [PATCH] 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. --- platform/msb430/dev/sd-arch.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/platform/msb430/dev/sd-arch.c b/platform/msb430/dev/sd-arch.c index 0e46b50d5..1d48c61e0 100755 --- a/platform/msb430/dev/sd-arch.c +++ b/platform/msb430/dev/sd-arch.c @@ -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; }