PSOC5 Analog Gotchas, Interesting Trick

In previous posts, I showed how to create a voltage 1/2 of your VDDA using analog pins with pull up/down resistors. Manipulating these pins through writing values to them provides you with the ability to output +5v (VDDA), (approx) 2.5v (~1/2 VDDA), and 0V in code, without using external components.

Well, I was working with an OpAmp routed to a pin other than the default, and came across a surprise. Why? Because I am lazy. Never read a manual unless you hate surprises.

As I was working with the analog subsystem, the Verilog Warp Compiler told me that I using certain pins that were specified for Special purpose output prohibited their use for those purposes.

Well, the Compiler was Right in a Wrong kind of way.

I NEVER paid attention to the analog visualizer on the PSOC5LP in the past. My mistake. It showed me the real problem. I thought I had a bad PSOC, I was getting a signal on a pin that I never expected.

What the Compiler should have said, was: The OpAmp #0 Output is tied directly to P0[1] pin, so if you enable the OpAmp, that pin will be taken over and the output signal will be overwritten by the OpAmp’s current driving State. This is true, even if the pin IS NOT SPECIFIED in your project. You can’t change this. Routing to another output will work, but both outputs will be active simultaneously.

In other words, enabling Opamp 0 will cause P0[1] to become active, even if that pin does not show up in the Project’s Pin Map or any C or assembly code in your project.. That Pin’s auto config at boot (i.e. high impedance analog) helps to drive the point home. Yes, you can route the OpAmp’s output to P0[6], but it will also show on P0[1], always!

So, the moral of the story is this: If you use an OpAmp, its hard-wired pin will always be active. If the OpAmp is NOT turned on, that pin is available for use.

OPAMP NUMBER Pin Number*
0P0[1]
1P3[6]
2P0[0]
3P3[7]
OpAmps and Pins Forcibly Used on the PSOC 5.

* If OpAmp is enabled, these pins are Always On. Can’t be Turned Off.

This is a stupid engineer trick that took many years to surface. Not sure why I never had this problem before.

Interesting Trick, 3.3v from 5v

I needed to interface to a 3.3 volt part that used about 10 ma of current. I did not want to put a 3.3 volt Regulator on the board. So I tried something stupid. It worked! Nothing blew up!

First, get your schematic, put down a DAC, and an OpAmp. Route the OpAmp Pin on your PC Board to the VDDIO pin you wish to interface to your 3.3v part. Set the Output on the DAC to 3.3v, feed it into the OpAmp, make the OpAmp a follower, high power. Enable in code.

You can power your external part, and the VDDIO at 3.3 volts using the OpAmp, if you are within the current specs of less than 30ma for the PSOC Opamp. I found it stayed within 0.1 volts of 3.3v from room temperature to 300 degrees F (150C).

An interesting side benefit: The output is almost free from noise. I used it to power a wheat stone bridge and a switch, keeping the noise at an absolute minimum, using a noisy 5 volt supply. It made averaging the measurements much easier, allowing resolution of around 0.000007 volts. (Yes, 7 microvolts)

Fini

PSoC 5 continues to surprise me. Mostly because I am an idiot.

Enjoy!

Add a Comment

Your email address will not be published. Required fields are marked *