Page 1 of 5

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

Posted: Sat Jan 11, 2020 7:52 pm
by Ralf9
Hi,

I use the Arduino IDE 1.8.10 on OpenSuse Leap 15.0 64 Bit and the Maple Mini,
and this package

Code: Select all

https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json
I use this examble, it doesn't work (I have try "Serial.begin(57600)" and "SerialUSB.begin(57600)")

Code: Select all

int8_t led = 0;

void setup() {
   SerialUSB.begin(57600); //this isn't needed, it is pre-initialised , otherwise you could uncomment it to test
   pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  if(SerialUSB.available()) {
    char c = Serial.read();
    SerialUSB.print("hello ");
    SerialUSB.print(c);
    SerialUSB.println();
  }
  led = ~ led & 1;
  digitalWrite(LED_BUILTIN, led);
  delay(100);
}
After flash

Code: Select all

ls -l /dev/serial/by-id
insgesamt 0
lrwxrwxrwx 1 root root 13 11. Jan 20:08 usb-STMicroelectronics_MAPLEMINI_F103CB_CDC_in_FS_Mode_8D7452895051-if00 -> ../../ttyACM0
After press reset there is no USB device

Code: Select all

ls -l /dev/serial/by-id
ls: Zugriff auf '/dev/serial/by-id' nicht möglich: Datei oder Verzeichnis nicht gefunden
Thank you.

Re: SerialUSB doesn't work on Maple Mini

Posted: Sat Jan 11, 2020 10:22 pm
by Ralf9
I have it also testet under Windows Arduino 1.8.10 with this package
https://github.com/rogerclarkmelbourne/Arduino_STM32
it works with it.
After a reset i become

Code: Select all

ls -l /dev/serial/by-id
lrwxrwxrwx 1 root root 13 11. Jan 23:21 usb-LeafLabs_Maple-if00 -> ../../ttyACM0

Re: SerialUSB doesn't work on Maple Mini

Posted: Sat Jan 11, 2020 11:39 pm
by fredbox
I can confirm your findings. Serial USB works on the original Roger core with the bootloader installed but not with the STM core. The led blinks but the serial port never appears.

If you abandon the bootloader and upload your program using a ST-Link (SWDIO to pin D22, SWCLK to pin D21), your sketch works fine after fixing one typo. /dev/ttyACM0 is available for USB serial.

I had forgotten how much of a pain it is to use that bootloader. You can also use a USB/Serial adapter on PA9/PA10 but you will need to set Boot 0 =1 to upload. The ST-Link works without doing anything special.

It might be worth trying the hid bootloader on the maple mini and see if that works differently. https://github.com/Serasidis/STM32_HID_ ... r/releases

Re: SerialUSB doesn't work on Maple Mini

Posted: Sun Jan 12, 2020 1:46 am
by fredbox
The HID bootloader is the same behavior - no USB serial available with the bootloader installed.

Re: SerialUSB doesn't work on Maple Mini

Posted: Mon Jan 13, 2020 5:36 pm
by Ralf9
with this the SerialUSB works

Code: Select all

http://dan.drown.org/stm32duino/package_STM32duino_index.json
It seems that von Roger.

But with this EEPROM library I can only read and write 16 Bit Data, but I will read and write 8 Bit Data.

Is someone here with that the SerialUSB works with the Release Core 1.8.0? (https://github.com/stm32duino/Arduino_Core_STM32)

Re: SerialUSB doesn't work on Maple Mini

Posted: Mon Jan 13, 2020 6:11 pm
by fpiSTM
Sorry, missed that. I will check when I could.

Re: SerialUSB doesn't work on Maple Mini

Posted: Tue Jan 14, 2020 3:19 pm
by fpiSTM
@Ralf9
You're right it seems there is a regression with the BL usage.
I think there is an issue with the upload.
DFU has been modified in the Arduino Tools. I will check if this is the root cause.

Re: SerialUSB doesn't work on Maple Mini

Posted: Tue Jan 14, 2020 3:21 pm
by fredbox
Is someone here with that the SerialUSB works with the Release Core 1.8.0?
Serial USB works without any bootloader installed. USART1 and USART2 are also available.
But with this EEPROM library I can only read and write 16 Bit Data, but I will read and write 8 Bit Data.
I recommend one of the inexpensive DS3231 real time clock modules. These keep fairly accurate time and have a few kilobytes of eeprom.

It takes about 2 seconds to upload a 20K binary with the ST-Link. This is much faster than uploading with a bootloader.

Re: SerialUSB doesn't work on Maple Mini

Posted: Wed Jan 15, 2020 10:20 am
by fpiSTM
@fredbox , @Ralf9

In fact, it works. I've the wrong bootloader. I thought I get the Original but no.
With the bootloder v2.0 it works fine.

Code: Select all

maple_upload ttyACM0 2 1EAF:0003 /tmp/arduino_build_572333/AnalogReadSerial.ino.bin 
dfu-util 0.8

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2014 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
Opening DFU capable USB device...
ID 1eaf:0003
Run-time device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Setting #2 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 1024
Copying data from PC to DFU device

Download	[                         ]   0%            0 bytes
Download	[=                        ]   4%         1024 bytes
Download	[==                       ]   8%         2048 bytes
Download	[===                      ]  13%         3072 bytes
Download	[====                     ]  17%         4096 bytes
Download	[=====                    ]  22%         5120 bytes
Download	[======                   ]  26%         6144 bytes
Download	[=======                  ]  31%         7168 bytes
Download	[========                 ]  35%         8192 bytes
Download	[==========               ]  40%         9216 bytes
Download	[===========              ]  44%        10240 bytes
Download	[============             ]  49%        11264 bytes
Download	[=============            ]  53%        12288 bytes
Download	[==============           ]  58%        13312 bytes
Download	[===============          ]  62%        14336 bytes
Download	[================         ]  67%        15360 bytes
Download	[=================        ]  71%        16384 bytes
Download	[===================      ]  76%        17408 bytes
Download	[====================     ]  80%        18432 bytes
Download	[=====================    ]  85%        19456 bytes
Download	[======================   ]  89%        20480 bytes
Download	[=======================  ]  94%        21504 bytes
Download	[======================== ]  98%        21824 bytes
Download	[=========================] 100%        21824 bytes
Download done.
state(8) = dfuMANIFEST-WAIT-RESET, status(0) = No error condition is present
Done!
Resetting USB to switch back to runtime mode
Waiting for /dev/ttyACM0 serial...Done
I've made several iteration and this is ok.

Re: SerialUSB doesn't work on Maple Mini

Posted: Fri Jan 17, 2020 11:27 pm
by Ralf9
Thank You,

With the bootloder v2.0 now it works