Hello everybody
I'm trying to understand if I can use a STM32F405 to do the following:
when an exernal interrupt occurs, enter the interrupt handling routine, and here do the following:
start a 12bit analog conversion, when conversion is ready, store the resulting 12bit value in a circular buffer on the RAM
read a particular digital input, and store that bit in a second circular buffer on the RAM
move both circular buffers write pointers
load a 12bit value from the circular buffer (in the position pointed by the read pointer) into the DAC
load a bit from the second circular buffer (in the position pointed by the read pointer) into a digital output pin.
move both circular buffer read pointers.
exit interrupt routine
Some details:
- the external interrupt is driven by a square wave VCO that can swing in frequency by a minimun of 40KHz (or less) to a maximum of 78KHz.
The VCO pulse width is <10%, and I want the interrupt to trigger on the rising edge of the pulse. The pulse voltage is 0V to 5V
So I'd say I have more or less 12.8us, at the worst case, to do those tasks between each interrupt.
- the signal that I'm going to read from the ADC is an AC signal, but is already externally filtered and also already held by an external sample and hold (so it's really a "stable" DC signal)
- the additional bit that I'm reading at every interrupt on the digital input pin is a sort of 13th bit: the AC signal is compared (prior to the converter, but after the external SH) against a threshold voltage, if the input signal voltage is greater, than the input signal is attenuated (prior to the converter) and that condition is the bit that I'm storing.
I need to study better this part, since I need to be sure that the attenuation/condition is ready before the convertion starts, so that the 13th bit and the 12bit values are always related to the same measurement.
- the signal to be converted should have a 0V to 10V range (but I'm still not sure, I have to measure it yet), in that case, I'll need to voltage divide it in the right ADC range (and of course, boost it again after the DAC)
- the circular buffer size I need is about 128KBytes, so I think I'm fine with the interal RAM (192K)
my doubts:
1) is that doable with a STM32F405?
2) is there enough time between each interrupt to do those tasks, without employing the DMA or other advanced features?
3) is there enough time (out of the interrupt routine) to read an external voltage used as control to set the circular buffer size?
4) since the signal I'm providing to the ADC is already filtered and held by a SH, should I configure the ADC in a different manner of the usual?
thank you and sorry for my bad english