-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Timer Pins routed to the Arduino Due Board #11
Comments
In fact, I read that from the Arduino Forum
Now I'm confused, probably yours is right, but nothing is making sense... |
So ... what is the last word here? |
OK, here is a quick clarification of the pin usage: The AT91SAM3X8E has 9 general-purpose 32-bit timers/counters; they have input lines for their clock and input/output lines that can be used in different ways, such as PWM outputs etc. Here is a quick overview of the signals of the Timer/Counter part of the AT91SAM3X8E:
Here is how the external clock inputs are routed to pins on the Arduino Due board:
Here is how the I/O Lines A are routed to pins on the Arduino Due board:
Here is how the I/O Lines B are routed to pins on the Arduino Due board:
This library uses the Timer Counter as a timer to run a callback. It doesn't need the external clock inputs as it uses the built-in clock inputs for the TCs. As the Timer/Counters are being driven in the "Waveform Mode", this generates a PWM signal on the TIOAx / TIOBx lines (which we don't need if all we want from this code is to run a callback). I don't know what happens to TIOAx and TIOBx if you set up the output controller to ignore all possible impact factors on the output state. This could possibly be done by replacing the line with the
You may or may not be able to use TIOAx and TIOBx as your own output in this case. I didn't test this yet! My sources: Section 37.5.1 I/O Lines in the Atmel SAM3X Datasheet, Arduino Due's SAM3X Pin Mapping and the Arduino Due pinout diagram. |
I was reading the datasheet some more and testing the code and I come to the following findings: If we ever want to use the timer / counter capabilities to route the TIOAx signal to a pin on the outside (for a PWM), we would have to set up the PIO like this: int ulPin = 2; // just an example: it's 2 for the Timer0
PIO_Configure(g_APinDescription[ulPin].pPort,
g_APinDescription[ulPin].ulPinType,
g_APinDescription[ulPin].ulPin,
g_APinDescription[ulPin].ulPinConfiguration); I found this fragment in the file wiring_analog.c of the Arduino 1.5.x branch. |
Could you please tell me how to set the timer to receive an external clock input on TCLK0. I tried every where but could not get an answer. |
Hi sriranjanr,
I hope it helps. |
@radosek21 Thank you for your code! I got it to work but I wanted to make some comments to make it more useful to others:
Thanks again. I've been reading and re-reading the datasheet, and didn't get anywhere until I found your example. |
Hello everyone, |
DueTimer's Readme states:
I don't quite get this. Which pins are you talking about? The timer (counter) input pins as I read Atmel's datasheet are mostly routed to headers on the Arduino Due board (with the exception of T6 and T7):
My sources: Section 37.5.1 I/O Lines in the Atmel SAM3X Datasheet and Arduino Due's SAM3X Pin Mapping.
It would be great if this could be clarified or corrected. Thanks!
The text was updated successfully, but these errors were encountered: