9 Replies Latest reply on Mar 30, 2015 9:33 AM by DaKn_263916

    Analog and digital pin



      Since a week I have started to work with PSoc creater and I must say I like the concept. I didn’t take to long however to run into it’s limitations – the analog router. My goal is easy: 16 pins need to be connected to an analog multiplexer, easy. Also I want to be able to drive a logical 1 onto each and every one of these pins. This is where the trouble starts. The compiler does not allow this for the following reason:     



      The digital input of pin "Pin_16(0)" is occupied. This pin is connected to an AMuxHW component, which indicates its digital input is expected to be controlled by the only matching hardware control signal on the AMuxHW component.     



      I got a nice explanation with the error message to:     



      If a GPIO pin is connected to an AMuxHW component, its digital input is expected to be used by the matching digital control signal on the AMuxHW component. So this GPIO pin's digital input signal should be reserved for the matching digital control signal on AMuxHW component only.     



      I must say I find it nice that the compiler presumes to know what I want to do. My Goal is easy. Put a logical 1 on one of the pins and measure the voltage on the other pins. I know this should be possible for 2 reasons: A pic processor can do this, even the most stupid one, and the analog part of a pin should have nothing to do with the digital part. It is perfectly valid to write a digital 1 using the digital logic and read it out with the analog logic (which should be separate and apparently is) to check if there is no short circuit.     



      I tried 5 different approaches to do this, differential muxes,… most of the time I got routing problems. I somebody could explain me why I got this problem and how to tell the compiler to ignore this please do. If I need to write to the registers directly to circumvent the router, my pleasure.     



      Thank you for your help.     


        • 1. Re: Analog and digital pin

           I was not sure you could easely open the schematic alone, here is the full project.

          • 2. Re: Analog and digital pin

            Welcome in the forum, Maarten.


            Probably a language bareer (my native language is nor English) but it is not quite clear for me what you want to perform exactly.


            Let's reduce your problem a bit for the time: Muxing 16 analog inputs to a pin output will work. When one of the inputs to the mux is form a pin set up differently will work, too. What spoiled your design was the optimizer which thinks "An input pin constantly fed with logical one (1) is not of much use", so relevant parts of your design are optimzed-out.


            1st': Remove the check "Hardware Connection" for the pin, the logical "1" and the wire.


            2nd: Write a logical 1 to the pin in your initialization sequence using Pin_16_Write(1u);


            3rd: (Optional) remove the output enable mimic, I see no need for that.




            Happy coding



            • 3. Re: Analog and digital pin

               Thank you, you fixed the problem!


              First of all let me explain the problem a bit better. I have 16 “probes” that probe conductive wool with constantly changing resistance. I want to know the resistance between al my probing points. To do this, I multiplex al these points to my ADC, therefore, I need a multiplexer. The next step is to raise the voltage of 1 of the probes to logical 1 and measure the voltage on the other pins.     



              1st: removing the HW connection solved my problem. I can indeed write a logical 1 to all the pins in software, so no worries there.     



              2nd: correct     



              3rd: the output enable mimic is essential: if an output is disabled, the logic goes to a Z-state, or high impedance. This allows me to do accurate measurements without the digital logic pulling the pin low of high. This can be circumvented by using an Open drain, drives high configuration. But I prefer using both to minimize leakage.     



              I appreciate your help, thank you.     


              • 4. Re: Analog and digital pin

                 Awesome, my design is valid now but, believe it or not, routing an analog multiplexer apparently is stupendously difficult. I build up my multiplexer and, it laid it out nicely, only the pins are not next to each other. So I locked some pins in order, error, unable to route. I thought it was strange so I undid all the locked pins and tried again. Sure enough a solution was found. Now I just locked some of the pins in the solution in the proposed space and tried again.


                Routing failed,… I knew there was a solution, it was compiled just a minute before but know, it was unable to do it again. I would really like to get the pins next to each other, is there a way of doing this? Thank you for you help.     


                • 5. Re: Analog and digital pin

                   In response to my own post, the problem is solved if I remove the output enable. I think this is because the digital pins bring their own requirements and the router has a hard time dealing with them. Removing the output enable fixes the problem. However I would like to note that locking a pin of a working solution in place should not prevent the router to find the same solution again. I Hope cypress will have a closer look at their routing protocol.




                  • 6. Re: Analog and digital pin

                    Attached the maximum I can find for a PSoC4 chip. There are some routing restrictions you have got in a PSoC4 (not in a PSoC5)


                    The analog muxes connect to pins directly, no chance to route internally.


                    The analog input mux for the SAR ADC is 8 bit wide




                    You are using a BLE chip which is only supported (so far) by PSoC4 or PRoC4. So when that high number of channels is required consider a two-chip solution consisting of a PSoC5 for data acquision and a PSoC4 for the communication.





                    • 7. Re: Analog and digital pin

                      To get a little bit more insight into the analog capabilities of a PSoC4 open the .cydwr-file in Creator and open the Analog view. There you can see the mux connected to the ADC which is indeed only 8-bits wide. Each of the circles represents an analog switch with is eiter opened, closed or in a used state under program control. The resistance of a switch, which might be important for analog design, can be "measured" with the ohmmeter.


                      Yes, I admit: A bit different from a PIC-design.





                      • 8. Re: Analog and digital pin

                        The impact of the switch R is minimal if being used to supply


                        A/D input or a buffer, as no current is drawn. There is impact


                        on settling time due to RC effects.




                        I have filed a CASE to get the following answered -




                        In datasheet SAR input R is 2.2K max. In TRM
                        Seq MUX is 600 ohms max.

                        1) So is input R of the Seq SAR 2.8K ?

                        2) Is the 2.2K an AC equivalent or DC ?

                        3) Is the Input R to ground, eg. it draws current and acts as
                        a voltage divider for any inputs ? If this is case do we have a
                        V divider of 600 ohms in, 2.2K to ground ? Clearly this could


                        not be the CASE as the Rdson of the mux varies significantly


                        device to device.


                        4) If the input R is AC, then what should a designer use for an input
                        equivalent model in order to calc settling time to 12 bits, or to any
                        resolution for that matter ?

                        Regards, Dana.

                        • 9. Re: Analog and digital pin

                          To negate the effect of mux switch R consider doing this -







                          If you are running SAR fast then buffer settling time would have to


                          be considered. Or provide some delay after each mux change.




                          Regards, Dana.