AnsweredAssumed Answered

USB HID development - Keil or ST middleware ?

Question asked by palitsky.gennady on Jul 29, 2015
Latest reply on Aug 28, 2015 by GDS. Dang Nguyen
I have started a project where I need to implement USB HID on STM32F427. I have a custom board and a STM32F429I-Discovery board.
  So I would like an advice from somebody with experience - which middleware USB stack  is preferable - Keil or ST ?
I've started with Keil - implemented the HID example for the discovery board. And faced the problem right away:
    When I program the flash for the fist time, the board is enumerated ok and sending reports both ways. Until I cycle power. After that the program is waiting for a soft reset in a USBD_HS_STM32F4xx.c  driver file:

static int32_t USBD_PowerControl (ARM_POWER_STATE state) {
  switch (state) {
    case ARM_POWER_OFF:
    case ARM_POWER_FULL:
      if ((otg_hs_state & OTG_HS_USBD_DRIVER_POWERED) != 0U) { return           ARM_DRIVER_OK; }
      RCC->AHB1ENR  |=  RCC_AHB1ENR_OTGHSEN;            // OTG HS clock enable
      RCC->AHB1RSTR |=  RCC_AHB1RSTR_OTGHRST;           // Reset OTG HS module
      RCC->AHB1RSTR &= ~RCC_AHB1RSTR_OTGHRST;           // Clear reset of OTG HS module
#ifdef MX_USB_OTG_HS_ULPI_D7_Pin
      // External ULPI High-speed PHY
      RCC->AHB1ENR  |=  RCC_AHB1ENR_OTGHSULPIEN;        // OTG HS ULPI clock enable
      // On-chip Full-speed PHY
      OTG->PCGCCTL  &= ~OTG_HS_PCGCCTL_STPPCLK;         // Start PHY clock
      OTG->GCCFG    |=  OTG_HS_GCCFG_PWRDWN;            // Disable power down
      OTG->GUSBCFG  |=  OTG_HS_GUSBCFG_PHSEL  |         // Full-speed transceiver
                        OTG_HS_GUSBCFG_PHYLPCS;         // 48 MHz external clock
      OTG->GRSTCTL  |=  OTG_HS_GRSTCTL_CSRST;           // Core soft reset
      /* never goes beyond this */
      while ((OTG->GRSTCTL & OTG_HS_GRSTCTL_CSRST) != 0U);

And it's strange, since the system viewer shows that the OTG_HS_GRSTCTL_CSRST bit is set.
Now, the reprogramming of the flash doesn't fix the problem
Neither chip erase / reprogramming does. But if I load the demo firmware and then program the HID example, it works again - till the next power cycle. If I comment the soft reset out, everything works fine. Keil tech support is currently trying to figure out what is going on.

Except of the HID the controller is going to have quite a few of other functions - multiple SPIs, I2Cs, UARTs etc. So I am not sure how RTOS used in Keil's USB stack will effect the rest of operation. At the same time Keil seems easier to work with.

Anyway, can somebody please give an opinion on a subject based on experience ?

Thank you,