Announcements
IMPORTANT: Cypress Developer Community is transitioning on October 20th. To learn more and be prepared for this change, check out our latest announcement.
cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

JaVa_4525396
New Contributor II

hello i want to use 12 bit on chip ADC of the "CY8C5467LTI-LP003" this chip , i am trying to use the PSoC creator for the same but i am getting confused that in datasheet it is mentioned that every GPIO can be used as analog pin, and in PSoC creator if i am implementing more than one ADC block it still only allow me to select only one pin of chip. am i misunderstanding something here? i just want to use 12 bit ADC pin, isn't it something easy like arduino ADC pins?

0 Likes
1 Solution
MotooTanaka
Esteemed Contributor

Hi,

I think that because of the "programmable" nature of PSoC,  number of allowable connections are limited.

So if one path is taken by some signal, allowable path(es) for the next signal is reduced.

I just tested with an ADC and 1 pin and saw "Analog" in the Workspace Explorer.

The "Black" line shows the path taken for this. So next signal will not be able to use this path.

ADC_5467_analog.JPG

For a complete description, you need to refer to "PSoC 5LP Architecture TRM".

https://www.cypress.com/file/123561/download

Section F: Analog System ch 28: Analog Routing

seems to be the description for this matter.

moto

View solution in original post

0 Likes
15 Replies
MotooTanaka
Esteemed Contributor

Hi,

I think that because of the "programmable" nature of PSoC,  number of allowable connections are limited.

So if one path is taken by some signal, allowable path(es) for the next signal is reduced.

I just tested with an ADC and 1 pin and saw "Analog" in the Workspace Explorer.

The "Black" line shows the path taken for this. So next signal will not be able to use this path.

ADC_5467_analog.JPG

For a complete description, you need to refer to "PSoC 5LP Architecture TRM".

https://www.cypress.com/file/123561/download

Section F: Analog System ch 28: Analog Routing

seems to be the description for this matter.

moto

View solution in original post

0 Likes
JaVa_4525396
New Contributor II

Thanks for this information, this solved one of doubts that one particular signal can be assigned to any GPIO (if mentioned in datasheet) but same path can not be followed or allowed to the another GPIO, yes i understood this, but how many MAXIMUM GPIOs i can use as ADC pins? like in arduino i can use 6 GPIO as ADC as they mention in datasheet, i have gone though the datasheet of PSoC 5 Family but not get the right info about how many max gpio i can use as ADC at the same time and exactly how many bits of resolution? is there any straight forward answer to this question?

thanks for the help and support.

0 Likes
MotooTanaka
Esteemed Contributor

Hi,

> ...but not get the right info about how many max gpio i can use as ADC

> at the same time and exactly how many bits of resolution?

> is there any straight forward answer to this question?

If you are asking exactly same time for sampling,

1 is the answer as there is only 1 ADC_SAR module.

But if you can allow multiple scan using 1 ADC,

logically the answer is 32 because of the ADC specification.

But to be honest, I was also interested in the "REAL" answer for this question.

So I create a stupid circuit, which has an ADC with 32 input and to show the result

I even added a UART on top of it.

000-schematic.JPG

And as I am a lazy guy, I let PSoC Creator to assign pins for ADC, I assigned only tx and rx of UART.

001-pin-assignments.JPG

Then I wrote a simple test program

main.c

===================

#include "project.h"

#include "stdio.h"

#define STR_LEN 128

char str[STR_LEN+1] ;

#define NUM_CH 32

void print(char *str)

{

    UART_PutString(str) ;

}

void init_hardware(void)

{

    CyGlobalIntEnable; /* Enable global interrupts. */

    UART_Start() ;

    ADC_Start() ;

}

void splash(void)

{

    print("Test How Many ADC input can we use? ") ;

    snprintf(str, STR_LEN, " (%s %s)\n", __DATE__, __TIME__) ;

    print(str) ;

}

void measure(void)

{

    int ch ;

 

    ADC_StartConvert() ;

    ADC_IsEndConversion(ADC_WAIT_FOR_RESULT) ;

    for (ch = 0 ; ch < NUM_CH ; ch++ ) {

        snprintf(str, STR_LEN, "%6d ", ADC_GetResult16(ch)) ;

        print(str) ;

    }

    print("\n") ;

}

 

int main(void)

{

    init_hardware() ;

    splash() ;

    for(;;)

    {

        measure() ;   

        CyDelay(2000) ;

    }

}

===================

Then I tried to build the project.

And it was built without error.

009-Project-Build.JPG

So my answer to this question is 32.

Note: As I don't have a hardware for this device, I believe what PSoC Creator yields.

moto

0 Likes
JaVa_4525396
New Contributor II

about the resolution is 32 okay, but i am still confused with this total exact ADC pin can be used at the same time, you said 1 module, what is module here? instead how many ADC pins from this chip i can use at a time with the 12 bit resolution?

0 Likes
MotooTanaka
Esteemed Contributor

Hi,

Since an ADC is relatively expensive component and the targets to be measured are often slow, such as temperature, an ADC component is designed to scan multiple input. But it can not take all the values at exactly same time, at least sample and hold time is required for each input although they are usually less than 10us.

Sometimes there are applications which need to acquire values exactly same time, even us order difference matters,

in such case multiple ADC components are required.

For an example CY8C5888LTI-LP097 has 2 x 12bit SAR ADCs.

On the other hand CY8C5467LTI-LP003 has 1 x 12bit SAR ADC,

so the maximum number of ADC pins are limited by the maximum input channel of one SAR ADC component.

In the PSoC Creator I found that the number is 32.

So in the attached project of mine,

resolution is 12 bit

number of ADC input is 32 pins.

If you can allow micro-seconds order of timing difference between each input, you can use up to 32 input pins.

Could I make it clear?

moto

JaVa_4525396
New Contributor II

hello,

in PSoC creator 4.2 , the ADC blocks shows 2 different variants, 1) SAR ADC (v3.10) , 2] Sequencing SAR ADC(v2.10) , for the 12 bit operation and 4-ADC channels (obviously switching type as you stated above answer) which variant of ADC i am supposed to use? 

0 Likes
MotooTanaka
Esteemed Contributor

Dear JaVa-san,

Since this sounds to be a good question it would have been better

if you posted this question as another topic.

But anyway,

First of all please note that we can access the datasheet of a component from the Component Catalog or the configuration dialog.

002-Open_datasheet.JPG

Following are the first page of datasheets of both type of ADCs.

ADC_SAR

001-ADC_SAR.JPG

ADC_SAR_Seq

000-ADC_SAR_Seq.JPG

I entered both kind in to the schematic.

We can configure ADC_SAR_Seq as 1 channel single ended just like ADC_SAR_Seq_2.

003-schematic.JPG

Although I have not fully read through both datasheet,

my understanding is that If you need 2 or more channels use "ADC_SAR_Seq".

Otherwise, when using only 1 channel, I have not found any difference between them.

(I guess the SAR is same in both, but only _Seq has multi channel input scanning function.)

Anyway, I strongly recommend you to read through the datasheet when you need to decide a component to use.

moto

JaVa_4525396
New Contributor II

okay as you stated for multiple channel inputs , i should o for the Seq type SAR adc, but in real schematic how i am supposed to route the signal nets? do i have to give any reference voltage ? as i seen in the modue of Seq SAR ADC i can see the multiple inputs , they seems like differential inputs , how to route them in actual schematic if i dont want the differential and single type ADC. (12 bit resolution , 4-ADC pins).

0 Likes
MotooTanaka
Esteemed Contributor

Lol, I'm just translating the exact chapter of "AN88619 - PSoC 4 Hardware Design Considerations" 😉

You can download above document in English or Chinese from

https://www.cypress.com/documentation/application-notes/an88619-psoc-4-hardware-design-consideration...

Would you read the Chapter 10.1 SAR ADC ?

For the single-end type, when you double click the SAR ADC you will see below.

Note: Input range  has "(Differential)"

000-default.JPG

Select Input rage with a selection which has (Single Ended)

Note: I also changed channels to 1, but you don't have to change it.

004-1ch-single.JPG

moto

JaVa_4525396
New Contributor II

thanks for this information MOTO,

but my PSOC creator is not showing me the pins i have to select in the pin select menu, as you stated that 32 pins for adc i can use, but in the PSoC creator , i am not able to select the pins , i have placed the ADC SAR Seq block and changed my setting to the single ended, still the pins are not able to set on the pin selector tool.

thanks for the help and support.

JaVa.

0 Likes
MotooTanaka
Esteemed Contributor

Dear JaVa-san,

Have you attached analog pin(s) to the input terminal of your ADC component?

And also you may need to save the schematic before it will be reflected in the Pins.

Best Regards,

4-Dec-2019

Motoo Tanaka

JaVa_4525396
New Contributor II

Yes now it shows the Analog pins in the Pin selector tool, thanks a lot for this information.

my VDDD and VDDA will be 5V, i need adc pins to read the voltage 0-5v range, in PSoC creator it shows different ranges like 0-1v and 0-2v , which option do i need to select if i want to read adc voltages in the range of 0-5V? please help.

0 Likes
MotooTanaka
Esteemed Contributor

Workspace Explorer > Design Wide Resource > System

There are voltage selection(s) for VDDA etc.

000-DWR-System.JPG

moto

0 Likes
JaVa_4525396
New Contributor II

No , you are not getting my question, i am asking about how to set my ADC read pin range to 0-5V? (0V to 5V) ? in properties of ADC SAR Seq module in PsoC Creator, there i have multiple options for the ADC input range, now my question is which i do have to select if i want my ADC single ended and the 0v to 5v input supply range to read adc.

0 Likes
MotooTanaka
Esteemed Contributor

Hi,

> No , you are not getting my question,

> i am asking about how to set my ADC read pin range to 0-5V? (0V to 5V) ?

I hope I did.

To test, I uses CY8CKIT-059.

I connected an external POT to VDD (5V) , GND, and AN0.

The schematic

001-schematic.JPG

ADC Configuration

002-ADC_Settings.JPG

DWR > System

003-System.JPG

main.c

====================

#include "project.h"

#include "stdio.h"

#define STR_LEN 64

char str[STR_LEN+1] ;

void print(char *str)

{

    UART_PutString(str) ;

}

void init_hardware(void)

{

    CyGlobalIntEnable; /* Enable global interrupts. */

  

    UART_Start() ;

  

    ADC_Start() ;

}

void cls(void)

{

    print("\033c") ; /* reset */

    CyDelay(20) ;

    print("\033[2J") ; /* clear screen */

    CyDelay(20) ;

}

void splash(void)

{

    cls() ;

    print("CY8CKIT-059 ADC TEST ") ;

    snprintf(str, STR_LEN, "(%s %s)\n", __DATE__, __TIME__) ;

    print(str) ;

}

  

int main(void)

{

    uint16_t adc_count ;

    int16_t mV ;

  

    init_hardware() ;

  

    splash() ;

    for(;;) {

      

        ADC_StartConvert() ;

        ADC_IsEndConversion(ADC_WAIT_FOR_RESULT) ;

        adc_count = ADC_GetResult16(0) ;

        mV = ADC_CountsTo_mVolts(adc_count) ;

      

        if (mV < 0) {

            mV = -mV ;

            print("-") ;

        }

        snprintf(str, STR_LEN,  "%d.%03d V (0x%04X) \n", mV/1000, mV%1000, adc_count) ;

        print(str) ;

      

        CyDelay(1000) ;

    }

}

====================

Tear Term log

Note: The converted mV was 0V ~ 4.987V (almost 5V)

000-TeraTerm-log.JPG

moto

P.S. Please, PLEase PLEASE, post a new topic for more question(s) if you have.

Although I appreciate your marking my response as "Helpful",

only the first one per a topic will be counted as point (;_;)