[SOLVED]Interesting problem

Post here all questions related to LibMaple core if you can't find a relevant section!
miki
Posts: 26
Joined: Mon Jan 27, 2020 3:39 pm

Re: Interesting problem

Post by miki »

The binary is built with arduino IDE in serial mode.Flashing it is done with STlink V2 and STlink utilities.I used serial only for debug as temporary solution it is a mess of small wires I cannot maintain in like that and use the board.
Any way thanks for support I will try investigate more.
Last edited by miki on Tue Jan 28, 2020 4:48 pm, edited 2 times in total.
User avatar
Bakisha
Posts: 139
Joined: Fri Dec 20, 2019 6:50 pm
Answers: 5
Contact:

Re: Interesting problem

Post by Bakisha »

Maybe not related, but got to ask. Do you have STM32F103C8/B chip or chinese clones like SK32F103C8 or GD32F103C8?

But i agree with others, if you are compiling with Arduino IDE, and using Roger's core, why not upload from Arduino IDE? In my experience, uploading with st-link needed reset only when there is already flashed stm32duino bootloader. Then bootloader is overwritten and next st-link upload is done without the need for reset.
miki
Posts: 26
Joined: Mon Jan 27, 2020 3:39 pm

Re: Interesting problem

Post by miki »

STM chips original.
I cannot use arduino IDE upload and ST link I get an error STlink not found.My project don't have maple bootloader.
As I said I can use serial for uploading no problem but it is not feasible for me for keeping long term and portability.
I have exposed only SWD pins.The serial pins are not available,I did a HW hack to get access to it.And I need for testing flashing more than one time.
Last edited by miki on Tue Jan 28, 2020 7:13 pm, edited 2 times in total.
User avatar
Bakisha
Posts: 139
Joined: Fri Dec 20, 2019 6:50 pm
Answers: 5
Contact:

Re: Interesting problem

Post by Bakisha »

What error Arduino IDE report?
- "No ST-LINK detected!"
- "No target connected. Unable to connect to ST-LINK!"
- "Unable to connect to the MCU device!"

Also, when using STM32 ST-LINK Utility, when you click "connect to target", does it connect or you get error "cannot connect to target"? Or you can only connect when pressing reset, then hit "connect" and quickly release reset (if you have access to reset).
ag123
Posts: 1655
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: Interesting problem

Post by ag123 »

among the things to check is the ld script used with the sketch, normally that is selected with the upload method as if the stm32duino DFU boot loader is selected, the install address of the sketch would be 0x8002000. without that additional boot loader it is 0x8000000 this is the normal flash install address.
in addition the vector tab address needs to point to the respective install address.

and like pito mentioned, option bytes can make a difference between a normal reset or actually simply a resume from standby / stop low power modes. that may change the behavior.

in addition, as sketch/firmware install is normally rather infrequent, perhaps the user can press reset after install to make it run normally?
miki
Posts: 26
Joined: Mon Jan 27, 2020 3:39 pm

Re: Interesting problem

Post by miki »

Bakisha wrote: Tue Jan 28, 2020 5:31 pm What error Arduino IDE report?
- "No ST-LINK detected!"
- "No target connected. Unable to connect to ST-LINK!"
- "Unable to connect to the MCU device!"

Also, when using STM32 ST-LINK Utility, when you click "connect to target", does it connect or you get error "cannot connect to target"? Or you can only connect when pressing reset, then hit "connect" and quickly release reset (if you have access to reset).
On STlink I connect pressing BOOT0 and after connect to target.Works every time.Did not work with arduino,Or maybe I did not try enough,I will test more for that(The error was No STlink detected).
miki
Posts: 26
Joined: Mon Jan 27, 2020 3:39 pm

Re: Interesting problem

Post by miki »

ag123 wrote: Tue Jan 28, 2020 6:07 pm among the things to check is the ld script used with the sketch, normally that is selected with the upload method as if the stm32duino DFU boot loader is selected, the install address of the sketch would be 0x8002000. without that additional boot loader it is 0x8000000 this is the normal flash install address.
in addition the vector tab address needs to point to the respective install address.

and like pito mentioned, option bytes can make a difference between a normal reset or actually simply a resume from standby / stop low power modes. that may change the behavior.

in addition, as sketch/firmware install is normally rather infrequent, perhaps the user can press reset after install to make it run normally?
It maybe be something here.What should I check on option bytes?
User avatar
Bakisha
Posts: 139
Joined: Fri Dec 20, 2019 6:50 pm
Answers: 5
Contact:

Re: Interesting problem

Post by Bakisha »

Error "No ST-LINK detected!" i get only when i disconnect st-link v2 dongle from USB and try to upload from Arduino IDE. Maybe missing drivers, maybe st-link v2 is stuck in DFU mode, maybe core or Arduino IDE need to be updated.

I don't understand what BOOT0 have to do with ST-LINK Utility. I tried BOOT0 on my bluepill board, and i couldn't connect with BOOT0 jumper. Even when i couldn't connect, pressing "connect" few seconds after power up or reset resulted in normal connection.

For me, BOOT0 is only needed with "Flash Loader Demonstrator" and with Serial dongle connected to PA9/PA10.
miki
Posts: 26
Joined: Mon Jan 27, 2020 3:39 pm

Re: Interesting problem

Post by miki »

Well STLINk works with BOOT0 as I have no access to reset pin but I hacked the BOOT0 pin with a small wire to 3.3V.I called in my main program the jumping to bootloader header to eliminate the need of BOOT0 and use another more accessible pin.
ag123
Posts: 1655
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: Interesting problem

Post by ag123 »

miki wrote: Tue Jan 28, 2020 6:31 pm
It maybe be something here.What should I check on option bytes?
review rm0008 stm32f103 reference manual
https://www.st.com/resource/en/referenc ... 171190.pdf
under 7.1.1 system reset
Low-power management reset
There are two ways to generate a low-power management reset:
1. Reset generated when entering Standby mode:
This type of reset is enabled by resetting nRST_STDBY bit in User Option Bytes. In this
case, whenever a Standby mode entry sequence is successfully executed, the device
is reset instead of entering Standby mode.
2. Reset when entering Stop mode:
This type of reset is enabled by resetting nRST_STOP bit in User Option Bytes. In this
case, whenever a Stop mode entry sequence is successfully executed, the device is
reset instead of entering Stop mode.
For further information on the User Option Bytes, refer to the STM32F10xxx Flash
programming manual.
and
PM0075 Flash Programming manual
https://www.st.com/resource/en/programm ... 283419.pdf
Option byte register (FLASH_OBR)
Bit 18: nRST_STDBY
0: Reset generated when entering Standby mode.
1: No reset generated.
Bit 17: nRST_STOP
0: Reset generated when entering Stop mode
1: No reset generated
it looks rather confusing but you can try to set the nRST_STDBY, nRST_STOP bits by trying both 0 and 1.
it seem to suggest that if the bits are zero instead of going into standby or stop it generates a reset, while if they are 1 it simply goes into standby or stop

BOOT0 has nothing to do with ST-link, BOOT0 is normally used for uart uploads, while st-link use SWD which has no dependency on BOOT0
in fact, if you are using st-link, you should probably leave BOOT0 at 0 so that it would not jump to the uart boot loader on reset
Post Reply

Return to “General discussion”