From 2889fc2d38a7eb9d4348d115cf83e743da5d2a75 Mon Sep 17 00:00:00 2001 From: Christina Quast Date: Sun, 22 Mar 2015 19:06:51 +0100 Subject: [PATCH] Bug fixed, timeout frequ increased --- sam3s_example/simtrace/tc_etu.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sam3s_example/simtrace/tc_etu.c b/sam3s_example/simtrace/tc_etu.c index 39741ac6..3241c0cd 100644 --- a/sam3s_example/simtrace/tc_etu.c +++ b/sam3s_example/simtrace/tc_etu.c @@ -25,11 +25,11 @@ #include //FIXME: -static const Pin pTC[] = {PIO_PA4B_TCLK0, PIO_PA0B_TIOA0, PIO_PA1B_TIOB0}; +static const Pin pTC[] = {{PIO_PA4B_TCLK0, PIO_PA0B_TIOA0, PIO_PA1B_TIOB0}}; /** Global timestamp in milliseconds since start of application */ volatile uint32_t dwTimeStamp = 0; -uint8_t timeout_occured = 0; +volatile uint8_t timeout_occured = 0; // FIXME: Do I need the function?: /** @@ -52,14 +52,15 @@ void TC0_IrqHandler( void ) /* Clear status bit to acknowledge interrupt */ dummy = TC0->TC_CHANNEL[ 0 ].TC_SR; - TRACE_DEBUG("++++ TC0_IrqHandler"); timeout_occured++; +// printf("++++ TC0_Irq %d\n\r", timeout_occured); } void TC0_Counter_Reset( void ) { TC0->TC_CHANNEL[ 0 ].TC_CCR = TC_CCR_SWTRG ; + timeout_occured = 0; } /* == Timeouts == @@ -74,8 +75,8 @@ void Timer_Init() /** Enable peripheral clock. */ PMC_EnablePeripheral(ID_TC0); - /** Configure TC for a 8Hz frequency and trigger on RC compare. */ - TC_FindMckDivisor( 1, BOARD_MCK, &div, &tcclks, BOARD_MCK ); + /** Configure TC for a $ARG1 Hz frequency and trigger on RC compare. */ + TC_FindMckDivisor( 20, BOARD_MCK, &div, &tcclks, BOARD_MCK ); TRACE_INFO("Chosen div, tcclk: %d, %d", div, tcclks); /* TC_CMR: TC Channel Mode Register: Capture Mode */ /* CPCTRG: RC Compare resets the counter and starts the counter clock. */