0

I am working on an autonomous robot in my summer vacations. I am currently working on running the motors of my robot in a closed loop. In order to do so, I have to interface two Quadrature encoders of the motors with the Arduino Due that I have. My motor encoder have 3200 Edges per Revolution. I have read the Atmel SAM3x8E datasheet and have successfully tested one encoder in Arduino IDE. It appears that TIOA0 and TIOBO are used to read PHA and PHB of of one Encoder which correspond to Pin 2 and 13 of Arduino Due. I am not using Index pin (TIOB1).

enter image description here

It seems that I can only interface 1 quadrature .Is their any way I can use Quadrature decoder to read 2 encoders instead of one. As I have stated earlier I am not using the index pin. So, maybe there might be a way to decode to encoders using the three available pins as shown in the above diagram. I don't want to use Interrupts to do this job.

Here's is the link of SAM3x Manual: http://www.atmel.com/Images/Atmel-11057-32-bit-Cortex-M3-Microcontroller-SAM3X-SAM3A_Datasheet.pdf

Link of Motor that i am using: www.pololu.com/product/2824

0

According to Quadrature Decoder QDEC for SAM3/4 Devices_ApplicationNote_AT11483 and referenced excel sheet with Device to No of QDEC channels it seems to have two of them. However in DUE almost none of interesting devices are wired to headers completely (Extmem, SD interface,...)

However TIOA6 and TIOB6 should be on pins 5 and 4

Pin configuration should be something like this:

  PIO_Configure(PIOC, PIO_PERIPH_B, PIO_PC25B_TIOA6, PIO_DEFAULT);
  PIO_Configure(PIOC, PIO_PERIPH_B, PIO_PC26B_TIOB6, PIO_DEFAULT);

And TC0 is pretty much same as TC2, so just copy&paste and change TC0 to TC2

  • I am using Arduino IDE for programming. According to Quadrature Decoder QDEC for SAM3/4 Devices_ApplicationNote_AT11483 Pg 16 I have to first configure the IOpins. How can i configure TIOA6 and TIOB6 as QDEC input pins? – Masood Salik Aug 12 '16 at 4:42
  • @KIVV Please see the above comment – Masood Salik Aug 12 '16 at 6:42
  • @MasoodSalik How exactly it's done right now for TC0? Some library or directly in arduino? Do you have code for it? And also which Arduino IDE - there is arduino.cc and arduino.org – KIIV Aug 15 '16 at 9:13
  • I have posted the code in another post arduino.stackexchange.com/questions/28268/… – Masood Salik Aug 15 '16 at 15:51
  • I am currently using Arduino IDE 1.6.10.(zip file download fromhttps://www.arduino.cc/en/Main/Software) After Installing the board "Arduino SAM board (32 bit ARM Cortex M3). All libraries of DUE are already added in it. – Masood Salik Aug 15 '16 at 16:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.