AnsweredAssumed Answered

minimum HCLOK for USB OTG FS

Question asked by strauss.bar on Sep 1, 2013
I use today HCLK of 120Mhz taken from the systemclk of 120Mhz (prescale by 1), and active USB OTG FS no problem.
To save power I want to go as much as possible low with the freq, when not during fast operations, and go back to 120Mhz for fast operations.
I read in the manual that the HCLK should be more then 14.2Mhz for USB OTG FS to work.
So I try to go to 15Mhz by prescale the systemclk by 8 (from 120Mhz). I also read that I need to stratch USB response time to IN tokens so I do so and set it to 0x0F.
It is writen like this:
        /* HCLK = SYSCLK / 8*/
    RCC->CFGR &=  ~(RCC_CFGR_HPRE); // clear AHB prescaler
    RCC->CFGR |= RCC_CFGR_HPRE_DIV8; // get Down not lower then 15Mhz for UART BAUD RATE but also for USB FS OTG proper operation
  /* keep PCLK2 stay at same original freq */
    RCC->CFGR &=  ~(RCC_CFGR_PPRE2);
    RCC->CFGR |= RCC_CFGR_PPRE2_DIV1;
  /* keep PCLK1 stay at same original freq */
    RCC->CFGR &=  ~(RCC_CFGR_PPRE1);
    RCC->CFGR |= RCC_CFGR_PPRE1_DIV1;
  
    /* Setup SysTick Timer for 10ms interrupts according new HCLK */
    if (SysTick_Config((SystemCoreClock/8) / 100))
     {
      /* Capture error */
      while (1);
     }

    USB_OTG_dev.regs.GREGS->GUSBCFG &= ~(0xF << 10);
    USB_OTG_dev.regs.GREGS->GUSBCFG |= 0xF <<10;

I also check what is the new freq by operating
RCC_GetClocksFreq(&RCC_ClockFreq);

and see I get HCLK 15Mhz .
and I get the right setting in the USB stratch time.
But after doing so the USB not recognize on the PC.
I try to do the freq adjustment before and after USB init but not help.
When I pick HCLK of 30Mhz it is work O.K.
What could be the reason?
Bar.

Outcomes