Problem with V70 Quadrature Decoder

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am using a SAMV70 processor as a Quadrature decoder to read a position sensor.  I have it configured for just Timer Counter Channel 0 with no Index.  My sensor counts up to 511 in the positive direction , sees the an index pulse and then resets  to 0 (instead of counting to 512, 513, 514, 516 etc.).  In the other (negative) direction it will count down to -511 and then rollover to 0 when it sees an index pulse.  

 

The index pulse appears to be resetting the counter, which I do not want to do. However, I don't have the index channel Timer Channel 1 enabled.  The documentation says you do not have to use the index pulse.  And the documentation says nothing about resetting TC Channel 0 counter when it sees an index pulse.

 

 

I have attached a screenshot from Atmel Start showing my configuration.

Attachment(s): 

Last Edited: Wed. Nov 18, 2020 - 06:40 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Don't connect the index signal from the encoder to the IO pin of the MCU if you don't need it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

balisong42,

 

Yes. I could disconnect that pin. However, we are going to want to use the index input later on for calibration. As far as I can tell, the decoder does not operate as described in the datasheet.  I will probably have to disconnect the index pin from the decoder. Then put a jumper on the board to connect the index pin to an unused input on the CPU. Set that pin as an interrupt pin and handle the index myself.

 

Unless someone can tell me how to get the decoder to work properly. Has anyone gotten the quadrature decoder on this chip to work properly?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have not used QDEC on the V71. I have used QDEC on other chips. I have not used Start to configure a chip. I see a section (not in your screenshot) called Component Signals. Do you have IO pins assign to just 2 or all 3 TCLK inputs?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There are no TCLK signals assigned in the Component Signals section because the Quadrature Decoder requires that you select XCO as the external clock.  

 

According to the datasheet, 50.6.16.1

 

"TC_CMRx.TCCLKS must be configured to select XC0 input (i.e., 0x101). Field TC0XC0S has no effect as soon as
the QDEC is enabled."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You right, I missed the fixed configuration for QDEC; Start certainly doesn't make it obvious. I guess I'm just used to using TCK# as inputs and TIOx# as outputs.

 

My best guess would be to call: gpio_set_pin_function(PC9, GPIO_PIN_FUNCTION_OFF);

 

Otherwise, the designers must have thought concatenation off channels 0 & 1 is good enough.