From b7b310e0ff26444e441f82d9a5c0c64a5c71508e Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sun, 14 Oct 2012 18:50:45 -0700 Subject: [PATCH] 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 --- src/drivers/ao_companion.c | 3 +++ 1 file changed, 3 insertions(+) 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 { \ -- 2.30.2