printf and boot question

mamama1
Fri Jan 13, 2017 7:58 pm
Hi

I’m new to STM32 and stm32duino and was trying to port one of my projects from Atmega2560 to a STM32F103ZET board.
I’ve got this one from aliexpress:
https://www.aliexpress.com/item/NEW-ARR … 0.0.qfqFRr

so far I’ve managed to flash the STM32duino bootloader and upload a blink example, that’s something we can build on, I guess.
The board has got one of the fake PL2303 serial ICs on it so I had to use an old driver which doesn’t do a genuinity check or something.

My actual questions now are:
1) in my project I’m using printf_P to read strings from progmem and write them to serial. I’ve redirected printf to UART using fdevopen(&my_putc, 0); which is an AVR function and not available on STM32 core.

now there is a printf function but it doesn’t output anything on the serial monitor and visual studio (I’m using it with visual micro arduino plugin) even says that printf doesn’t accept any arguments.

is there a way to use printf and/or printf_P on STM32duino to write to the serial monitor? I read somewhere that debugging is done a bit differently on STM32 than on Arduino (more like you do it on PIC i guess) but I’d really like to make a universal version of my project (using ifdef to check the microcontroller i’m compiling on) and I’d really prefer not to add a Serial.print for STM32 compatibility to every printf in my software.

2) when I upload the simple blink example everything works, the STM32 onboard LED starts to blink as expected but when I disconnect the USB cable and plug it back in (connected to the leaf port, not the rs232 PL2303 port) the program doesn’t start, the LED doesn’t blink. i didn’t find a way to make it run, I have to reflash it from visual studio or the arduino IDE to make it blink again, as if the program was stored only in the RAM or as if the STM32 board needs some special jumpers or PIN high/lows to boot the programmed software.
Any idea on this?

Thanks for your help!


stevestrong
Fri Jan 13, 2017 9:01 pm
You should use the stm32duino bootloader as upload option in IDE.
Have you put the jumper BOOT1 back to oroginal position?

ahull
Fri Jan 13, 2017 9:44 pm
You might like to take a look at -> http://www.stm32duino.com/viewtopic.php?t=1014

BTW you will get better search results on this site using google than with the built in search at the top of this page.

Use a google search string like the following example …
site:stm32duino.com printf


mamama1
Sat Jan 14, 2017 1:56 am
thanks for your replies.

1) i’m already using the stm32duino boot loader. both boot jumpers are in the original position (tied to groud).

2) i did already find that thread but i am not sure whether that means that printf isn’t implemented in stm32duino out of the box and i have to add it using the code provided in the linked thread or if there is an implementation included which i’m simply too stupid to use.

thanks!


ahull
Sat Jan 14, 2017 2:46 am
mamama1 wrote:thanks for your replies.

1) i’m already using the stm32duino boot loader. both boot jumpers are in the original position (tied to groud).


zmemw16
Sat Jan 14, 2017 10:54 am
search of my posts with mini_ & zet yielded:-
http://www.stm32duino.com/viewtopic.php … ini_#p4760

there’s a whole host of these boards, all have switch on/off, intolerant of 12v as its a 5v in, vet6 or zet6 versions, then it’s +/-sdcard, +/-tft connector, male/female tft connector
+/- == with/without

stephen


Pito
Sat Jan 14, 2017 12:25 pm
printf: once upon a time I used to use this “prtf” function:

#include <stdarg.h>
void prtf(char *fmt, ... ){
char buf[128]; // resulting string limited to 128 chars
va_list args;
va_start (args, fmt );
vsnprintf(buf, 128, fmt, args);
va_end (args);
Serial.print(buf);
}


victor_pv
Wed Jan 18, 2017 6:32 pm
mamama1 wrote:thanks for your replies.

1) i’m already using the stm32duino boot loader. both boot jumpers are in the original position (tied to groud).

2) i did already find that thread but i am not sure whether that means that printf isn’t implemented in stm32duino out of the box and i have to add it using the code provided in the linked thread or if there is an implementation included which i’m simply too stupid to use.

thanks!


mamama1
Sun Jan 22, 2017 10:21 am
thanks, the last post worked.
also i got the stm32 to boot correctly, i had flashed the wrong bootloader previously.

however i’ve kind of discarded the idea of using stm32duino for something serious as it seems that the core is far away from completed and the documentation on stm32duino seems horrobly incomplete and outdated.

thats very sad because stm32 are cool and cheap hardware…


Squonk42
Sun Jan 22, 2017 11:16 am
mamama1 wrote:thowever i’ve kind of discarded the idea of using stm32duino for something serious as it seems that the core is far away from completed and the documentation on stm32duino seems horrobly incomplete and outdated.

martinayotte
Sun Jan 22, 2017 8:46 pm
@mamama1, good luck if you find better solution out in the jungle … :ugeek:

RogerClark
Sun Jan 22, 2017 11:45 pm
mamama1 wrote:thanks, the last post worked.
also i got the stm32 to boot correctly, i had flashed the wrong bootloader previously.

however i’ve kind of discarded the idea of using stm32duino for something serious as it seems that the core is far away from completed and the documentation on stm32duino seems horrobly incomplete and outdated.

thats very sad because stm32 are cool and cheap hardware…


Leave a Reply

Your email address will not be published. Required fields are marked *