Bootloader for HY-TinySTM103T

STM32duino bootloader aka Maple bootloader
Post Reply
profra
Posts: 3
Joined: Sat May 02, 2020 10:01 pm

Bootloader for HY-TinySTM103T

Post by profra »

I normally use a bootloader for BluPill (generic_boot20_pc13.bin) to my full satisfaction.
But I also have a few HY-TinySTM103 boards in the drawer, into which I loaded the bootloader
intended for them (generic_boot20_hytiny.bin). Unfortunately, this bootloader doesn't work
at all and I can't figure out why.
I think the problem is in the incorrect initialization of the USB port, which I conclude
after analyzing the output of the command 'dmesg' of the system terminal.

>dmesg ... for BluePill
[348658.977235] usb 2-4.1: new full-speed USB device number 14 using xhci_hcd
[348659.078858] usb 2-4.1: New USB device found, idVendor=1eaf, idProduct=0004
[348659.078863] usb 2-4.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[348659.078867] usb 2-4.1: Product: Maple
[348659.078869] usb 2-4.1: Manufacturer: LeafLabs
[348659.079572] cdc_acm 2-4.1:1.0: ttyACM0: USB ACM device

>dmesg ... for HY-Tiny
[348766.520115] usb 2-4.1: new full-speed USB device number 15 using xhci_hcd
[348766.621889] usb 2-4.1: New USB device found, idVendor=1eaf, idProduct=0003
[348766.621895] usb 2-4.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[348766.621898] usb 2-4.1: Product: Maple 003
[348766.621901] usb 2-4.1: Manufacturer: LeafLabs
[348766.621904] usb 2-4.1: SerialNumber: LLM 003

I returned to STM32 after reading this article ( https://medium.com/@jobenas_25464/how- ... 0250e54e2 ) and the first steps with BluePill
were very promising. BUT I need to work with HY-Tiny STM103.
I lack some information or knowledge, will someone help me with the solution?
I use PlatformIO.
stevestrong
Posts: 502
Joined: Fri Dec 27, 2019 4:53 pm
Answers: 8
Location: Munich, Germany
Contact:

Re: Bootloader for HY-TinySTM103T

Post by stevestrong »

What do you mean under "does not work"?
What I can see that your host correctly recognizes the HTiny as 1eaf:0003, which is the DFU bootloader VID:PID.
That means, HTiny is already in DFU mode, waiting for code to be uploaded.
So, what is your problem? Please be more precise by describing it.
You eventually may need to install the FU driver, but I do not know how it works on linux (I am on windows only 8-) )
Check for more information under "FAQs and links".
profra
Posts: 3
Joined: Sat May 02, 2020 10:01 pm

Re: Bootloader for HY-TinySTM103T

Post by profra »

I don't get the last line of command dmesg..."cdc_acm 2-4.1:1.0: ttyACM0: USB ACM device"
... ie. USB port (/dev/ttyACM0) can't be then recognized by host PC
stevestrong
Posts: 502
Joined: Fri Dec 27, 2019 4:53 pm
Answers: 8
Location: Munich, Germany
Contact:

Re: Bootloader for HY-TinySTM103T

Post by stevestrong »

That is because it is NOT a CDCACM device! And it will never be.
It is a DFU device.
As I mentioned before, you need an appropriate driver to be able to upload.
stas2z
Posts: 131
Joined: Mon Feb 24, 2020 8:17 pm
Answers: 8

Re: Bootloader for HY-TinySTM103T

Post by stas2z »

stevestrong wrote: Sun May 03, 2020 3:33 pm That is because it is NOT a CDCACM device! And it will never be.
It is a DFU device.
As I mentioned before, you need an appropriate driver to be able to upload.
Linux dont need driver for cdc or dfu

@profra
But steve is right, your device in the dfu mode, you can try to upload to it with dfu util or with arduino ide
profra
Posts: 3
Joined: Sat May 02, 2020 10:01 pm

Re: Bootloader for HY-TinySTM103T

Post by profra »

Hi @stevestron and @stats2z,
I have found the solution thanks to your comments... it was so easy...
I am no experienced user of Arduino and I forget to write the wizard formula "while(!Serial) {};" in the Setup....
Once I did it everything started working properly.... in both Linux and Windows.
See my Blink and Platformio.ini
THANKS, guys.

Code: Select all

 /*
 * Blink
 * - turns on/off an LED, repeatedly
 * - prints count of loops together with a short text
 */

#include <Arduino.h>

// #define myLED PC13  //BluePill
// #define myLED PB12  //BlackPill
#define myLED PA1   //HyTiny

#define PAUSE_ON   10
#define PAUSE_OFF  990
#define ON         LOW
#define OFF        HIGH

uint16_t count ;

void setup()
{
  pinMode(myLED, OUTPUT); digitalWrite(myLED, OFF);
  Serial.begin(115200);
  while (!Serial) {}; delay(10);
  count = 0;
}

void loop()
{
  count += 1;
  Serial.print(count); Serial.println(" Hi, I am here, again!");
  digitalWrite(myLED, ON); delay(PAUSE_ON);
  digitalWrite(myLED, OFF); delay(PAUSE_OFF);
}

Code: Select all

; PlatformIO Project Configuration File
;
;   Build options: build flags, source filter
;   Upload options: custom upload port, speed and extra flags
;   Library options: dependencies, extra library storages
;   Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

; BluePill, BlackPill
; [env:genericSTM32F103C8]
; board = genericSTM32F103C8
; platform = ststm32
; framework = arduino

; HY-TinySTM103
[env:genericSTM32F103TB]
board = genericSTM32F103TB
platform = ststm32
framework = arduino

monitor_port = /dev/ttyACM0
upload_port  = /dev/ttyACM0

; monitor_port = COM9
; upload_port = COM9

monitor_speed = 115200 
upload_protocol = dfu
monitor_filters = time
  
build_flags =
    -D PIO_FRAMEWORK_ARDUINO_ENABLECDC -Os
Post Reply

Return to “USB bootloader”