SerialUSB doesn't work on Maple Mini and Bootloader2.0

Post here all questions related to STM32 core if you can't find a relevant section!
Ralf9
Posts: 33
Joined: Sat Jan 11, 2020 7:21 pm
Answers: 1
Location: Germany, BaWü

Re: SerialUSB doesn't work on Maple Mini

Post by Ralf9 »

Which value of USBD_ENUM_DELAY should I test?
I have testet 100 and 500
User avatar
fpiSTM
Posts: 1738
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: SerialUSB doesn't work on Maple Mini

Post by fpiSTM »

So if this not works then this is probably an other issue.
Anyway, as said I could not reproduce so hard to help on this.
Ralf9
Posts: 33
Joined: Sat Jan 11, 2020 7:21 pm
Answers: 1
Location: Germany, BaWü

Re: SerialUSB doesn't work on Maple Mini

Post by Ralf9 »

I have tested with another maple mini and other bootloader and find out:

With the orginal bootloader
http://docs.leaflabs.com/static.leaflab ... i_boot.bin
the serialUSB works too after a reset or plug off

With the bootloader20
https://github.com/rogerclarkmelbourne/ ... tm32f1.ino
or this
https://github.com/rogerclarkmelbourne/ ... boot20.bin
the serialUSB works not after a reset or plug off.
With "# ls -l /dev/serial/by-id" no usb device is displayed
BennehBoy
Posts: 135
Joined: Sat Jan 04, 2020 2:38 am
Answers: 1

Re: SerialUSB doesn't work on Maple Mini

Post by BennehBoy »

And you've loaded a sketch with serialusb enabled after reflashing with each bootloader? Roger's bootloader will stay in DFU mode if there's not sketch resident.
Ralf9
Posts: 33
Joined: Sat Jan 11, 2020 7:21 pm
Answers: 1
Location: Germany, BaWü

Re: SerialUSB doesn't work on Maple Mini

Post by Ralf9 »

I loaded this test sketch after reflashing with each bootloader

Code: Select all

int8_t led = 0;

void setup() {
   Serial.begin(115200);
   pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  if(Serial.available()) {
    char c = Serial.read();
    Serial.print("hello ");
    Serial.print(c);
    Serial.println();
  }
  led = ~ led & 1;
  digitalWrite(LED_BUILTIN, led);
  delay(100);
}
BennehBoy
Posts: 135
Joined: Sat Jan 04, 2020 2:38 am
Answers: 1

Re: SerialUSB doesn't work on Maple Mini

Post by BennehBoy »

And you have USART support set to enabled 'generic serial'

And USB Support set to "CDC generic 'serial' supercede USART"
Ralf9
Posts: 33
Joined: Sat Jan 11, 2020 7:21 pm
Answers: 1
Location: Germany, BaWü

Re: SerialUSB doesn't work on Maple Mini

Post by Ralf9 »

Right after the upload of the testsketch is the usb device available and the serialUsb works

Code: Select all

# ls -l /dev/serial/by-id
insgesamt 0
lrwxrwxrwx 1 root root 13 16. Feb 19:53 usb-STMicroelectronics_MAPLEMINI_F103CB_CDC_in_FS_Mode_8D82067E4850-if00 -> ../../ttyACM0
after a reset or plug off, with "# ls -l /dev/serial/by-id" no usb device is displayed
and the serialUSB do not works

I use the core 1.8.0
https://github.com/stm32duino/BoardMana ... index.json

And you have USART support set to enabled 'generic serial'
see Attachments:
Attachments
ArduinoIDE_20200216.png
ArduinoIDE_20200216.png (23.52 KiB) Viewed 7190 times
User avatar
Bakisha
Posts: 139
Joined: Fri Dec 20, 2019 6:50 pm
Answers: 5
Contact:

Re: SerialUSB doesn't work on Maple Mini

Post by Bakisha »

Try with

Code: Select all

Serial.begin(115200); while (!Serial) {    yield();  }
in setup.

I had few troubles also with usb serial on stm32duino core, and that line fixed that. Annoying part is only that sketch won't continue untill there is working serial communication with PC.
Also, for me, when board is unplugged, i had to close serial monitor and open it again after i plug in board to be able to have serial.
Ralf9
Posts: 33
Joined: Sat Jan 11, 2020 7:21 pm
Answers: 1
Location: Germany, BaWü

Re: SerialUSB doesn't work on Maple Mini and Bootloader 2.0

Post by Ralf9 »

Try with ... in setup.
it doesn't work with that either

without a working serialUsb, I cannot use the bootloader20

With the orginal bootloader the serialUsb works also after a reset.
Ralf9
Posts: 33
Joined: Sat Jan 11, 2020 7:21 pm
Answers: 1
Location: Germany, BaWü

Re: SerialUSB doesn't work on Maple Mini

Post by Ralf9 »

I found out that I can with "dmesg -w -e" also test whether the SerialUSB works.

I use this test sketch

Code: Select all

int8_t led = 0;
//#define USBD_ENUM_DELAY 500

void setup() {
   pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  led = ~ led & 1;
  digitalWrite(LED_BUILTIN, led);
  delay(200);
}
I flash with this:

Code: Select all

./dfu-util -d 1eaf:0003 -a 1 -D /tmp/arduino_build_70869/MapleminiTestusb.ino.bin -R
With the orginal bootloader it works too after reset or plug in:

Code: Select all

[  +7,407971] usb 3-9: new full-speed USB device number 11 using xhci_hcd
[Apr13 00:37] usb 3-9: New USB device found, idVendor=1eaf, idProduct=0003
[  +0,000001] usb 3-9: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  +0,000001] usb 3-9: Product: Maple 003
[  +0,000001] usb 3-9: Manufacturer: LeafLabs
[  +0,000001] usb 3-9: SerialNumber: LLM 003
[  +2,451835] usb 3-9: USB disconnect, device number 11
[  +0,306822] usb 3-9: new full-speed USB device number 12 using xhci_hcd
[  +0,149432] usb 3-9: New USB device found, idVendor=0483, idProduct=5740
[  +0,000002] usb 3-9: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  +0,000000] usb 3-9: Product: MAPLEMINI_F103CB CDC in FS Mode
[  +0,000001] usb 3-9: Manufacturer: STMicroelectronics
[  +0,000001] usb 3-9: SerialNumber: 6D8824785548
[  +0,000460] cdc_acm 3-9:1.0: ttyACM0: USB ACM device
With the bootloader2.0 there is no "ttyACM0" after reset

Code: Select all

## press reset button
[ +20,228840] usb 1-9: USB disconnect, device number 60
[  +0,470319] usb 1-9: new full-speed USB device number 61 using xhci_hcd
[  +0,149091] usb 1-9: New USB device found, idVendor=1eaf, idProduct=0003
[  +0,000001] usb 1-9: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  +0,000001] usb 1-9: Product: Maple 003
[  +0,000001] usb 1-9: Manufacturer: LeafLabs
[  +0,000005] usb 1-9: SerialNumber: LLM 003
## flash
[  +1,507190] usb 1-9: reset full-speed USB device number 61 using xhci_hcd
[  +0,147934] usb 1-9: device firmware changed
[  +0,000081] usb 1-9: USB disconnect, device number 61
[  +0,127730] usb 1-9: new full-speed USB device number 62 using xhci_hcd
[  +0,149344] usb 1-9: New USB device found, idVendor=0483, idProduct=5740
[  +0,000002] usb 1-9: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  +0,000001] usb 1-9: Product: MAPLEMINI_F103CB CDC in FS Mode
[  +0,000000] usb 1-9: Manufacturer: STMicroelectronics
[  +0,000001] usb 1-9: SerialNumber: 8D7452895051
[  +0,000449] cdc_acm 1-9:1.0: ttyACM0: USB ACM device
## press reset button
[  +6,039450] usb 1-9: USB disconnect, device number 62
[  +0,000065] cdc_acm 1-9:1.0: failed to set dtr/rts
[  +0,414680] usb 1-9: new full-speed USB device number 63 using xhci_hcd
[  +0,149008] usb 1-9: New USB device found, idVendor=1eaf, idProduct=0003
[  +0,000002] usb 1-9: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  +0,000001] usb 1-9: Product: Maple 003
[  +0,000000] usb 1-9: Manufacturer: LeafLabs
[  +0,000001] usb 1-9: SerialNumber: LLM 003
I also tested it with

Code: Select all

#define USBD_ENUM_DELAY 500
Post Reply

Return to “General discussion”