[STM32F0] add support of autotrimming HSI to USB SOF frames
Signed-off-by: Frantisek Burian <BuFran@seznam.cz>
This commit is contained in:
committed by
Frantisek Burian
parent
3974e5f48d
commit
331acce4fc
@@ -29,4 +29,19 @@
|
||||
*/
|
||||
|
||||
#include <libopencm3/stm32/crs.h>
|
||||
#include <libopencm3/stm32/rcc.h>
|
||||
|
||||
/**
|
||||
* This function enables autonatic trimming of internal RC oscillator by USB SOF
|
||||
* frames
|
||||
*/
|
||||
void crs_autotrim_usb_enable(void)
|
||||
{
|
||||
rcc_periph_clock_enable(RCC_CRS);
|
||||
|
||||
CRS_CFGR &= ~CRS_CFGR_SYNCSRC;
|
||||
CRS_CFGR |= CRS_CFGR_SYNCSRC_USB_SOF;
|
||||
|
||||
CRS_CR |= CRS_CR_AUTOTRIMEN;
|
||||
CRS_CR |= CRS_CR_CEN;
|
||||
}
|
||||
Reference in New Issue
Block a user