Equip yourself to optimize PSoc4 MCUs for Evs at the EV Webinar. Click here to register.

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

PSoC™ 4 Forum Discussions

Level 1
Level 1
First reply posted First question asked Welcome!

I have been tasked with testing CY8C4245 chips against various parameters on their OEM datasheet for authenticity, those parameters which include implementing and testing an analog comparator. Utilizing PSOC 101 videos and other online information I have already implemented various other tests which include I2C and other DC measurements of the GPIO pins with great success. Unfortunately after initial set up of my analog comparator I had noticed it was not acting as I had initially expected. I believe I have narrowed down my issues to C code specific to the comparator. I am aiming to use two hardware input pins P1[4], P1[5] to trigger the output P0[0] of the comparator so I can retrieve the “input offset voltage”. After various trials and errors I believe I need supporting C code to help with this. Is there any reference or example code showing the implementation of a fully functional comparator utilizing analog inputs that is available? I will in the near future be looking to test additional parameters relating to the comparator as well such as “Input Common Mode”. Any assistance or guidance in successfully implementing these tests is greatly appreciated.

3 Replies
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted


I wonder if you are using CY8CKIT-042 for the hardware.

In case, you are using CY8CKIT-042, P1[4] and P1[5] are used and connected for CapSense.

So external Analog Input from these pins may not act as you expected.


I would recommend you to try with other input pins, which are not used for other purpose.

Attached is the schematic which I found in my PC, may be there is newer version on the Infineon web.


After all, if you are not using CY8CKIT-042, I'm sorry. m(_ _)m





I really appreciate the response, and I didn't even think about them being used for CapSense. Ill attempt to attach a picture of my set up as I am using the CY8CKIT-042 for hardware but slightly modified to test multiple different CY8 chips. My reasoning for choosing those two pins P1[4] and P1[5] were because after setting on the analog comparator those were the only two pins it would allow me to attach an analog input pin to (next to the pin assignment would be a green square. Every other option a yellow square or gray scaled out. 



50 solutions authored 50 sign-ins 100 replies posted

The pins shown in green are the most direct connection to the comparator (from opamp) inputs. The inputs can still come from other pins in yellow, routing through the analog mux bus routing. This can be seen in the analog routing view after building the project:


You have to be careful with routing, you use up analog mux bus connections pretty quickly.
Note that the opamp/comp positive inputs can route to the analog mux buses. But, if you do that, the routing to the negative inputs is more restrictive. You can logically route from the negative inputs over to Port 2, but Creator doesn't seem to like this routing, it balked when I tried to build it that way.
The simple thing to do is to just de-solder any discrete caps from P1.4 and P1.5 and press on with your testing.
---- Dennis Seguine, PSoC Apps Engineer