STMicroelectronics / STM32CubeH7

STM32Cube MCU Full Package for the STM32H7 series - (HAL + LL Drivers, CMSIS Core, CMSIS Device, MW libraries plus a set of Projects running on all boards provided by ST (Nucleo, Evaluation and Discovery Kits))
https://www.st.com/en/embedded-software/stm32cubeh7.html
Other
490 stars 302 forks source link

TinyUSB doesn't work on STM32H743ZI #215

Closed gabrieltetar closed 2 years ago

gabrieltetar commented 2 years ago

Hello,

Board : NUCLEO-H743ZI2 MCU : STM32H743ZI IDE : STM32 eclipse

Issue : USB HID Device does not appear at all on the host computer

Workaround : I added some additional bit set before and after your init

In my usb device task :

void usb_device_task(void* param)
{
  (void) param;

  SET_BIT(USB_OTG_FS->GUSBCFG, USB_OTG_GUSBCFG_FDMOD); // Default mode is host without this line, it stays host mode
  SET_BIT(USB_OTG_FS->GOTGCTL, USB_OTG_GOTGCTL_BVALOEN); // The PC does not detect the device without this 2 lines
  SET_BIT(USB_OTG_FS->GOTGCTL, USB_OTG_GOTGCTL_BVALOVAL);
  tusb_init();
  SET_BIT(USB_OTG_FS->GOTGCTL, USB_OTG_GOTGCTL_SRQ); // Session request (nothing is going to happen without this line)

  while (1)
  {
    tud_task();
  }
}

Also I had to remove this line, it was blocking all of my USB interrupts in tinyusb/src/portable/st/synopsys/dcd_synopsys.c line 513 : //dev->DCFG |= USB_OTG_DCFG_NZLSOHSK;

Here is the bit definition, I don't get why it was set and commenting the line fixed the driver image