Page 2 of 5

Re: Interesting problem

Posted: Tue Jan 28, 2020 8:14 am
by ag123
another way i'd think is to use roger's libmaple boot loader that one needs none of uart, st-link etc

Re: Interesting problem

Posted: Tue Jan 28, 2020 8:29 am
by stevestrong
If you use maple lib I assume you are using Roger's core.
There is a difference in using the two upload meethods in boards.txt:

Code: Select all

genericSTM32F103C.menu.upload_method.serialMethod=Serial
genericSTM32F103C.menu.upload_method.serialMethod.upload.protocol=maple_serial
genericSTM32F103C.menu.upload_method.serialMethod.upload.tool=serial_upload
genericSTM32F103C.menu.upload_method.serialMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG

genericSTM32F103C.menu.upload_method.STLinkMethod=STLink
genericSTM32F103C.menu.upload_method.STLinkMethod.upload.protocol=STLink
genericSTM32F103C.menu.upload_method.STLinkMethod.upload.tool=stlink_upload
genericSTM32F103C.menu.upload_method.STLinkMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DSERIAL_USB -DGENERIC_BOOTLOADER
Eventually try to use the same upload flags in STLink upload case as in serial upload case, maybe it has something to do with them.

Re: Interesting problem

Posted: Tue Jan 28, 2020 9:12 am
by miki
If you use maple lib I assume you are using Roger's core.
There is a difference in using the two upload methods in boards.txt:
Yes I use roger core.I was sure somebody would raise eventually the uploading issue,
I used the same binary file for flashing.
I compiled the program with serial option not with STlink one in Tools/Board and used to flash with Stlink.I used Flashing with FTDI serial after as debug tool see what is the problem.Found out that after flashing with serial, the program is working.

If I compile with ST link option and flash the program is messed up and have unpredictable behaviour.I don't upload via arduino ide.

About roger bootloader that is USB based, my project has no USB port.
I mention also that my project doesn't use SWD pins they are not defined.

Re: Interesting problem

Posted: Tue Jan 28, 2020 9:40 am
by Bakisha
In your code, do you use pins PA13 or PA14? (SWDIO and SWCLK) Or in some way set them as inputs/output (individually or as portA manipulation). Maybe it's in conflict with st-link's pins.

Re: Interesting problem

Posted: Tue Jan 28, 2020 9:42 am
by miki
I replied already.I was thinking about that when I saw first time the problem.
No they are not defined.Maybe they are affected somehow but I don't see it right now.I have some PA pins defined as analog pins but not those.
I have activated some priority interrupts on maybe that can be a problem I will play with that to check.

Re: Interesting problem

Posted: Tue Jan 28, 2020 9:50 am
by ag123
try roger's bootloader, that's probably a effective solution, no need for uart, boot0 pins, st-link etc, just a usb cable solves it. triggering reset is simply the DTR + 'LEAF' magic code, search in tools folder for the utilities
for uart one should preferably control the boot0 and reset pins as well for a complete solution, if those pins are not accessible i'd think roger's libmaple boot loader is an effective way out

Re: Interesting problem

Posted: Tue Jan 28, 2020 9:53 am
by miki
I thought roger bootloader needs usb to work.If it works without I'm definitely interested.

I hope it is not using too much time to boot.These bootloaders have a check at start some waiting for 2 seconds waiting for command before switching to main program.I need to enter in main program in max 100-200ms.

Re: Interesting problem

Posted: Tue Jan 28, 2020 9:58 am
by ag123
but i'd guess one can also write a 'boot loader' if one is so inclined, just that it'd take some effort to do so
roger's is the libmaple usb DFU updater. it is a simplest way to install a sketch with just a usb cable

Re: Interesting problem

Posted: Tue Jan 28, 2020 10:04 am
by miki
STM32 has already its own internal bootloader.If I have already an easy method to jump in from application there is no point to make a new bootloader.

Re: Interesting problem

Posted: Tue Jan 28, 2020 2:59 pm
by stevestrong
Well, if you build with serial upload method and upload with serial method, and it works, then I do not see any reason why to build using the STLink method. Just keep the working scheme.

OTOH, Roger's core is designed to be used with Arduino IDE. If you are using a different IDE, then please understand that support cannot be guaranteed.