CYBLE GPIO pin startup state when connected to a PWM

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

cross mob
lock attach
Attachments are accessible only for community members.
EsFr_4600111
Level 3
Level 3
25 sign-ins 10 replies posted 10 questions asked

Hi 

I have a simple project with a pwm timer driving direct a GPIO out pin.

I have a motor driver on this pin. 

My problem is when the chip power up the pin state is low, which means that the motor driver is at max speed. The max out put is there until i initilze the PWM timer. 

How can i set the pins so they allways start up in tristate until at initialize them ? 

Project added

0 Likes
1 Solution
MikeAustin
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

If you have a look in the generated source code for your pin that you have connected to the output of your PWM (e.g.  If the pin is called PWM_Pin then have a look at PWM_Pin.h)

There will be a bunch of #define statements in there of the format:

#define PWM_Pin_DM_ALG_HIZ (0x00u) /**< \brief High Impedance Analog */
#define PWM_Pin_DM_DIG_HIZ (0x01u) /**< \brief High Impedance Digital */
#define PWM_Pin_DM_RES_UP (0x02u) /**< \brief Resistive Pull Up */
#define PWM_Pin_DM_RES_DWN (0x03u) /**< \brief Resistive Pull Down */
#define PWM_Pin_DM_OD_LO (0x04u) /**< \brief Open Drain, Drives Low */
#define PWM_Pin_DM_OD_HI (0x05u) /**< \brief Open Drain, Drives High */
#define PWM_Pin_DM_STRONG (0x06u) /**< \brief Strong Drive */
#define PWM_Pin_DM_RES_UPDWN

You can use the API PWM_Pin_SetDriveMode(uint8 mode) using one of the above #define for mode to set the drive mode of your PWM output pin to whatever you need.

You can set the drive mode and initial drive state for that pin in the Pin Component, which is what it will default to when your code starts up, and then you can use PWM_Pin_SetDriveMode(uint8 mode) to change it to whatever you need once you've initialised your PWM

Cheers,

Mike

View solution in original post

0 Likes
8 Replies
Aashita_R
Moderator
Moderator
Moderator
50 likes received 100 solutions authored 250 replies posted

Hi @EsFr_4600111 ,

I regret to convey that your issue is not very clear to me.  Can you please attach your project here? This will help us understand the problem properly and get back with a solution. 

Best Regards,

Aashita

 

0 Likes
lock attach
Attachments are accessible only for community members.

The output is after reset set, to low until I call the pwm_Vibrator_Start();

I want it to be in tristate mode until i call pwm_Vibrator_Start

0 Likes

Hi Aashita

can you help me solve this issue?

 

Br

Esben

0 Likes
RodolfoGL
Employee
Employee
250 solutions authored 250 sign-ins 5 comments on KBA

Esben, when the PSoC resets, the pins stays in a HighZ state till it gets initialized. Ideally you want to pull up the pin externally to avoid this.

0 Likes
EsFr_4600111
Level 3
Level 3
25 sign-ins 10 replies posted 10 questions asked

Yes when its in reset mode the PIN is in  HighZ state, but as soon I release the reset its pulling the pin down until i call  pwm_Start(); 

The problem is only when i have it connected on a PWM timer. 

0 Likes
RodolfoGL
Employee
Employee
250 solutions authored 250 sign-ins 5 comments on KBA

Oh, I see the problem. During the initialization, that pin is configured to be Open-Drain Drives Low, which happens in the pre-main code. The output is driven LOW because the hardware is not configured yet.

What you can do is to configure the pin in the TopDesign to be High Digital Z and only set the drive mode to Open-Drain Drives Low after initializing the PWM.

0 Likes
MikeAustin
Level 4
Level 4
25 replies posted 25 sign-ins 10 replies posted

If you have a look in the generated source code for your pin that you have connected to the output of your PWM (e.g.  If the pin is called PWM_Pin then have a look at PWM_Pin.h)

There will be a bunch of #define statements in there of the format:

#define PWM_Pin_DM_ALG_HIZ (0x00u) /**< \brief High Impedance Analog */
#define PWM_Pin_DM_DIG_HIZ (0x01u) /**< \brief High Impedance Digital */
#define PWM_Pin_DM_RES_UP (0x02u) /**< \brief Resistive Pull Up */
#define PWM_Pin_DM_RES_DWN (0x03u) /**< \brief Resistive Pull Down */
#define PWM_Pin_DM_OD_LO (0x04u) /**< \brief Open Drain, Drives Low */
#define PWM_Pin_DM_OD_HI (0x05u) /**< \brief Open Drain, Drives High */
#define PWM_Pin_DM_STRONG (0x06u) /**< \brief Strong Drive */
#define PWM_Pin_DM_RES_UPDWN

You can use the API PWM_Pin_SetDriveMode(uint8 mode) using one of the above #define for mode to set the drive mode of your PWM output pin to whatever you need.

You can set the drive mode and initial drive state for that pin in the Pin Component, which is what it will default to when your code starts up, and then you can use PWM_Pin_SetDriveMode(uint8 mode) to change it to whatever you need once you've initialised your PWM

Cheers,

Mike

0 Likes

Hi Mike 

Very nice

Thank you very much, this solves my start up problem.

 

Br

Esben

0 Likes