Sample program for non-dedicated analog port

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

cross mob
SuSu_4809166
Level 1
Level 1
First comment on KBA 5 replies posted 5 sign-ins

Hello,

I have been referring to some thread related to how a non-dedicated pin can be used for ADC.

I would like to route the Non-Dedicated Pins (P8[0:7]) as SAR ADC Inputs through AMUXBUSA/B for PSoC 6 MCU in MTB2.2.

I see some useful code snippets here

"https://community.cypress.com/t5/Knowledge-Base-Articles/Route-Non-Dedicated-Pins-as-SAR-ADC-Inputs-..." 

but I'm not clear on how the macros are used (eg: MUX_SWITCH, CONFIG_CHANNEL, etc). Also I would like to see how one can close the route and reopen it for another set of pins (I have to use 8 pins through AMUXBUSA/B). Also how do I read the ADC value on these pins. It would be better if you could share with me a working sample code. Thanks for your help.

regards,

Suresh

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

Hi Suresh,

Which version of Modus ToolBox are you using ? Modus ToolBox 2.3 is released now and you can use Device Configurator to assign the pins from AMuxBus as the ADC input.


Vasanth_0-1619075548374.png

 

Best Regards,
Vasanth

View solution in original post

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

Hi Suresh,

Which version of Modus ToolBox are you using ? Modus ToolBox 2.3 is released now and you can use Device Configurator to assign the pins from AMuxBus as the ADC input.


Vasanth_0-1619075548374.png

 

Best Regards,
Vasanth

0 Likes

Hello Vasanth,

 

Thanks for your response. In our project, we are not using 'Device Configurator' to configure any peripherals. So I would like to configure Port_8 all 8 pins as ADC input in the code and be able to read the values. I'm using MTB 2.2.

Can you please share complete sample code to configure non-dedicated pins as ADC inputs? Or can you please explain the code snippet shared in my previous post on how the macros are used in the code and how to further configure after analog routing to be able to read values? Thanks.

regards,

Suresh

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

Hi Suresh,

Our first recommendation will be to move to the latest version of MTB available. This will also make sure that you do not face any issues that is  already resolved in the latest version. Let me know your thoughts on that.

Best Regards,
Vasanth

0 Likes
SuSu_4809166
Level 1
Level 1
First comment on KBA 5 replies posted 5 sign-ins

Hi Vasanth,

Migrating to MTB 2.3 is not a problem, but we will still need to ADC configuration and routing in the code. 

thanks,

Suresh

0 Likes