This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

LPCOMP delay

Hi,

I can't find any data on the analog comparator delay in the datasheet. Except the 15 us for anadetect signal. Is this the delay through the comparator for normal signals as well? What would the total delay be through comparator and PPI to a GPIO pin? And what would expected jitter for that delay be?

Trying to implement a cheap way of measuring small (< pF) capacitance-changes by using the lpcomp in an rc-relaxation oscillator.

  • Hi

    The delay though a PPI channel should be one clock cycle, i.e. 62.5ns

    The delay in LPCOMP from the time an input signal exceeds the configured reference signal with 50mV is typically around 20us until an event is triggered (UP, DOWN or CROSS). If the input signal is more than 50mV higher than the reference, the delay is going to be somewhat smaller. Similarly, if the input signal is less than 50mV higher than the reference, there is more delay. It is perhaps not as deterministic as you would like it to be, but 20us should give you at least an idea.

    On the other hand, there is a cap-sense example available on Nordic's Github which uses a TIMER, LPCOMP and two GPIO pins to implement cap-sense. Is that what you are thinking about? It implements auto-calibration feature and is fairly efficient on current consumption.

  • Thanks! I've figured out another way of doing the capacitive measurement that works for me. I've configured GPIOTE events and the PPI to make two gpio pins behave as a schmitt-trigger with inverted output. This allows me to create an rc relaxation oscillator that I can count pulses on with a timer. For my setup this seems to be more than accurate enough, I can easily detect capacitance changes of less than 1% in a 3-6pF capacitance (can detect a waving hand 5-10cm away from a captouch pad). This also allows me to use any gpio, not just the analog ones. It is fairly quick too, I'm doing one measurement in less than 100us. I'm also using the timeslot-functionality in the softdevice to stay away from noisy radio-events, this eliminated the need for any filtering of the signal in my application, I have less than 1% jitter. One question: Do you expect the hysteresis on the gpio to change?

  • By hysteresis, do you mean the V_IH and V_IL in table 62 in the nRF51822_PS v3.1 ?

  • Yes, that is the hysteresis I mean. Do you have any information on how this hysteresis might change between devices and over voltage and temperature for the chip? My application will stay pretty much constant at about 10 degrees above room temperature and powered from a coincell. Since I'm doing relative measurements I'm mostly interested in if you expect there to be big variations in V_IH and V_IL between devices, future revisions/chips.

Related