cancel
Showing results for 
Search instead for 
Did you mean: 

On code generated for STSPIN32f0A, why is PA12 set to an output?

DSand.2
Associate II

Hi,

I don't understand the code below -- why is PA12 set to an output?

I've included an image from the documentation that shows that PA12 receives the output from the comparator. Isn't it problematic if the comparator is driving it at the same time the pin is set low?

#define _3FG_HIZ_Pin LL_GPIO_PIN_12
#define _3FG_HIZ_GPIO_Port GPIOA
 
LL_GPIO_ResetOutputPin(_3FG_HIZ_GPIO_Port, _3FG_HIZ_Pin);
 
GPIO_InitStruct.Pin = _3FG_HIZ_Pin;
GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
GPIO_InitStruct.Pull = LL_GPIO_PULL_DOWN;
LL_GPIO_Init(_3FG_HIZ_GPIO_Port, &GPIO_InitStruct);

0693W000006H5QHQA0.png 

Thanks!

-Dan

4 REPLIES 4
Laurent Ca...
Lead II

Dear @DSand.2​ 

Sorry for the late answer.

Do you have still this problem to solve?

And just in case, if not, do not hesitate to share the final solution you found. Thanks by advance.

Best regards

Laurent Ca...

DSand.2
Associate II

Yes, still curious why the code makes something an output that I would think should be an input.

cedric H
ST Employee

Dear @DSand.2​ ,

Could you describe your working flow ?

I generated a project from the inverter board STEVAL-SPIN3202 which is based on STSPIN32F0A.

the pin GPIO-A12 is defined as follows :

in main.h :

#define OC_COMP_INT2_Pin GPIO_PIN_12

#define OC_COMP_INT2_GPIO_Port GPIOA

in main.c:

 /*Configure GPIO pin : OC_COMP_INT2_Pin */

 GPIO_InitStruct.Pin = OC_COMP_INT2_Pin;

 GPIO_InitStruct.Mode = GPIO_MODE_INPUT;

 GPIO_InitStruct.Pull = GPIO_PULLDOWN;

 HAL_GPIO_Init(OC_COMP_INT2_GPIO_Port, &GPIO_InitStruct);

Could you attach your stmcx file ?

Regards

Cedric

Hi Cedric, thanks for the quick answer.

I generated the code a long time ago, perhaps the generator has changed or the code was generated for an F0 instead of an F0A. Thanks for checking on that.

Any idea why the pull-down is setup in the generated code rather than there being no pulldown? I noticed that a lot of the generated code sets pull-downs, even when the pin is configured to be an output.

Thanks,

-Dan