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

PSoC™ 6

stratuscent_mtl
Level 1
First like received 10 sign-ins 5 replies posted
Level 1

Hi,

We are trying to port the existing firmware in PSOC Creator to ModusToolbox to make it available for the new chips.

However, the biggest challenge we are facing right now is the Analog Multiplexer that's not available in ModusToolbox as it is in PSOC Creator.

I'm wondering if there is any example on how to use the AMUX in ModusToolbox?

Any help will be much appreciated.

Thanks in advance.

GP

0 Likes
1 Solution
Raj_JC
Moderator
Moderator 50 solutions authored 10 likes given 100 replies posted
Moderator

Hi @stratuscent_mtl,

I have tested the code for Port 12_0 and Port 6_2. You can change it to the Port 11 instead of Port 12.

1) First to connect the Port 11 to Port 6 requires additional HSIOM switches, AMUX_SPLIT_CTL[1] and AMUX_SPLIT_CTL[2].

HSIOM->AMUX_SPLIT_CTL[1] = HSIOM_AMUX_SPLIT_CTL_SWITCH_AA_SL_Msk \

| HSIOM_AMUX_SPLIT_CTL_SWITCH_AA_SR_Msk \

| HSIOM_AMUX_SPLIT_CTL_SWITCH_BB_SL_Msk \

| HSIOM_AMUX_SPLIT_CTL_SWITCH_BB_SR_Msk;

HSIOM->AMUX_SPLIT_CTL[2] = HSIOM_AMUX_SPLIT_CTL_SWITCH_AA_SL_Msk \

| HSIOM_AMUX_SPLIT_CTL_SWITCH_AA_SR_Msk \

| HSIOM_AMUX_SPLIT_CTL_SWITCH_BB_SL_Msk \

| HSIOM_AMUX_SPLIT_CTL_SWITCH_BB_SR_Msk;

2) Connects Port 12_0 as input to the AMUXBUSA with following:
Cy_GPIO_SetHSIOM(GPIO_PRT12, 0u, P12_0_AMUXA); /* Connect P12_0 to AMUXBUSA. */
Cy_GPIO_SetDrivemode(GPIO_PRT12, 0u, CY_GPIO_DM_HIGHZ); /* Make P12_0 as input pin. */


3) Connects Port 6_2 to AMUXBUS as output
Cy_GPIO_SetHSIOM(GPIO_PRT6, 2u, P6_2_AMUXA); /* Connect P6_2 to AMUXBUSA. */
Cy_GPIO_SetDrivemode(GPIO_PRT6, 2u, CY_GPIO_DM_ANALOG); /* Make P6_2 as output pin. */

I hope this helps in configuring your application. Please, let us know if you need further clarification.

Thank you

Best Regards

Raj Chaudhari

View solution in original post

0 Likes
10 Replies
Raj_JC
Moderator
Moderator 50 solutions authored 10 likes given 100 replies posted
Moderator

Hi @stratuscent_mtl,

You can refer to the attached document for configuring GPIO to connect to the AMUXBUS. This document contains the application for ADC with non-dedicated GPIO pins. It can help with your application. You can refer to the PSoC 6 architecture TRM for AMUXBUS configuration.

Please, let me know if you need further clarification.

Thank you

Best Regards

Raj Chaudhari

0 Likes
stratuscent_mtl
Level 1
First like received 10 sign-ins 5 replies posted
Level 1

Hello,

Thank you very much for your reply, much appreciated. 

Our system is a bit different, we use an external ADC connected to a specific PIN on PSoc6 to read data , I need to create the Analog Mux that connects to the list of sensors via GPIOs and re-route signals to the PIN that connects to the external ADC. 

I'm wondering if you have a working example related to the AMUX in Modustoolbox?

Thanks in advances.

GP

 

0 Likes
stratuscent_mtl
Level 1
First like received 10 sign-ins 5 replies posted
Level 1

Hello,

I attached the source code that I use to route the analog signal, I'm wondering if it is the right place to initialize the routing? I know that the switch will be handled at runtime by adding new functions to write to the registers.

For now, I'm trying to re-route the signal from the first sensor (the input is Port 11 - pin 5 connects to the AMUXBUS A), how can I configure the Port 6 - pin 2 as the output of AMUXBUSA?

Thank you very much.

GP

 

 

0 Likes
stratuscent_mtl
Level 1
First like received 10 sign-ins 5 replies posted
Level 1

Hi,

To clarify, I've attached here the analog subsystem as well as the HSIOM registers addresses of the chip CY8C624ABZI-D44 that we're using.

Can you please give me an example of setting the input for AMUX at runt-time at port 11-pin 5, and the output of that AMUX is port 6-pin 2.

Thank you very much.

GP

0 Likes
stratuscent_mtl
Level 1
First like received 10 sign-ins 5 replies posted
Level 1

Hello,

Based on the given example, I was able to create the switch for the AMUX in Modustoolbox. However, we use the external ADC, so we need to set up the output of the AMUX that will be used as the input of the ADC.

I'm wondering how can I setup the output of the AMUX to a specific port-pin?

Thanks in advance.

GP

 

0 Likes
Raj_JC
Moderator
Moderator 50 solutions authored 10 likes given 100 replies posted
Moderator

Hi @stratuscent_mtl,

I have tested the code for Port 12_0 and Port 6_2. You can change it to the Port 11 instead of Port 12.

1) First to connect the Port 11 to Port 6 requires additional HSIOM switches, AMUX_SPLIT_CTL[1] and AMUX_SPLIT_CTL[2].

HSIOM->AMUX_SPLIT_CTL[1] = HSIOM_AMUX_SPLIT_CTL_SWITCH_AA_SL_Msk \

| HSIOM_AMUX_SPLIT_CTL_SWITCH_AA_SR_Msk \

| HSIOM_AMUX_SPLIT_CTL_SWITCH_BB_SL_Msk \

| HSIOM_AMUX_SPLIT_CTL_SWITCH_BB_SR_Msk;

HSIOM->AMUX_SPLIT_CTL[2] = HSIOM_AMUX_SPLIT_CTL_SWITCH_AA_SL_Msk \

| HSIOM_AMUX_SPLIT_CTL_SWITCH_AA_SR_Msk \

| HSIOM_AMUX_SPLIT_CTL_SWITCH_BB_SL_Msk \

| HSIOM_AMUX_SPLIT_CTL_SWITCH_BB_SR_Msk;

2) Connects Port 12_0 as input to the AMUXBUSA with following:
Cy_GPIO_SetHSIOM(GPIO_PRT12, 0u, P12_0_AMUXA); /* Connect P12_0 to AMUXBUSA. */
Cy_GPIO_SetDrivemode(GPIO_PRT12, 0u, CY_GPIO_DM_HIGHZ); /* Make P12_0 as input pin. */


3) Connects Port 6_2 to AMUXBUS as output
Cy_GPIO_SetHSIOM(GPIO_PRT6, 2u, P6_2_AMUXA); /* Connect P6_2 to AMUXBUSA. */
Cy_GPIO_SetDrivemode(GPIO_PRT6, 2u, CY_GPIO_DM_ANALOG); /* Make P6_2 as output pin. */

I hope this helps in configuring your application. Please, let us know if you need further clarification.

Thank you

Best Regards

Raj Chaudhari

0 Likes
stratuscent_mtl
Level 1
First like received 10 sign-ins 5 replies posted
Level 1

Thank you very much for your explanation, much appreciated. I'll keep you updated on this issue.

GP

0 Likes
stratuscent_mtl
Level 1
First like received 10 sign-ins 5 replies posted
Level 1

Hi Raj,

In the step 2  - make the pin P12_0 as input, I'm wondering if the drive mode is CY_GPIO_DM_ANALOG, instead of CY_GPIO_DM_HIGHZ? Can you please confirm that?

My understanding is the input pin connects to the analog signal, the same with the output pin. What we' re doing is to connect two pins internally by using the AMUXBUSA.

Thank you so much and looking forward to hearing from you.

GP

 

 

0 Likes
Raj_JC
Moderator
Moderator 50 solutions authored 10 likes given 100 replies posted
Moderator

Hi @stratuscent_mtl,

We performed an analysis for the above code and we got similar results for the CY_GPIO_DM_ANALOG and CY_GPIO_DM_HIGHZ. So, you can use either of them.

Please, let us know if you need further clarification.

Thank you

Best Regards

Raj Chaudhari

0 Likes
stratuscent_mtl
Level 1
First like received 10 sign-ins 5 replies posted
Level 1

Hi @Raj_JC ,

Thank you for your response. We eventually managed the AMUX on our side which is a totally different use case: we have 32 sensors connected to PSOC6, then we use an external ADC to measure the 32 values.

Your replies are helpful to clarify the issue with AMUX that is not done automatically in Modustoolbox as it is in PSOC Creator.

Regards,

GP

0 Likes
Top labels