Skip to main content
Associate III
July 3, 2024
Solved

How to modify the over current protection threshold in code?

  • July 3, 2024
  • 1 reply
  • 1332 views

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

 

 

    Best answer by cedric H

    Hi @gtop.1 ,

    As stated by @unknown , please read the doc :grinning_face:.

    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

    1 reply

    July 3, 2024

    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.

    cedric H
    cedric HBest answer
    Technical Moderator
    July 3, 2024

    Hi @gtop.1 ,

    As stated by @unknown , please read the doc :grinning_face:.

    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

    gtop.1Author
    Associate III
    July 3, 2024

    gtop1_0-1720002708607.png

    I found it, thanks.