Blinky with timer for BluePill and ST-LINK V2 [WORKING]

Discussions concerning TrueSTUDIO for STM32 9.0.0 and later versions.

Moderators: Markus Girdland, Mattias Norlander

didier9
Posts: 10
Joined: Sat Jan 05, 2019 1:48 am

Blinky with timer for BluePill and ST-LINK V2 [WORKING]

Postby didier9 » Sat Jan 05, 2019 7:07 pm

After quite a bit of frustration setting up the Atollic tool with my Bluepill, I have finally reached partial success.

I have created a standalone blinky project with SysTick based timer under the Atollic tools version 9.2.0 (installed a couple of weeks ago). I can load the project to the Bluepill using the ST-LINK V2 flasher and the ST Visual Programmer v3.4.1

I have not been able to debug using my eBay sourced ST-LINK V2 but I can flash the chip using the Visual Programmer.
(Atollic complains it can't "verify ST device", even though the ST-LINK works with the Visual Programmer and with the Arduino IDE)

The project is zipped there: https://drive.google.com/file/d/1X10qb2m8pqTDvaexanpnrcndNcxBoLcu/view?usp=sharing
Simply expand the project under Atollic\TrueSTUDIO\STM32_workspace_9.2 and import it. You should be good to go.

(make sure you check generating a hex file under Project->Properties->C/C++ Build->Settings->Other->Output format and check Convert build output and select Intel Hex. This will produce an Intel hex file you can use with the ST Visual Programmer.)

I have been frustrated with the way most ARM projects want you to import megatons of header files, regardless of if they are used or not, simply because they are linked from files you do need. This can be an endless project.

I have pruned down to the minimum necessary and everything is in a couple of folders in the src folder. The only custom files are main.c, board.c, board.h and core_cm0.h. I believe (not 100% sure at the moment) that the other files in the build are as I downloaded them from various github locations.

The project blinks the on-board green LED using a counter in the main loop. It also toggles pin B9 at 100mS using the SyStick, which can provide fairly precise timing for your projects.

Next step is to bring up a USART.

Good luck!

didier9
Posts: 10
Joined: Sat Jan 05, 2019 1:48 am

Re: Blinky with timer for BluePill and ST-LINK V2 [WORKING]

Postby didier9 » Sat Jan 05, 2019 7:18 pm

I now remember that you are not supposed to copy files directly into the Eclipse workspace. I wrote this little reminder a while back, I have not tried with with Atollic but it worked with LPCXpresso (the NXP version of Eclipse).

Use at your own risk:

/* Eclipse workspace backup/restore procedure:
*
* Backup:
* Zip the existing workspace folder, preferably the entire workspace.
* If you only backup selected projects, make sure you also separately
* back up all the other projects and libraries your project depends on.
*
* Restore:
* Create a new empty folder which will be your new workspace.
* DO ***NOT*** UNZIP THE ZIP FILE IN IT, THE FOLDER SHOULD BE EMPTY!!!
* Open Eclipse, when asked for a workspace, point it to the new folder.
* Once Eclipse is loaded, select Import project(s) from the File menu.
* (File->Import->General->Existing Projects into the Workspace)
* Point to the zip file.
* Select the project you want to import (there could be more than one in the archive).
*/

Didier


Return to “TrueSTUDIO for STM32 discussions”

Who is online

Users browsing this forum: No registered users and 10 guests