ATSAMD10 Comparator

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

Hi,

 

Does anyone know if the 2 comparator outputs on the ATSAMD1x can be routed to an IO pin.

The datasheet states on 31.6.10 p746:

The output of each comparator can be routed to an I/O pin by setting the Output bit group in the Comparator Control x 
register (COMPCTRLx.OUT). This allows the comparator to be used by external circuitry. Either the raw, non-
synchronized output of the comparator or the CLK_AC-synchronized version, including filtering, can be used as the 
I/O signal source. The output appears on the corresponding CMP[x] pin.

But the CMP[1:0] doesn't appear in the "I/O Multiplexing and Considerations" chapter.

 

Thanks

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

Nope, there is not enough pins on those devices. The CMP signals are still available internally, of course.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

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

Note that the ATSAMD1x is not an AVR - not even an AVR32 - it is an ARM Cortex-M0+

 

http://www.at91.com/discussions/...

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for your response.

This might be the wrong forum but since a already opened a thread I hope to get an answer here.

 

Can I use the comparators window mode when evaluating a differential signal?

 

I don't want to connect one signal to the two positive inputs but two different signals which are really the same but 180 degrees shifted.

Would the window mode still work?

Using the event router I would like to be able to increase a counter if the signal goes outside the window.

 

example:

signal comparator 1:

  /\    /\

 /  \  /  \   ---- Vcc/2

/    \/    \

signal comparator 2:

\    /\    /

 \  /  \  /   ---- Vcc/2

  \/    \/

Expected event output (count on outside window):

+   +--+   +

|   |  |   |

+---+  +---+

 

Thanks

 

 

 

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

What are other parameters of that signal? And what exactly you need to count? Why not simply connect your differential input to a single comparator inputs?

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

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

The signal is approximately a triangle wave of 1MHz.

The counter must increase if the peak-peak value of the signal is outside approximately 500mV of vcc/2.

Since the signal is truly differential I cannot use a single comparator input. Common mode signals must have no impact on the window comparator.

 

 

Thanks.

 

 

 

 

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

Comparator has both inputs exposed, it will convert your differential signal into single ended. But I still don't get what you need to do. Is 500 mV a desired difference between differential signals? What Vcc/2 has do to with anything then?

 

Since you are counting peaks, they will follow with the same frequency as signals grossing in the differential signal, so just count those instead and comparator will do that nicely.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

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

500mV is indeed the desired difference between the 2 signals (peak-peak). Vcc/2 is just the offset of the signal (ac coupled).

Because of this large desired difference I cannot use a single comparator with both inputs connected, even if hysteresis is enabled.

 

I do not quite understand what you mean in your last paragraph. 

So I can use 2 different inputs (one per comparator) in window mode?

 

 

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

Ok, so maximum P-P difference in your signal is 500 mV and you need to count number of zero-crossings (basically measure signal frequency)?

 

Why do you think you can't use AC in this case? There is no limit on a voltage difference for the AC, both inputs can take voltages in the range 0-Vcc. Just connect your differential pair to the inputs of the AC and count transitions of the output signal.

 

I still don't know exactly what you want to do, so I have no idea if window mode will work for you.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

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

Signals between -250 and 250mV with respect to vcc/2 must be ignored.

I only want to count every transitions outside this range.

So add +1 to the counter if AC0_input>Vcc/2+250mV && AC1_input<Vcc/2-250mV.

 

I believe this cannot be done using 2 separate ACs but only using windows mode, if allowed.

 

 

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

In this case window mode will work, but but it won't help you much. In any case you will have to set thresholds for the comparator. There is a crude 64 level divider, which may or may not be good enough. Otherwise you will have to provide reference voltages from outside. And once you have this, just route both comparator events to the counter. There is really no need for window mode in this case.

----

LE: never mind  stuff about window mode, I've missed && in your condition. The stuff about threshold still holds. Let me think a bit more about it.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

Last Edited: Thu. Jun 11, 2015 - 10:14 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I think you should be able to use the window mode, but you will have to use INSIDE mode, but configure AC inputs in a way that the output is low when the signals are outside of the range.

NOTE: I no longer actively read this forum. Please ask your question on www.eevblog.com/forum if you want my answer.

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

Thanks Alex, this was exactly the answer I was looking for.