Go Down

Topic: problems in uploading code to stm32 bluepill (Read 696 times) previous topic - next topic

manveen_singh

Jul 20, 2019, 08:00 am Last Edit: Jul 20, 2019, 08:13 am by manveen_singh
hi
i am not able to program the stm32 bluepill board using arduino ide.

i am trying to upload the blinky sketch using USB ttl converter. but everytime i try to upload i am getting the same error.

i am following this instructions STM32 arduino .

but i am getting the same error every time.
Code: [Select]
Archiving built core (caching) in: C:\Users\user\AppData\Local\Temp\arduino_cache_99041\core\core_stm32duino_STM32F1_genericSTM32F103C_device_variant_STM32F103C8,upload_method_serialMethod,cpu_speed_speed_72mhz,opt_osstd_2319373ca4baa5514c3629abb9b23228.a
Sketch uses 12652 bytes (19%) of program storage space. Maximum is 65536 bytes.
Global variables use 2456 bytes (11%) of dynamic memory, leaving 18024 bytes for local variables. Maximum is 20480 bytes.
C:\Users\user\AppData\Local\Arduino15\packages\stm32duino\tools\stm32tools\2019.6.29/win/serial_upload.bat COM10 {upload.altID} {upload.usbID} C:\Users\user\AppData\Local\Temp\arduino_build_867610/stm_blinky.ino.bin
stm32flash 0.4
Failed to init device.

http://stm32flash.googlecode.com/

Using Parser : Raw BINARY
Interface serial_w32: 115200 8E1


till now i have done the following

1. reinstalled the arduino ide to vs 1.8.5 from 1.8.9

2. reinstalled the boards from the board anagers.

3 correctly installed the bootloader from the roger clark's github. using stlink v2.

4. connections are correct. tx -> rx and rx-> tx

5. restarted the computer . and reinstalled the drivers for usb ttl.

6. changed the usb ttl .

7. changed the stm board.

8. jumpers are at correct position.

9. reflashed the bootloader.

i also have a st link v2 . it is also not been able to upload the code.

but st utility is showing that everything is fine.


Note 1 .
after googling a lot. i came across a post saying that downgrading for 1.8.5 from 1.8.6 worked for someone. so i tried that. it was able to upload the code. but led didnt blink .

so i tried again and after that ide was not able to upload any code.


pic 1


pic 2



log while using the st link

Code: [Select]

Build options changed, rebuilding all
Archiving built core (caching) in: C:\Users\user\AppData\Local\Temp\arduino_cache_476880\core\core_stm32duino_STM32F1_genericSTM32F103C_device_variant_STM32F103C8,upload_method_STLinkMethod,cpu_speed_speed_72mhz,opt_osstd_2319373ca4baa5514c3629abb9b23228.a
Sketch uses 14324 bytes (21%) of program storage space. Maximum is 65536 bytes.
Global variables use 3088 bytes (15%) of dynamic memory, leaving 17392 bytes for local variables. Maximum is 20480 bytes.
C:\Users\user\AppData\Local\Arduino15\packages\stm32duino\tools\stm32tools\2019.6.29/win/stlink_upload.bat C:\Users\user\AppData\Local\Temp\arduino_build_724584/stm_blinky.ino.bin

C:\Program Files (x86)\Arduino>rem @echo off

C:\Program Files (x86)\Arduino>rem: Note C:\Users\user\AppData\Local\Arduino15\packages\stm32duino\tools\stm32tools\2019.6.29\win\ get path of this batch file

C:\Program Files (x86)\Arduino>rem: Need to change drive if My Documents is on a drive other than C:

C:\Program Files (x86)\Arduino>set driverLetter=C:\Users\user\AppData\Local\Arduino15\packages\stm32duino\tools\stm32tools\2019.6.29\win\

C:\Program Files (x86)\Arduino>set driverLetter=C:

C:\Program Files (x86)\Arduino>C:

C:\Program Files (x86)\Arduino>cd C:\Users\user\AppData\Local\Arduino15\packages\stm32duino\tools\stm32tools\2019.6.29\win\

C:\Users\user\AppData\Local\Arduino15\packages\stm32duino\tools\stm32tools\2019.6.29\win>rem: the two line below are needed to fix path issues with incorrect slashes before the bin file name

C:\Users\user\AppData\Local\Arduino15\packages\stm32duino\tools\stm32tools\2019.6.29\win>set str=C:\Users\user\AppData\Local\Temp\arduino_build_724584/stm_blinky.ino.bin

C:\Users\user\AppData\Local\Arduino15\packages\stm32duino\tools\stm32tools\2019.6.29\win>set str=C:\Users\user\AppData\Local\Temp\arduino_build_724584\stm_blinky.ino.bin

C:\Users\user\AppData\Local\Arduino15\packages\stm32duino\tools\stm32tools\2019.6.29\win>rem: ------------- use STLINK CLI

C:\Users\user\AppData\Local\Arduino15\packages\stm32duino\tools\stm32tools\2019.6.29\win>stlink\ST-LINK_CLI.exe -c SWD -P C:\Users\user\AppData\Local\Temp\arduino_build_724584\stm_blinky.ino.bin 0x8000000 -Rst -Run -NoPrompt
STM32 ST-LINK CLI v3.3.0.0
STM32 ST-LINK Command Line Interface

ST-LINK SN: 54FF6D064884525019112287
ST-LINK Firmware version: V2J34S7 (Need Update)
Connected via SWD.
SWD Frequency = 4000K.
Target voltage = 3.2 V
Connection mode: Normal
Reset mode: Software reset
Device ID: 0x412
Device flash Size: 32 Kbytes
Device family: STM32F10xx Low-density

Loading file...
Flash Programming:
  File : C:\Users\user\AppData\Local\Temp\arduino_build_724584\stm_blinky.ino.bin
  Address : 0x08000000
Memory programming...
±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±± 0%
 0%ÛÛÛÛÛ 10%ÛÛÛÛÛ 21%ÛÛÛÛÛÛ 32%ÛÛÛÛÛ 42%ÛÛÛÛÛ 53%ÛÛÛÛÛÛ 64%ÛÛÛÛÛ 75%ÛÛÛÛÛ 85%ÛÛÛÛÛÛ 96%ÛÛ 100%
Memory programmed in 1s and 344ms.
Programming Complete.

MCU Reset.

The core is locked up!


C:\Users\user\AppData\Local\Arduino15\packages\stm32duino\tools\stm32tools\2019.6.29\win>rem: Using the open source texane-stlink instead of the proprietary STM stlink exe

C:\Users\user\AppData\Local\Arduino15\packages\stm32duino\tools\stm32tools\2019.6.29\win>rem:texane-stlink\st-flash.exe write C:\Users\user\AppData\Local\Temp\arduino_build_724584\stm_blinky.ino.bin 0x8000000


PaulRB

#1
Jul 20, 2019, 11:52 am Last Edit: Jul 20, 2019, 11:54 am by PaulRB
The best place to ask this question might be the STM32 Arduino Forum. Search that forum first before you post, maybe others there have solved the same problem.

If you do post there, leave a message on this thread so that other forum members here don't waste time trying to answer your question. If you can't get an answer on the other forum, you can always return to this thread and ask for more help.

manveen_singh


PaulRB

i am comming from there only .
I don't understand. Did you mean you asked the question on that forum already? If so, you should say that up front. What answer did you get?

KASSIMSAMJI

faced same issue weeks ago with FTDI board,

tried with ST Link and worked like a charm
Expert To Be: Machine Learning And Computer/Machine Vision (ML/CV/MV)

manveen_singh

I don't understand. Did you mean you asked the question on that forum already? If so, you should say that up front. What answer did you get?
My account was not allowed to post anything there as of now.

so when i said that i am comming from there. i meant that i have looked a lot of similar forums there . but none of them worked for me .
i have not posted anything there.

manveen_singh

tried with ST Link and worked like a charm
I also ttried that . nothing worked. the core is locked up error cam . then i tried all the jumper settings . again nothing worked. again the same error came.

in on jumper setting. it did show that programed sucessfully . but nothing happened. LED didnt blink.

i looked thru the code in the memory . using thier stlink utility before and after programming. there were some changes in the binary . but still nothing happened,

zoomx

Have you put the jumpers in the right mode as described in the first link you posted?
There is a position for programming and another position for running programs.
You can upload using ST-link too.

manveen_singh

You can upload using ST-link too.
yes


You can upload using ST-link too.
i am techinicaly able to upload the code. but nothing is happening . please see reply #6

zoomx

Try an example that print on serial like this one that print on all serials and has a blink too, joust to test that maybe the problem is on the LED.

Code: [Select]
/*
  STM32_serial_test

  Use PC13 instead of PIN13 for generic STM32 boards.
  Print on every serial to identify them.

  Led pin
  BluePill  PC13
  MapleMini PB1
 
*/
#define LED PC13 //PC 13 on BluePill, PB1 on Maple Mini

void blink() {
  digitalWrite(LED, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(200);              // wait for a second
  digitalWrite(LED, LOW);    // turn the LED off by making the voltage LOW
  delay(100);              // wait for a second
}

void setup() {
  // initialize pins PC13, as an output.
  pinMode(LED, OUTPUT);
  Serial.begin(115200);
  Serial1.begin(115200);
  Serial2.begin(115200);
  //Serial3.begin(115200);
  Serial.println("Hello world this is Serial");
  Serial1.println("Hello world this is Serial1");
  Serial2.println("Hello world this is Serial2");
  //Serial3.println("Hello world this is Serial3");

  blink();
}

void loop() {
  blink();              //
  Serial.println("It Works on serial");
  Serial1.println("It Works on serial1");
  Serial2.println("It Works on serial2");
}

manveen_singh

tried it. nothing happened.

i seiral didnt not work also.
i attached a usb ttl to uart 1 (hopin that at least something would come up on serial monitor.) nothing happened. serial1 did not print in uart1

zoomx

 :o
I assume that your board is like the one showed in photos.

Check that the MCU is an ST MCU since there are some blue pills that has a sort of "clone" mcu. But You wrote that st-link utility was able to recognize the MCU and this not happens with clones.


Stlink us used for debugging too but I never used it in this way.

Maybe you can use the last version. Remove the core from the IDE using the Board Manager, download the new version from here
https://github.com/rogerclarkmelbourne/Arduino_STM32
just use the download button to get a zip.

In the sketch folder create a new folder named hardware and inside unzio the... zip so you will have
Hardware\Arduino_STM32-master and inside all the files.
Rename Arduino_STM32-master in Arduino_STM32
Launch the IDE.

I used the old version without any problem but you can try.

MrMark

#12
Jul 25, 2019, 04:01 pm Last Edit: Jul 25, 2019, 04:02 pm by MrMark
I don't have a system in front of me, but from your ST-Link log "Device flash Size: 32 Kbytes" doesn't seem right.  The Bluepill STM32f103c8t6 is supposed to be a 64 kByte flash device.

What are the markings on the MCU chip?

zoomx

Karma+ MrMark!
You're right! Flash is almost 64k.
So it is still an STM32 but a LowDensity MCU so the finals letters matter!

manveen_singh

yes i will try that and tell you the results

Go Up