cancel
Showing results for 
Search instead for 
Did you mean: 

HOW to output Vrefint to PB0 or PB1 from stm32l100

slu.7
Associate II

I wanted to output Vrefint to PB1 from stm32l100 in one of my project. I followed the procedure in RM0038 Reference manual Page 201

  1. Set the VREFOUTEN bit in COMP_CSR.
  2. Close the analog switch of I/Os in group 3 by setting CH8 or CH9 in RIASCR1.

So I did the configuration in my applicaiton as following

void VrefOutEnable(void)

{

GPIO_InitTypeDef GPIO_InitStruct;

__HAL_RCC_GPIOB_CLK_ENABLE();

 GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1;

 GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;

 GPIO_InitStruct.Pull = GPIO_NOPULL;

 HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

 __HAL_RCC_COMP_CLK_ENABLE();

 __HAL_SYSCFG_VREFINT_OUT_ENABLE();

//  __HAL_RI_SWITCHCONTROLMODE_ENABLE();

//  __HAL_RI_SWITCHCONTROLMODE_DISABLE();

 __HAL_RI_IOSWITCH_CLOSE(RI_ASCR1_CH_8|RI_ASCR1_CH_9);

}

But I couldn't get the result .

1 REPLY 1
slu.7
Associate II

__HAL_RI_IOSWITCH_CLOSE(RI_IOSWITCH_CH9);