2019-10-30 06:37 AM
I have a STM32L072KB microcontroller and want to combine two analog signals (they represent a kind of "quadrature encoded signal" with a 50% duty cycle) into one "combined digital output signal", which have the doubled frequency (for my purpose the doubled output signal is used to provide the doubled accuracy)
I am using the both comparator peripherals COMP1 and COMP2 for detecting the signal edges and it works fine to configure them that they directly relay the COMPX_OUTs to a predefined, but for each comparator separate and fixed GPIO (without any SW/ISR delay):
Due to my HW layout, I want to realize something like this configuration:
or
I have not found a way to directly connect both comparator outputs into one single output pin without introducing an SW/ISR delay/latency. I read that some general purpose timers offer a so called "Hall" encoder mode, which supports XOR-ing up to 3 input signals. But since connecting a Timer directly to a GPIO via DMA seems to be impossible on a STM32L0-core, I have no idea how to implement this...
Does anyone know a "hardware/fast way" to route/XOR simultaneously both COMP_OUTs of a STM32L0x2 to a single GPIO output pin (either PA11 or PA12) or is it in that case inevitable, to use an ISR-based solution (the HW-layout is fixed and cannot be changed)?
2019-11-03 01:31 PM
Maybe this could be pulled out by
and that's roughly it.
It is a bit fragile in that it needs to be started when COMP2OUT has the proper polarity, and edges in COMP2 must be far enough apart each other so that the whole mechanism succeeds to write the proper value into COMP1_CSR for each edge.
JW