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

Comparator External Connections

I am attempting to use the COMP section to build a relaxation oscillator. There appear to be a number of interactions between sections, some of which are subtly documented and some for which I find no documentation. For instance, the inability to set a GPIO output once a task is connected to a pin is documented but well-hidden. The fact that enabling a pin as a comparator input completely disables both digital inputs and digital outputs is not documented anywhere that I can find.

Bottom line is that I have everything working nicely as it should, except that the comparator sometimes appears to miss a transition and thereafter is hung. I fundamentally just need to be able to place the comparator output on a digital output pin, but the only way I can find to do that is via the crossing events from the comparator, feeding set and clr tasks of GPIOTE. This causes the same sort of problems as the early IBM PCs using edge-triggered interrupts: If you miss one, you're dead forever. Is there a better way to get the comparator output to appear on a pin? If not, how best can I initialize things to ensure that I don't miss a transition?

Parents
  • Very interesting post; we would like the same functionality for a similar purpose. Given that the crossing event (being edge-triggered) may be missed, is it possible to connect the Compare Result register (0x400) to the PPI, or is that denied to it not being within the Events register groupings? My suggestion is based on the fact that the PPI link could in theory be set to any register, but I haven't tried this. The datasheet states Pointer to event register. Accepts only addresses to registers from the Event group but that might be misleading and any register address could perhaps work .. The Compare Result register register looks like t is the direct comparator output without any edge detection involved.

  • The PPI peripheral will only work with a Event register address as the EEP. Setting it to another address, e.g. the COMP's RESULT register will not work. 

    Bjørn

Reply Children
No Data
Related