cancel
Showing results for 
Search instead for 
Did you mean: 

USB EZ-PD Type-C

Contributor II

on main board   DEBUG CONNECTOR  (  J8 )  P1.0   is   Pin 1: GPIO_1Unused GPIO. Tri-stated. Available for user customization

Potentiometer

CY4532 EVK

VCC

TP2/TP4

VCC

GND

TP16

GND

OUTPUT

P1.0

OUTPUT

in Cypress EZ-PD™ CCGx Power SDK User Guide.pdf  Table 4: PSOC Creator Components  :

Anaalog .PNG

in other hand  says in the same document

ADC API Usage.PNG

in datasheet of CYPD3171

in PSoC  creator example project CCG3PA Power Adapter with Direct Feedback Control  no ADC sigma

Q:  how  how  use ADC  unit in order read potentiometer  values i dont see  any ADC deltasegma or SAR  component ? how to use AMUX if specificly forbiden in this application see above ?

0 Likes
Reply
1 Solution
Moderator
Moderator

Hello,

Can you please try out the following things:

1). Use pd_adc_calibrate API before sampling the values.

2). Use the potentiometer measurement function in app_task() or main() instead of calling it in the led_timer_callback()

3) Try using AMUXB instead of AMUXA since it might be already in use for VBUS measurement.

Regards,

Mallika

Mallika

View solution in original post

0 Likes
Reply
12 Replies
Moderator
Moderator

Hello,

The ADC component is not available in the PSoC Creator.

Both ADC and AMUX are handled by the stack level functions.

You can use the below function for accessing ADC:

uint8_t   pd_adc_sample ( uint8_t port, PD_ADC_ID_T adc_id, PD_ADC_INPUT_T input )

This function will handle both AMUX and ADC at the lower level. The argument adc_id selects one of the 2 ADC's.

CCG3PA has 2 ADCs: ADC_0 and ADC_1. ADC_O is used for VBUS measurement and ADC_1 is available for customization. Please make sure to use the correct ADC for your design.

Best Regards,

Mallika

Mallika
0 Likes
Reply
Contributor II

OK ,  so could use uint8_t   pd_adc_sample ( uint8_t port, PD_ADC_ID_T adc_id, PD_ADC_INPUT_T input )

Q:  port  param in pd_adc_sample what is the meaning or purpose ?

0 Likes
Reply
Moderator
Moderator

Hello,

The port argument in pd_adc_sample is simply for determining the port in case of dual ports.

However, since CCG3PA is a single port device, you can set it's value to 0.

Regards,

Mallika

Mallika
0 Likes
Reply
Contributor II

HW connection

Potentiometer

CY4532 EVK

VCC

TP2/TP4

VCC

GND

TP16

GND

OUTPUT

   j8 debuger connctor -> P2.1

OUTPUT

see link of Potentiometer  https://www.waveshare.com/wiki/Analog_Test_Board

in adc_measurment.txt you see implement  Potentiometer_Measurement_init, Potentiometer_Measurement_Print_Value

Potentiometer_Measurement_init()  in main.c

Potentiometer_Measurement_Print_Value(0)  calling  in

void led_timer_cb (uint8_t port,timer_id_t id)  the  led is blinking properly  each 100 ms

{

    (void)port;

    (void)id;

    adc_system_measurment_t res;

    res=Potentiometer_Measurement_Print_Value(0);

    USER_LED_Write(!USER_LED_Read());

    timer_start (0, LED_TIMER_ID, LED_TIMER_PERIOD, led_timer_cb);

}

but  the measurement  is not stable  and not accurate  see UART  teraterm log  attached

Q:  what  is accuracy  of ADC 8 bit  10 bit  or 12 bit  ?

Q:  why need convert to gpio  in the end of calculation  hsiom_set_config (GPIO_PORT2_PIN0, HSIOM_MODE_GPIO);

0 Likes
Reply
Moderator
Moderator

Hello,

Q:  what  is accuracy  of ADC 8 bit  10 bit  or 12 bit  ?

>> On the chip, 8 bit SAR ADC is available.

For more information please go through Table 39 (Page 28) in the CCG3PA datasheet https://www.cypress.com/file/363381/download.

Q:  why need convert to gpio  in the end of calculation  hsiom_set_config (GPIO_PORT2_PIN0, HSIOM_MODE_GPIO)

>> It is necessary to free the AMUX (it should not be in use)  so that the AMUX can then be accessed by the other gpios as well as to release the gpio from muxing and use it for other purposes.

This is done by changing the the HSIOM for that IO to HSIOM_MODE_GPIO.

Regards,

Mallika

Mallika
0 Likes
Reply
Contributor II

in my application i need measurement simultaneously  3  GPIO which each of them is  representing  voltage and current measurement  in period 100 ms  

any advice ?   how  to approach  this issue  ?

0 Likes
Reply
Moderator
Moderator

Hello,

Can you please further elaborate on your design and the functionalities you want to use so that we can better understand the issue and help you.

Regards,

Mallika

Mallika
0 Likes
Reply
Contributor II

in my design of CYPD3175   i have  tree  GPIO  

p1.0 ->  Current Measurment

p1.1 ->  Current Refernce

p2.2 -> Channel Address   (  connected  to  resistor )

all this pin   i need  measurement  ADC   and  get   ADC digital level  and Voltage 

all this data  i need  for control  in my application   simultaneously  and  continuously   

i tried  connect  Potentiometer  to one  of the legs  t  want recieve digital level  and voltage  of  the  Potentiometer     is 1k  so if ADC is 8 bit so  in full range  i need get 256  units   but  i get random numbers  when  print to UART Volatge values  and digital level    ( attched  uart log in teraterm )

0 Likes
Reply
Moderator
Moderator

Hello,

1. Are you working on only the main board (you have removed the power board) or is the power board there?

2. Can you please share your PSoC project?

Regards,

Mallika

Mallika
0 Likes
Reply
Contributor II

i work  only  with main board

0 Likes
Reply
Moderator
Moderator

Hello,

Can you please try out the following things:

1). Use pd_adc_calibrate API before sampling the values.

2). Use the potentiometer measurement function in app_task() or main() instead of calling it in the led_timer_callback()

3) Try using AMUXB instead of AMUXA since it might be already in use for VBUS measurement.

Regards,

Mallika

Mallika

View solution in original post

0 Likes
Reply
Contributor II

?what is  max voltage  to ADC 256 bit ( 8 bit adc )  ?

0 Likes
Reply