Re: SerialUSB doesn't work on Maple Mini
Posted: Mon Apr 13, 2020 10:58 am
In your log, after the reset it switches to bootloader.
Everything relating to using STM32 boards with the Arduino IDE and alternatives
https://www.stm32duino.com/
With the bootloader2.0 the testsketch is after the reset running (the LED is blinking), only the USB will not be initialisedIn your log, after the reset it switches to bootloader.
Code: Select all
void jumpToUser(u32 usrAddr) {
/* tear down all the dfu related setup */
// disable usb interrupts, clear them, turn off usb, set the disc pin
// todo pick exactly what we want to do here, now its just a conservative
flashLock();
usbDsbISR();
nvicDisableInterrupts();
#ifndef HAS_MAPLE_HARDWARE
usbDsbBus();
#else
gpio_write_bit(USB_DISC_BANK,USB_DISC_PIN,1);
#endif
// Does nothing, as PC12 is not connected on teh Maple mini according to the schemmatic setPin(GPIOC, 12); // disconnect usb from host. todo, macroize pin
systemReset(); // resets clocks and periphs, not core regs
setMspAndJump(usrAddr);
}
Code: Select all
void setup() {
pinMode(D34, OUTPUT);
digitalWrite(D34,1);
delay(100);
digitalWrite(D34, 0);
Code: Select all
void setup() {
pinMode(D34, OUTPUT);
digitalWrite(D34,1);
delay(100);
digitalWrite(D34, 0);
This piece of code is for different coreRalf9 wrote: Sun Apr 19, 2020 6:43 am Have you for me until the core 1.9.0 a better workaround than add this to my sketch?Can I fix it directly in the cores/arduino/stm32/usb/usbd_if.c ?Code: Select all
void setup() { pinMode(D34, OUTPUT); digitalWrite(D34,1); delay(100); digitalWrite(D34, 0);
Code: Select all
#include "usbd_if.h"
#include "usbd_cdc_if.h"
#if ARDUINO < 10900
void USBD_reenumerate(void)
{
#ifndef USBD_REENUM_DISABLED
/* Re-enumerate the USB */
#ifdef USB_DISC_PIN
pinMode(USB_DISC_PIN, OUTPUT);
digitalWrite(USB_DISC_PIN, HIGH);
delay(10);
digitalWrite(USB_DISC_PIN, LOW);
#else
#ifdef USE_USB_HS_IN_FS
PinName pinDP = USB_OTG_HS_DP;
#elif defined(USB_OTG_FS)
PinName pinDP = USB_OTG_FS_DP;
#else /* USB */
PinName pinDP = USB_DP;
#endif
pin_function(pinDP, STM_PIN_DATA(STM_MODE_OUTPUT_PP, GPIO_NOPULL, 0));
digitalWriteFast(pinDP, LOW);
delay(USBD_ENUM_DELAY);
pin_function(pinDP, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, 0));
/*delay(USBD_ENUM_DELAY);*/
#endif /* USB_DISC_PIN */
#endif /* USBD_REENUM_DISABLED */
}
#endif
Code: Select all
#ifdef USB_DISC_PIN
pinMode(USB_DISC_PIN, OUTPUT);
digitalWrite(USB_DISC_PIN, LOW);
#else
Code: Select all
#ifdef USB_DISC_PIN
pinMode(USB_DISC_PIN, OUTPUT);
digitalWrite(USB_DISC_PIN, HIGH);
delay(10);
digitalWrite(USB_DISC_PIN, LOW);
#else