SerialUSB doesn't work on Maple Mini and Bootloader2.0
Re: SerialUSB doesn't work on Maple Mini
In your log, after the reset it switches to bootloader.
Re: SerialUSB doesn't work on Maple Mini
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.
Re: SerialUSB doesn't work on Maple Mini and Bootloader2.0
the way it looks is in the bootloader20 a error.
The error on Bootloader 2.0 is that USB is not disconnected when leaving the Bootloader.
This means that there is no renewed enumeration of the CDC device.
one possibility is to patch the bootloader20
https://github.com/rogerclarkmelbourne/ ... are.c#L208
Or you can disconnect the connection short in the setup part from the sketch
see also here
https://github.com/rogerclarkmelbourne/ ... /issues/91
The error on Bootloader 2.0 is that USB is not disconnected when leaving the Bootloader.
This means that there is no renewed enumeration of the CDC device.
one possibility is to patch the bootloader20
https://github.com/rogerclarkmelbourne/ ... are.c#L208
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);
}
Or you can disconnect the connection short in the setup part from the sketch
Code: Select all
void setup() {
pinMode(D34, OUTPUT);
digitalWrite(D34,1);
delay(100);
digitalWrite(D34, 0);
see also here
https://github.com/rogerclarkmelbourne/ ... /issues/91
Re: SerialUSB doesn't work on Maple Mini and Bootloader2.0
It seems stange as the core already handle the reenum:
https://github.com/stm32duino/Arduino_C ... d_if.c#L19
This will change in the 1.9.0 to be more compliant with USB specs
https://github.com/stm32duino/Arduino_C ... b57dc5b4b6
anyway still one issue to fix for hardware which does not follow the spec:
https://github.com/stm32duino/Arduino_C ... ssues/1029
https://github.com/stm32duino/Arduino_C ... d_if.c#L19
This will change in the 1.9.0 to be more compliant with USB specs
https://github.com/stm32duino/Arduino_C ... b57dc5b4b6
anyway still one issue to fix for hardware which does not follow the spec:
https://github.com/stm32duino/Arduino_C ... ssues/1029
Re: SerialUSB doesn't work on Maple Mini and Bootloader2.0
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);
Re: SerialUSB doesn't work on Maple Mini and Bootloader2.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);
Re: SerialUSB doesn't work on Maple Mini and Bootloader2.0
Rafl9
Main issue is why you get issue, sveral other user (including me) does not have this issue.
So, it seems in your case the reenum does not have the expected effect, call too earlier? Delay should be increased?
You can override the core reenum function as it is a weak one or increase the delay as th delay is a definition wchich can be rederfined
Main issue is why you get issue, sveral other user (including me) does not have this issue.
So, it seems in your case the reenum does not have the expected effect, call too earlier? Delay should be increased?
You can override the core reenum function as it is a weak one or increase the delay as th delay is a definition wchich can be rederfined
Re: SerialUSB doesn't work on Maple Mini and Bootloader2.0
I have it tested, when I put this file "USBD_reenumerate.c" in my sketch directory, than it works with the bootloader2.0 also after a reset
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
Re: SerialUSB doesn't work on Maple Mini and Bootloader2.0
Souns really strange....
I have no idea why...seems like the weak function is not called.
I have no idea why...seems like the weak function is not called.
Re: SerialUSB doesn't work on Maple Mini and Bootloader2.0
so that the USBD_reenumerate with the bootloader2.0 works,
the USB_DISC_PIN must be set to high once and then to low again
if I change the usbd_if.c in the core 1.8.0, the USBD_reenumerate works too
I have this as a test
stm32/1.8.0/cores/arduino/stm32/usb/usbd_if.c
changed in
the USB_DISC_PIN must be set to high once and then to low again
if I change the usbd_if.c in the core 1.8.0, the USBD_reenumerate works too
I have this as a test
stm32/1.8.0/cores/arduino/stm32/usb/usbd_if.c
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