cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC™ 5, 3 & 1

Erka_3237036
New Contributor II

Hello all,

i have facing one problem.

a problem is my one gpio pin is turning off and same time my second gpio is turning on but both have some time difference i.e.

Gpio1 is taking the 1.4 Micro Second to turn off

and Gpio2 is Taking the 800 Nano Second. to turn on

i don't know why it is Happening ?

anybody can suggest why it is happening and how can i solve this problem.

i am using LP-035  controller.

Best Regards,

Seggi

0 Likes
1 Solution
odissey1
Honored Contributor II

Seggi,

If code is the same, the time should be same. There is some difference in the code. Please post your project here: (1) Build->Clean, (2) File->Create Workspace Bundle->Minimal. (3) In created Archive you may delete a folder Generated_source to reduce the size.

Generally, Pin_Write(1) API is rather slow and takes almost a microsecond, but there are faster ways to accomplish that. Please check this video:

C++ vs Assembly vs Verilog. on Vimeo

On PSoC5 the following code should set Pin_1 to 1/0 in a single BUS_CLOCK (Compiler optimization = speed, release mode)

for(;;)

    {

        Pin_1_DR = 1 << Pin_1_SHIFT; // shif=1u

        Pin_1_DR = 0 << Pin_1_SHIFT;

    }

/odissey1

View solution in original post

0 Likes
16 Replies
NoriakiT_91
Employee

Which API or hardware are you using to turn on and off the GPIOs?

Regards,

Noriaki

0 Likes
odissey1
Honored Contributor II

Seggi,

If code is the same, the time should be same. There is some difference in the code. Please post your project here: (1) Build->Clean, (2) File->Create Workspace Bundle->Minimal. (3) In created Archive you may delete a folder Generated_source to reduce the size.

Generally, Pin_Write(1) API is rather slow and takes almost a microsecond, but there are faster ways to accomplish that. Please check this video:

C++ vs Assembly vs Verilog. on Vimeo

On PSoC5 the following code should set Pin_1 to 1/0 in a single BUS_CLOCK (Compiler optimization = speed, release mode)

for(;;)

    {

        Pin_1_DR = 1 << Pin_1_SHIFT; // shif=1u

        Pin_1_DR = 0 << Pin_1_SHIFT;

    }

/odissey1

View solution in original post

0 Likes
Erka_3237036
New Contributor II

Hello,

Where is the option of code compiler optimization?

Best Regards,

Seggi.

0 Likes
MotooTanaka
Esteemed Contributor

Dear Seggi-san,

From Workspace Explorer, select the project and right-button,

select "Build Settings..."

001-Menu.JPG

Then in the Build Settings Dialog

ARM GCC .. > Compiler > Optimization > Optimization Level

002-Optimization-level.JPG

Best Regards,

17-Jul-2019

Motoo Tanaka

0 Likes
Erka_3237036
New Contributor II

Hello,

Thank you for giving me advice.

But whenever i am doing the optimization in speed mode my code is not working and i not able to show my output.

Best Regards,

Seggi.

0 Likes
MotooTanaka
Esteemed Contributor

Hi,

LP-035, are you using the CY8CKIT-050?

Anyway, would you check what kind of  load are connected to each pins

and if the pin configurations are the same?

moto

0 Likes
Erka_3237036
New Contributor II

Yes i am using LP-035(CYC8CKIT-050).

i am directly checking onto the pin.

Best Regards,

Seggi.

0 Likes
MotooTanaka
Esteemed Contributor

Dear Seggi-san,

Thank you very much for your answer.

Could you let me know the pins you are using?

Best Regards,

17-Jul-2019

Motoo Tanaka

P.S.

You can download CY8CKIT-050 related documents from the URL below.

https://www.cypress.com/documentation/development-kitsboards/cy8ckit-050-psoc-5lp-development-kit

I think that CY8CKIT-050 Board Design Files contains the schematic.

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

Please check if the pins you are using are connected to a capacitor and/or resistor on the board.

I'm suspecting that the slower pin is connected to a capacitor.

0 Likes
Erka_3237036
New Contributor II

Hello,

Right Now i am using the chip of LP-035.

and making the board for the controller there is don't have the capacitor and resistor on the pin.

Best Regards,

Seggi.

0 Likes
MotooTanaka
Esteemed Contributor

Dear Seggi-san,

Just to confirm, are both pins configured similarly?

For example,

Configure "Pins" Drive mode

003-Pin-Config-1.JPG

and

Configure "Output" > Slew rate and current

004-Pin-Config-2.JPG

Best Regards,

17-Jul-2019

Motoo Tanaka

0 Likes
Erka_3237036
New Contributor II

Hello,

Yes,both pins are configured similarly.

my both pins are pulled down configuration.

Best Regards,

seggi.

0 Likes
MotooTanaka
Esteemed Contributor

Dear Seggi-san,

I think that pull-down setting affect the ramp of rise and fall will be different.

If you can, could you just test with "Strong Drive" mode and/or both pull-up and pull-down?

Best Regards,

17-Jul-2019

Motoo Tanaka

0 Likes
Erka_3237036
New Contributor II

Hello,

as per your suggesting method problem is not solved yet.

Thanks By the way.

i'll appreciate to the all of the thoughts for me.

Best Regards,

Seggi.

0 Likes
NoriakiT_91
Employee

Please let me confirm your problem.

1. You said two GPIO pins have different behavior as output.

Which pins are you using?

2. You said the turn on and off time of these two pins are different.

How did you measure the turn on and off time?

What is the definition of turn on and off time?

Is it a response time to turn on and off since API is called?

Or is it a rising and falling time of the output signal?

3. PSoC have so many method to turn on and off the GPIO.

How did you turn on and off a GPIO?

Did you use any API function of the GPIO port?

Did you use any function peripheral connected to the GPIO?

If possible please attach a oscilloscope waveform of these two pins.

Regards,

Noriaki

0 Likes
Erka_3237036
New Contributor II

Hello,

1) i am using the port4 pin of P4.6 and P4.7.

2) i am measuring these response on the oscilloscope.

3) turn on and off time i.e. we can say that the rise time and fall time.

turn on time : generally my pin are connected to the ground and whenever i am wrote up the instruction they give me some preferred voltage level.

turn off time: i.e.whenever my goes to the high and i am apply the instruction this signal goes to the low or ground.

4) and one more thing is to be  i know the many techniques but whenever i write into the data register that time i show my output is fast but they are giving me the worst output signal i.e. they given me glitches and noise etc these behavior is also not allowable.

Best Regards,

Seggi.

0 Likes
odissey1
Honored Contributor II

Seggi,

Lets make sure that the pin is not blown. Please measure output voltages on both pins on startup ( make sure there are no any commands sent to the pins - an empty project would be the best).

/odissey1

0 Likes