Page 1 of 1

Quadrature Encoder on SAM3U4E

Posted: Tue Oct 18, 2011 12:51 pm
by DavieJG
Hi,

Has anyone successfully managed to set up the quadrature decoder logic on the SAM3U4E?

It would appear that the associated register definitions are missing from AT91SAM3U4.h (generated 11/17/2009 (13:04:57)). I've attempted to set the device up as per the data sheet after including my own definitions but have had no success. This has left me questioning why the definitions were omitted in the first place.

Any help anyone could provide regarding this peripheral would be greatly appreciated.

Cheers.

Re: Quadrature Encoder on SAM3U4E

Posted: Tue Oct 18, 2011 3:36 pm
by DavieJG
Solved.

The missing piece of the puzzle was that although the encoder is externally clocked it will not start counting unless the clocks on TC0 and TC1 are enabled and a sync command has been issued.

AT91C_BASE_TC0->TC_CCR = AT91C_TC_CLKEN;
AT91C_BASE_TC1->TC_CCR = AT91C_TC_CLKEN;
AT91C_BASE_TCB0->TCB_BCR= AT91C_TCB_SYNC; //Start both timer

The position mode of the quad encoder now operates as per the datasheet. The user is still required to update the header file to define the missing registers.