Hello from Northern Germany

BlackBrix
Posts: 31
Joined: Wed Dec 06, 2017 7:49 am

Hello from Northern Germany

Post by BlackBrix » Wed Dec 06, 2017 8:01 am

Hi all,

my Name is Dirk and I'm living in Northern Germany.

I am not a newbie in the classical arduino world,
but the ARM Cortex and especially STM32 MCU's are a whole new world for me... ;)

So I hope I can learn a lot from this forum.

My actual "project" is, to use a mini-PLC (DIN rail / "smart-relay") with the Arduino-IDE.
This mini-PLC (commercial product / already on the market) uses the STM32F103VET6 (512kB Flash / 100pin),
but the USB reset hardware is not included on the mainboard,
so I am not sure if I can use a (USB-) bootloader or which bootloader is the right one, and so on ...

I am just at the beginning and have to learn a lot ...
Last edited by BlackBrix on Wed Jan 03, 2018 5:22 pm, edited 3 times in total.

stevestrong
Posts: 1951
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: Hello from Northern Germany

Post by stevestrong » Wed Dec 06, 2017 8:19 am

Wilkommen, Dirk.

The reset hardware is not mandatory, but at least a (1.5k..10k) resistor on D+ would be required.

User avatar
RogerClark
Posts: 7545
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Hello from Northern Germany

Post by RogerClark » Wed Dec 06, 2017 8:41 am

Just to clarify.

The USB specification requires that there is some extra hardware to perform the correct USB reset

However in practice we can change on USB pin (USB D+) to GPIO, and drive it to LOW for a millisecond, then turn it back to its normal use (USB D+) and this is enough for most hosts (PC etc) to notice something changed

As long as there is 1.5k pullup from USB D+ to 3.3V

It even works on most machine when a board like the Blue Pill has 10k pullup to 5V

So... this "hack" is not guaranteed to work, but I don't think we have found any cases were it did not work.

BlackBrix
Posts: 31
Joined: Wed Dec 06, 2017 7:49 am

Re: Hello from Northern Germany

Post by BlackBrix » Wed Dec 06, 2017 9:29 am

ah,
this is very interesting,

so you think I can use the "normal" stm32duino bootloader like described here: http://wiki.stm32duino.com/index.php?ti ... bootloader

I have to flash the bootloader then once with an ST-Link via SWD-Interface to the MCU, right ?

Of course, I want to make as few changes as possible to the original-hardware of the mini-PLC,
but at least I think I have to do the following:
- 1.5k pullup from USB D+ to 3.3V
- Boot0- and Boot1-Pin pulldown to GND

and the goal is, that the user do not have to press a button or set a jumper to load a new sketch to the mini-PLC (?)

------------

another question for me is:
are there maybe alternative bootloaders that act as a USB-MSD-Device,
the mini-PLC shows up like an USB-Stick (additional drive) to the ("dumb") users PC,
and he can just place a new /updated "*.bin"-firmware-file* onto it ?

*(e.g. that he can download from my webspace as an update to his specific application)
*(bin file can be generated via the arduino-IDE ?)

stevestrong
Posts: 1951
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany
Contact:

Re: Hello from Northern Germany

Post by stevestrong » Wed Dec 06, 2017 9:38 am

USB MSD is not supported by the stm32duino bootloader, it is only available on discovery (or nucleo?) boards.

The Arduino IDE always generates a bin file which is can be uploaded to the device via USB DFU, or serial (via USB serial adapter when BOOT0 set to "1"), or STLink (you need access to the SWD pins), check the Arduino IDE tools menu options.

We had lately a thread dealing with updating the F103 on remote location only passing a BIN and a batch file: http://stm32duino.com/viewtopic.php?f=3&t=2880
For that you need a USB connection from a PC (with installed drivers) to the F103 board.

User avatar
RogerClark
Posts: 7545
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Hello from Northern Germany

Post by RogerClark » Wed Dec 06, 2017 10:20 am

I posted last week about a "bootloader" I found which was supposed to operate like a USB memory stick.

However, it does not really work like that, because you need to upload to it using something like DD or some sort of windows imaging program.

You cant simply copy a binary to it :-(

The STM32 Nucleo's have a feature like that, but its handled by a separate STM32 (STLink), which then programs the main MCU via SWD

So its not actually a bootloader, its a separate onboard programmer

STM have never released the code for this, so you could not use it on your board, and technically you can't use a Nucleo board in a product as the usage license is for evaluation use only.

Also,a mass storage bootloader would definately be much bigger than a DFU bootloader. Probably 16k instead of 8k

But you could write a mass storage bootloader if you have time.

BlackBrix
Posts: 31
Joined: Wed Dec 06, 2017 7:49 am

Re: Hello from Northern Germany

Post by BlackBrix » Wed Dec 06, 2017 10:38 am

>>"But you could write a mass storage bootloader if you have time."
unfortunately, I have not enough knowledge to do so ... :mrgreen:

I use already USB-MSD Bootloaders with my other arduino-based devices (based on ATMEGA32U4 and ATSAMD21E17A)
and it turns out to be really the best flawless way for giving firmware (bin-file) to "dumb" users with "blank" PCs/Notebooks (no IDE / no drivers / nothing to install) who are far away on site standing in front of the controller ...
They only need a USB-Cable / they understand to use something like a USB-Stick.


But for now,
I would be glad if I can find a way to use the mini-PLC (mentioned above) with the Arduino-IDE and the stm32duino bootloader

User avatar
mrburnette
Posts: 2045
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: Hello from Northern Germany

Post by mrburnette » Wed Dec 06, 2017 3:37 pm


User avatar
RogerClark
Posts: 7545
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Hello from Northern Germany

Post by RogerClark » Wed Dec 06, 2017 7:46 pm

Thanks Ray.

Yet another bootloader most of us were not aware of.

I know Rick was kinda interested in mass storage bootloaders as well, so I will PM him in case he didn’t see this thread

User avatar
mrburnette
Posts: 2045
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: Hello from Northern Germany

Post by mrburnette » Wed Dec 06, 2017 8:25 pm

Google.... a blessing and a curse, the ol' 2-edged sword.

Post Reply