diff --git a/software/sys_controller/ossc/av_controller.c b/software/sys_controller/ossc/av_controller.c index 6e58c67..d4d7d81 100644 --- a/software/sys_controller/ossc/av_controller.c +++ b/software/sys_controller/ossc/av_controller.c @@ -1235,8 +1235,9 @@ int main() while (alt_timestamp() < start_ts + MAINLOOP_INTERVAL_US*(TIMER_0_FREQ/1000000)) {} // restart timer if past half-range - if (start_ts > 0x7fffffff) { + if ((start_ts > 0x7fffffff) && !SPI_Timer_Status()) { alt_timestamp_start(); + SPI_Timer_Off(); if (auto_input_timestamp > start_ts) auto_input_timestamp -= start_ts; else diff --git a/software/sys_controller/ulibSD/spi_io.c b/software/sys_controller/ulibSD/spi_io.c index a9172b9..89f193e 100644 --- a/software/sys_controller/ulibSD/spi_io.c +++ b/software/sys_controller/ulibSD/spi_io.c @@ -58,8 +58,7 @@ inline void SPI_Freq_Low (void) { int SPI_Timer_On (WORD ms) { if (!sd_timer_ts) { - sd_timer_ts = ms*(ALT_CPU_FREQ/1000); - alt_timestamp_start(); + sd_timer_ts = alt_timestamp() + ms*(TIMER_0_FREQ/1000); return 0; } return 1;