My Favorite PSoC Hacks - Connect AGND to a Pin | Cypress Semiconductor
My Favorite PSoC Hacks - Connect AGND to a Pin
In this new series I will share with you some of my favorite PSoC Hacks – like cool things you can do by simple register writes or fixes to some of known issues in PSoC.
Usually, in systems that involve bipolar signal measurement, you will have to bring out the internal AGND to an external pin so that the input signal may be referenced to AGND. The simplest method to do this would be to use the RefMux user module (from the MUXs category in the User Module catalog) and set the reference to AGND – see figure below.
However, the disadvantage with this method is that this occupies one CT block. If your design has PGAs INSAMPs or CMPPRGs that occupy all the CT blocks, then there is no place for the RefMux user module. There is another way – The Hacker’s way – to bring out AGND. See the block diagram of a CT block below.
The TestMux inside the CT block can be configured to connect the AGND to the Analog bus (The RefMux UM uses this resource). Provided a resource placed in the CT block does not use the Analog bus, the same CT block may be used to bring out AGND by enabling the TestMux using register writes. For example, if you have a PGA placed in ACB00, the TestMux in ACB00 can be used to connect AGND to the Analog Bus and to P0.
Enable the Analog buffer in Analog Column 0 and write following 2 lines of code in the beginning of main.c to connect AGND to the analog bus.
ACB00CR2 &= ~0x1C; // Clear the testmux bits
ACB00CR2 |= 0x14; // Enable Testmux and select AGND as output of TestMux
REFHI and REFLO may be brought out the same way:
ACB00CR2 |= 0x18; // Connect REFLO to analog bus
ACB00CR2 |= 0x1C; // Connect REFHI to analog bus
Remember, for this to work, the analog bus should not be used by either the CT block or the SC blocks in that column.
Stay tuned for more hacks!!