8 Replies Latest reply on Apr 6, 2020 6:46 AM by IaCa_4674211

    Is it possible to create a Bilateral switch

    IaCa_4674211

      Hello, I require a Bilateral switch as per a 4066, I have tried using the creation wizard, but limited editing of the functions prevents me from creating this component, is it possible, or is there an example in existence already?

       

      Kind Regards 

        • 1. Re: Is it possible to create a Bilateral switch
          GaneshD_41

          Hi,

           

          >>"I have tried using the creation wizard, but limited editing of the functions prevents me from creating this component."

          --> Are you mentioning about PSoC Creator or PSoC Designer? If not, please point us to the creation wizard.

           

          Cypress do not have similar 4066 device that you are looking for. Cypress has microcontrollers those operate in the range of 0-5.5 volts which contains ARM based CPUs.

           

          Thanks

          Ganesh

          • 2. Re: Is it possible to create a Bilateral switch
            IaCa_4674211

            HI ganesh, I should have mentioned I am attempting to use a FPGA

            CY8CKIT-146, I noticed there are Analog multiplexers which are similar,

            do you you know if I could modify it to operate as a Bilateral switch?

            Kind regards

            Ian

            • 3. Re: Is it possible to create a Bilateral switch
              VasanthR_91

              Hi Ian,

               

              Analog muxes can be used to connect two pins with the help of firmware. But unlike 4066, inside PSoC4 device analog mux is a limited resource which helps in the connectivity of other analog peripherals and pins in the device. You should be able to connect two sets of pins at the same time in this manner, if the analog muxes are not used for any other functionality. I hope this is clear.

               

              In PSoC Creator , go to CYDWR-> Analog tab, to see what registers to be written to connect pins. You can use CY_SET_REG32() API for the purpsoe.

               

              Best Regards,
              Vasanth

              • 4. Re: Is it possible to create a Bilateral switch
                IaCa_4674211

                Hi Vasanth, You mention using "CY_SET_REG32()API", you appear to be using cyelftool, how do I access this tool, or can you give instructions for accessing the registers?

                Kind Regards

                 

                Ian

                • 5. Re: Is it possible to create a Bilateral switch
                  VasanthR_91

                  Hi Ian,

                   

                  Information about the API from PSoC4 system reference guide is given below.

                   

                  void CY_SET_REG32(uint32 reg, uint32 value)

                  Description: Writes the 32-bit value to the specified register. This macro implements the byte swapping required for proper operation. Parameters:

                  reg: Register address value: Value to write

                  Return Value: None

                   

                  You can find the address, value to be written and the max from device CYDWR-> Analog tab as mentioned before.

                   

                  Best Regards,
                  Vasanth

                  • 6. Re: Is it possible to create a Bilateral switch
                    IaCa_4674211

                    Hi Vasanth, I am new to this processor and don't know my way around, is there a document you can point me to, to guide me through this process?, My problem is, I have no idea where to write this code, I can visualise what is required.

                    Kind regards

                    Ian

                    • 7. Re: Is it possible to create a Bilateral switch
                      VasanthR_91

                      HI Ian,

                       

                      I can help you with that. You are using a PSoC 4 device. PSoC Creator is the design tool is used with it. PSoC Creator 101 should be helpful for you to get started with it. It is an Integrated Design Environment (IDE) that enables concurrent hardware and firmware editing, compiling and debugging of PSoC and FM0+ systems. Applications are created using schematic capture and over 150 pre-verified, production-ready peripheral Components. Components are analog and digital peripherals represented by a symbol that users drag-and-drop into their designs and configure to suit a broad array of application requirements. Each Component in the rich mixed-signal Cypress Component Catalog is configured with a customizer dialog and includes a full set of dynamically generated API libraries. After configuring all the peripherals, firmware can be written, compiled, and debugged within PSoC Creator or exported to leading 3rd party IDEs such as IAR Embedded Workbench®, Arm® Microcontroller Development Kit, and Eclipse™.

                       

                      As PSoC Creator tool helps with component configuration and device boot up and all the designers can work from writing the code in main.c once everything is configured. Normally schematic capture you have done will be translated to registers writes in cyfitter.cfg file. As in your case, as you have to make modifications to the code , you can do it using register write macro's as I have told you earlier in this thread. You can close and open switches using register writes as I have defined before. So this is the way you can connect two pins. Again remember that PSoC4 device analog mux is a limited resource which helps in the connectivity of other analog peripherals and pins in the device. You should be able to connect two sets of pins at the same time in this manner, if the analog muxes are not used for any other functionality.

                       

                      Now to show an example snippet, use something as follows:

                       

                          #define PORT_SEL0 0x40020100
                          #define SWITCH_MASK 0xF0000000
                          #define SWITCH_CODE 0x60000000
                         
                          uint32 regValue;
                          regValue = CY_GET_REG32(PORT_SEL0);
                          regValue = regValue & ~ SWITCH_MASK;
                          CY_SET_REG32(PORT_SEL0, regValue | SWITCH_CODE);
                      

                       

                      Best Regards,
                      Vasanth

                      • 8. Re: Is it possible to create a Bilateral switch
                        IaCa_4674211

                        Hi Vasanth, I really appreciate you taking the time to give a full explanation in regards to modifying components,vI really look forward to constructing my first project using PSoC,

                         

                        Kind regards

                        Ian