Is it possible to create a Bilateral switch

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

cross mob
IaCa_4674211
Level 3
Level 3
25 replies posted 10 replies posted 10 questions asked

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 

0 Likes
1 Solution
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

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

View solution in original post

0 Likes
8 Replies
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

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

0 Likes

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

0 Likes
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

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.

pastedImage_2.png

Best Regards,
Vasanth

0 Likes

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

0 Likes
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

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

0 Likes

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

0 Likes
Vasanth
Moderator
Moderator
Moderator
250 sign-ins 500 solutions authored First question asked

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

0 Likes

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

0 Likes