STM32duino-bootloader icon indicating copy to clipboard operation
STM32duino-bootloader copied to clipboard

STM32 Core 1.8.0 not compatiple with STMDuino-maple_mini_boot20.bin: USB-device enumeration fails after reset.

Open juergs opened this issue 5 years ago • 1 comments

The Error is in conjunction with "STM32 Core 1.8.0" by loosing serials after reset. But with Rogers Core USB is definitely functional after applying Reset. Also with older Leaflaps bootloader.

The error happens with STMDuino-maple_mini_boot20.bin: leaving the bootloader, USB is not switched off. Therefore no new CDC device- enumeration takes place. Consequence: cdc-serial ist lost after reset (WIN10 & Linux)

First option: patch bootloader:

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);
}

Second option: quit USB-connection in Arduino-setup-method:

uint8_t led = 0;
//#define USBD_ENUM_DELAY 200

void setup() {

   pinMode(D34, OUTPUT);
   digitalWrite(D34,1);
   delay(100);
   digitalWrite(D34, 0);
 
   pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  led = ~ led & 1;
  digitalWrite(LED_BUILTIN, led);
  delay(2000);
}

Image of Arduino-Settings

Arduino IDE: core 1.8.0: https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json

Thanks for Telekatz & Ralf9 for providing this solution.

regards, Juergen

juergs avatar Apr 18 '20 08:04 juergs

see also here https://www.stm32duino.com/viewtopic.php?p=2168#p2168

Ralf9 avatar Apr 19 '20 07:04 Ralf9