cancel
Showing results for 
Search instead for 
Did you mean: 

How to modify the over current protection threshold in code?

gtop.1
Associate III

MCSDK: 6.3.0

Algorithm: FOC
Type:INVERTER
Inverter:STEVAL-SPIN3202
Mcu:STSPIN32F0A

I turned on the overcurrent protection function.

微信截图_20240703102403.png

I want to modify the threshold in my code project, but I can't find the corresponding code.I want to know where his corresponding code location is.

微信截图_20240703113051.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @gtop.1 ,

As stated by @AlexH98 , please read the doc 😀.

STSPIN32F0 threshold is configured with 2 GPIOs pins. OCTH_STBY1 and OCTH_STBY2, if you open your IOC you will see them:

cedricH_0-1720001019900.png

The configuration of those pins is done in the main.c 

static void MX_GPIO_Init(void)

...

/**/
GPIO_InitStruct.Pin = OCTH_STBY2_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(OCTH_STBY2_GPIO_Port, &GPIO_InitStruct);

/**/
GPIO_InitStruct.Pin = OCTH_STBY1_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(OCTH_STBY1_GPIO_Port, &GPIO_InitStruct);

Regards

Cedric

View solution in original post

3 REPLIES 3
AlexH98
Associate II

Hey @gtop.1 

the overcurrent protection is done through the hardware, have a look at the part related to this feature in the hardware schematic

refer to the reference manual for the hardware to get the idea.

Also you should know about how the timer brake pin works

regards.

Hi @gtop.1 ,

As stated by @AlexH98 , please read the doc 😀.

STSPIN32F0 threshold is configured with 2 GPIOs pins. OCTH_STBY1 and OCTH_STBY2, if you open your IOC you will see them:

cedricH_0-1720001019900.png

The configuration of those pins is done in the main.c 

static void MX_GPIO_Init(void)

...

/**/
GPIO_InitStruct.Pin = OCTH_STBY2_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(OCTH_STBY2_GPIO_Port, &GPIO_InitStruct);

/**/
GPIO_InitStruct.Pin = OCTH_STBY1_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(OCTH_STBY1_GPIO_Port, &GPIO_InitStruct);

Regards

Cedric

gtop1_0-1720002708607.png

I found it, thanks.