Skip to main content
ICohe.1
Associate III
Jun 17, 2020 2:31 PM UTC
Question

PVD code not generated by CubeIDE (but do in CubeMX)

Trying to to use PVD on F401 and CubeIDE but no relevant code is generated.

I found on this forum code generated by CubeMx and it also works for me. Just copy and paste and corrected some minor differences like PVD_AVD_IRQn should be PVD_IRQn

So my question is: How do I make CubeIDE generating code for activating PVD ?

The only relevant Item I found in CubeIDE is PVD interrupt through EXTI line 16

Here is what CubeMX generated:

The following code was generated by CubeMX in stm32h7xx_hal_msp.c:

void HAL_MspInit(void)
{
 /* USER CODE BEGIN MspInit 0 */
 
 /* USER CODE END MspInit 0 */
 PWR_PVDTypeDef sConfigPVD = {0};
 
 __HAL_RCC_SYSCFG_CLK_ENABLE();
 
 /* System interrupt init*/
 /* PendSV_IRQn interrupt configuration */
 HAL_NVIC_SetPriority(PendSV_IRQn, 15, 0);
 
 /* Peripheral interrupt init */
 /* PVD_AVD_IRQn interrupt configuration */
 HAL_NVIC_SetPriority(PVD_AVD_IRQn, 0, 0);
 HAL_NVIC_EnableIRQ(PVD_AVD_IRQn);
 
 /** PVD Configuration 
 */
 sConfigPVD.PVDLevel = PWR_PVDLEVEL_7;
 sConfigPVD.Mode = PWR_PVD_MODE_IT_RISING;
 HAL_PWR_ConfigPVD(&sConfigPVD);
 /** Enable the PVD Output 
 */
 HAL_PWR_EnablePVD();
 
 /* USER CODE BEGIN MspInit 1 */
 
 /* USER CODE END MspInit 1 */
}

To those which are totally clueless (like me) you have also to create the following function that will be called when PVD is activated:

void HAL_PWR_PVDCallback(void)

This topic has been closed for replies.

2 replies

Nesrine.JLASSI
Visitor II
Oct 26, 2020 9:50 AM UTC

Hello @ICohe.1​ 

Could you please share your ioc file to check with.

Best regards,

Nesrine

ICohe.1
ICohe.1Author
Associate III
Oct 26, 2020 10:37 AM UTC

Attached is my ioc file as it is now. in CubeIDE 1.4.2

It is possible that at the time of my original post, I used another version.

It is 4 month ago and the project is running because I found a solution as I wrote. I haven't tested if the issue was corrected in the current version.

Anyway thanks for getting back to me and I hope others will benefit from it.