summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
authorTomasz Moń <desowin@gmail.com>2021-06-27 13:32:20 +0200
committerTomasz Moń <desowin@gmail.com>2021-06-27 13:32:20 +0200
commit3c7c71030f64eacc2fb7bb4d01247b81ee9d117e (patch)
tree67c4c2331b36da0bcab227c7db6d13d46013344a /firmware/target
parent1b81bd8a6153314aadc1144d55a7c02eb11111c5 (diff)
Sansa Connect: Ensure adequate AVR Slave Select delay
Waiting 10 us between selecting slave and transmitting data on SPI resolves spurious startup glitches. Cache last read monotime value as it can differ from the first one. Change-Id: Ia6ac5696f6ee2bc3c6a8be27e33aaddd9ff4ce2a
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c b/firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c
index 94ffcdf195..12058eba03 100644
--- a/firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c
+++ b/firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c
@@ -376,6 +376,7 @@ static bool avr_run_command(uint8_t opcode, uint8_t *data, size_t data_length)
IO_SERIAL1_TX_ENABLE = 0x0001;
avr_hid_select();
+ udelay(10);
IO_SERIAL1_TX_DATA = CMD_SYNC;
spi_read_byte();
@@ -660,7 +661,7 @@ static void read_monotime(void)
if ((t1 == t2) || (t1 + 1 == t2))
{
int flags = disable_irq_save();
- monotime_value = t1;
+ monotime_value = t2;
monotime_value_tick = current_tick;
restore_irq(flags);
monotime_available = true;