File tree Expand file tree Collapse file tree 4 files changed +18
-0
lines changed Expand file tree Collapse file tree 4 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -295,6 +295,8 @@ extern "C" {
295295}
296296
297297__attribute__ ((weak)) void configure_usb_mux() {}
298+ /* specific variant USB initialization should define this functiona in variant.cpp */
299+ __attribute__ ((weak)) void usb_post_initialization() {}
298300
299301void __USBStart () {
300302 USBIrqCfg_t usb_irq_cfg;
@@ -361,6 +363,8 @@ void __USBStart() {
361363 /* init device port*/
362364 tud_init (BOARD_TUD_RHPORT);
363365
366+ usb_post_initialization ();
367+
364368#ifdef VUSB_LDO_ENABLE
365369 ((R_USB_FS0_Type*)R_USB_FS0_BASE)->USBMC_b .VDCEN = 1 ;
366370#endif
Original file line number Diff line number Diff line change @@ -75,6 +75,11 @@ int32_t getPinIndex(bsp_io_port_pin_t p) {
7575
7676#include " FspTimer.h"
7777
78+ void usb_post_initialization () {
79+ ((R_USB_FS0_Type*)R_USB_FS0_BASE)->USBMC_b .VDCEN = 1 ;
80+ }
81+
82+
7883void initVariant () {
7984 // bootloader configures LED_BUILTIN as PWM output, deconfigure it to avoid spurious signals
8085 pinMode (LED_BUILTIN, OUTPUT);
Original file line number Diff line number Diff line change @@ -80,6 +80,11 @@ static const ioport_cfg_t bsp_pin_cfg = {
8080};
8181static ioport_instance_ctrl_t ioport_ctrl;
8282
83+ void usb_post_initialization () {
84+ ((R_USB_FS0_Type*)R_USB_FS0_BASE)->USBMC_b .VDCEN = 1 ;
85+ ((R_USB_FS0_Type*)R_USB_FS0_BASE)->SYSCFG_b .DPRPU = 1 ;
86+ }
87+
8388void initVariant () {
8489 // R_IOPORT_Open(&ioport_ctrl, &bsp_pin_cfg);
8590 // R_IOPORT_PinCfg(NULL, BSP_IO_PORT_09_PIN_14, (uint32_t) (IOPORT_CFG_PERIPHERAL_PIN | IOPORT_PERIPHERAL_USB_FS));
Original file line number Diff line number Diff line change @@ -104,6 +104,10 @@ void configure_usb_mux() {
104104
105105__attribute__ ((weak)) void __maybe_start_usb() {}
106106
107+ void usb_post_initialization () {
108+ ((R_USB_FS0_Type*)R_USB_FS0_BASE)->USBMC_b .VDCEN = 1 ;
109+ }
110+
107111void initVariant () {
108112 __maybe_start_usb ();
109113 // bootloader configures LED_BUILTIN as PWM output, deconfigure it to avoid spurious signals
You can’t perform that action at this time.
0 commit comments