8-bit-level-comparator input mode?
ManAtWork
Posts: 2,176
in Propeller 2
In the P2 data sheet in chapter "OVERVIEW" I found "Each smart I/O pin has the following functions: ... - Logic, Schmitt, pin-to-pin-comparator, and 8-bit-level-comparator input modes". But I haven't found a hint how to setup this mode in the smart pin mode description.
I try to find out what is the simplest way to implement an overcurrent shutdown in a brushless motor driver. I have 3 current sensors which output an analogue voltage centered to 1.65V. When one of the sensors saturates, ie. goes below 0.3V or above 3V, I have to shut off the PWM power stages as fast as possible (within ~2µs). The sensor signals go to ADC inputs of the P2. But the ADCs are too slow because I configure them for maximum resolution. Also to cancel out noise and subsampling/alias effects with PWM ripple currents ideally the sigma/delta integration period should match the PWM period.
I have lots of pins left so if the analogue comperator feature works I could connect each signal to two additional pins implementing a window comperator with the DACs of that pins held at constant 0.3 and 3.0V. If not I have to add external comperator ICs.
I try to find out what is the simplest way to implement an overcurrent shutdown in a brushless motor driver. I have 3 current sensors which output an analogue voltage centered to 1.65V. When one of the sensors saturates, ie. goes below 0.3V or above 3V, I have to shut off the PWM power stages as fast as possible (within ~2µs). The sensor signals go to ADC inputs of the P2. But the ADCs are too slow because I configure them for maximum resolution. Also to cancel out noise and subsampling/alias effects with PWM ripple currents ideally the sigma/delta integration period should match the PWM period.
I have lots of pins left so if the analogue comperator feature works I could connect each signal to two additional pins implementing a window comperator with the DACs of that pins held at constant 0.3 and 3.0V. If not I have to add external comperator ICs.
Comments
Then I can use IN to trigger an interrupt so that I don't have to waste a cog for overcurrent monitoring, I assume.
Maybe it's a good idea to have external hardware comperators, at least for the prototype. So shutdown is always guaranteed even if the software doesn't work. The cost of the comperators is neglible, but I fear I could run out of PCB space.
I've seen in the schematic that the P2 eval board uses a lot of seperate LDO regulators. Would this provide lower noise to the ADC and DAC pins if I reserve one of the 4 chip edges for analogue signals and spend it an extra low noise LDO?
The physical arrangement of the I/O supply rails in the prop2 is one per VIO pin, which each supplies just four I/O pins. So you could have up to 16 LDOs to gain maximum benefit.
EDIT2: What has happened is a few of us got a fried I/O or two when shifting VIO jumpers on the revA Eval Boards with the power still on. A possible explanation is on jumper contact the neighbouring ceramics overwhelmed the immediate ceramics, triggered the latch-up, then the large storage caps of the switchmode delivered the destructive current. The revA board has two VIO sources of supply with a ring of jumpers to choose with.
EDIT: V2831 (VIO pin) is special. It supplies the power for the crystal oscillator, the PLL oscillator, the two RC oscillators and the clock source select logic. Nothing runs without that supply up.
V6063 may also hold the chip in reset (untested) if not powered.
I think I'll use a ferrite bead and extra C for the PLL/Osc and an extra LDO for the analogue subcircuit in the prototype. Then I can short this to normal VIO to check if there is a remarkable difference.
As mentioned above, one pin also powers VCO/PLL, so that should have special attention.
A low noise LDO helps ADC and DAC operation. I selected NCP187AMT330TAG, as it has high peak current, and has Power Good pin. (P2 has no BOD)