Quadrature Encoder on SAM3U4E

Discussion around product based on ARM Cortex M3 core.

Moderators: nferre, ncollot

DavieJG
Posts: 2
Joined: Tue Oct 18, 2011 12:45 pm

Quadrature Encoder on SAM3U4E

Tue Oct 18, 2011 12:51 pm

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.
DavieJG
Posts: 2
Joined: Tue Oct 18, 2011 12:45 pm

Re: Quadrature Encoder on SAM3U4E

Tue Oct 18, 2011 3:36 pm

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.

Return to “SAM3 Cortex-M3 MCU”

Who is online

Users browsing this forum: No registered users and 11 guests