|
I am having trouble to use TIOA0 as the source for the 16-bit counter, hope someone can give me some ideas.
I want to know if it is possible to count transitions on TIOA0, I have not seen a single answer on how to do so and I can't get it to count.
In the clock chaning diagram it shows that TC1 and TC2 can take as an input TIOA0.
Therefore I am choosing TC1 and the MUX as follows:
*TCB_BMR = AT91C_TCB_TC1XC1S_TIOA0;
Then for the TCCLKS MUX I select XC1.
Enable and SWTRG the TC1 but it nover counts and the Mirror TIOA and TIOAB in the status register never change...
So I end up with TC4, PB0_TIOA3 and XC1.
Here is the code
//PIO *PIO_PDR = AT91C_PB0_TIOA3; //define PB0 TIOA3 as peripheral *PIO_BSR = AT91C_PB0_TIOA3; //select peripheral B
*PMC_PCER = (DWORD)(1 << AT91C_ID_TC4); //*** enable timer 4 clock over PMC
//Disable the clock and the interrupts before to configure it *TC_CCR = AT91C_TC_CLKDIS; *TC_IDR = 0xffffffff;
//Clear the status bit dummy = *TC_SR; *TCB_BMR = AT91C_TCB_TC1XC1S_TIOA0;
//Set the mode ; *TC_CMR = AT91C_TC_CLKS_XC1;
//Enable the clock and start it with a software trigger *TC_CCR = AT91C_TC_CLKEN | AT91C_TC_SWTRG;
What am I doing wrong?
Thx
|