criz wrote: Thu Jun 13, 2024 12:00 pm
How do I install a sketch to stm32 when there is no port available.How should I do this?Can you explain?Is it by USB to TTL converter I used to upload the bootloader?
a few things, stm32f103c6t6 has very little sram and flash
https://www.st.com/en/microcontrollers- ... 103c6.html
Memories
16 or 32 Kbytes of Flash memory
6 or 10 Kbytes of SRAM
to run stm32duino in this size, it is normally 'for experts', i.e. newbies may very well struggle trying even to use it. Either *run out of sram* (this is invisible, it just crash, no signal no nothing) or flash, when you try to install anythiing, you get an error for not enough flash. Quite often you may be able to squeeze a 'blink' sketch into a small chip, but for anything 'real' you quickly run out of memory / flash.
stm32f103xx requires st-link v2 dongle
https://www.adafruit.com/product/2548
https://www.st.com/en/development-tools/st-link-v2.html
or a usb-uart (serial) dongle to program it, you cannot simply connect a usb cable and program it.
Advise is:
get something like:
https://github.com/stm32duino/Arduino_C ... -64-boards
STM32F401RE Nucleo F401RE
STM32F411RE Nucleo F411RE
or
Adafruit Feather STM32F405 Express 512k sram 1 MB flash, high performance + lots of on chip peripherals
https://www.adafruit.com/product/4382
or at least
stm32f401/f411 ccu or ceu boards
https://stm32-base.org/boards/STM32F401 ... -V1.2.html
https://github.com/WeActStudio/WeActStu ... iSTM32F4x1
for more 'formal' boards, get those Nucleo boards
for a high performance board/chip, try that Adafruit Feather STM32F405 Express
for 'cheap and good' get stm32f401/f411 'black pill boards', but this has less 'support'
stm32f4xx can be programmed using a usb cable it has DFU (device firmware update) built-in on chip, so you only need a usb (phone) cable to connect and program it. And normally, to program it this way, you need to be able to set boot0 (pin or button) and reset (pin or button)
for the Nucleo boards, those are 'formal' (original boards from ST), they have a st-link v2 built-in on the board itself, so it'd always be able to program the chip.
for 'newbies' it is better to start wit the stm32f4xx (or even g4xx very new less support for now) series
reason:
- more sram
- more flash
- has 'art accelerator' (on chip cache), normally to run from flash it may take like 3-8 wait states, if there is 'art accelerator' (on chip cache) and the code is in cache, it becomes 0 wait state, so if that instruction takes 1 cpu cycle to run, and cpu clock is 100 Mhz, you get 100 Mips (100 million instructions per seconds) no loss, no slower. that practically means all 'existing' chips are possibly 3-8 times slower running from flash without 'art accelerator', though it depends on the code being in cache to get 0 wait state.
^ but in short stm32f4xx is faster for the same hz vs say stm32f1xx or stm32f/g0xx
- has single precision FPU (this makes single precision maths like 5-10 or even much much more (100?) times faster fs stm32f103, stm32f030/g030 etc
this is especially if floating point maths say take 100 instructions to do that and if the fpu can do the same calc in 1 clock cycle in 1 instruction, that is 100 x faster (not always the case).
- and no less USB DFU (device firmware update) program simply using a usb (phone) cable (need to set boot0 and press reset)
And for all these benefits, the price of stm32f4xxg4xx is modestly higher vs stm32f103xx / f030xx
in short, newbies should start with a better chip/board if you don't want to be bogged down by tasks that need 'advanced' 'expert' level skills (in particular to deal with highly memory constrained e.g. 6 k sram and 32k flash) environment, just to program that microcontroller.
if you insist on stm32f103, get at least stm32f103c8 - 20k sram 64k flash or stm32f103cb 20k sram 128k flash
currently, it seemed for the price of stm32f103cb pill board, you can buy a stm32f401ccu 'pill board' in the online 'flea markets' e.g. Aliexpress
https://www.aliexpress.com/w/wholesale- ... 1ccu6.html
https://www.aliexpress.com/w/wholesale- ... 1ceu6.html
I'd simply choose stm32f401ccu
https://www.st.com/en/microcontrollers- ... 401cc.html
as this is 64k sram and 256k flash plus that art accelerator and FPU and USB DFU programming (only a phone usb cable is needed)