From: Keith Packard Date: Mon, 15 Oct 2012 01:50:45 +0000 (-0700) Subject: altos: Wait for companion to see CS before attempting communcation X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=refs%2Fheads%2Fcompanion-delay altos: Wait for companion to see CS before attempting communcation The AVR just can't go fast enough to see the CS in time, so pause for a while. (rewritten from f9607fb76c22187396cceb46b745fa1485d4f155) Signed-off-by: Keith Packard --- diff --git a/src/drivers/ao_companion.c b/src/drivers/ao_companion.c index c749adea..2ed407f1 100644 --- a/src/drivers/ao_companion.c +++ b/src/drivers/ao_companion.c @@ -24,11 +24,14 @@ #endif #define COMPANION_SELECT() do { \ + uint8_t pause; \ ao_spi_get_bit(AO_COMPANION_CS_PORT, \ AO_COMPANION_CS_PIN, \ AO_COMPANION_CS, \ AO_COMPANION_SPI_BUS, \ AO_SPI_SPEED_200kHz); \ + for (pause = 0; pause < 100; pause++) \ + ao_arch_nop(); \ } while (0) #define COMPANION_DESELECT() do { \