cancel
Showing results for 
Search instead for 
Did you mean: 

Starting STM8L152 Discovery Board project

IC_DOC
Associate II

I am new to ST digital products and am working on getting the STM8L Discovery running for coding and debugging before a new serious project begins. My question is how to identify and connect the needed resources for this MPU, etc. Like, how to talk to the Discovery board, compile code, debug it, program and reprogram it. I have the Discovery board and legacy USB cable to-from Windows PC. I have lots of PDF data files and ST Cube MX, Cosmic CXSTM8 Special Edition, ST Visual Develop, ST Visual Programmer. How do all of these tools work together for editing source, compile, program and debug, reprogram? Feedback is earnestly requested!

 

7 REPLIES 7
AA1
Senior III

You need to have some background with C programming, compilers and linkers. Read "UM1014 - Getting started with STM8L-DISCOVERY" and the reference documents. The Discovery board is connected to your PC by USB. But first install the software.

IC_DOC
Associate II

Thank you for the reply. But which "software do I install?"

I have done embedded MPU projects with K&R C and PIC but no ST. My first main help for STM8L152 is what software do I use to talk back and forth from Windows 10 PC and Discovery board? I am stumped so far.

Read the documents. For example UM1014 - Getting started with STM8L-DISCOVERY page 2.
1.2.1 Software environment
1.2.2 Connect the STM8L-DISCOVERY to the host PC

Install ST Visual Develop. It is IDE where you will write your source code and debug. Then install Cosmic compiler (or another one, like SDCC). With cosmic you will need to get (free) liecence (takes up to one day). You should also install ST Visual Programmer (to be able change "option bytes" etc.). And thats all what is needed for basic "bare metal" programming / debugging. If you want, you can download and include also STM8L standard peripheral library. STM8CubeMX is intended only for "planning", it is not able to generate any source code or project (like STM32CubeMX).

Some time you probably spent to study compiler (how to manage interrupts etc) and some time also takes Standard Peripheral Library implementation (which file to copy, which file to include, what to define etc.).


Thanks, this helps. What I am missing is how to tell that my USB connection to DISCOVERY board is working? I got a mini USB cable that does power AND data.

I have Cosmic, STVD, STVP and STM8CubeMX so I think I have all of the software resources needed. Some documents say that this environment will support assembler coding--I'm studying that. Is there a separate assembler/linker?

All in all, ST has a very comprehensive tool set. The Cosmic compiler looks like year-to-year need for repeating free licenses. I don't see a paid path after that for later on.

For now, I am trying to use the sample code for the DISCOVERY board as the starting point for my first phase. So I need to figure out how STVD works. Firstly, the two attached error reports are puzzling and how to fix?

Check if your Stlink (programmer) works.
a) After USB connection, it shoud look like "flash drive" 
b) Start STVP, select tool (Stlink) and chip and try to read MCU memory. 
In case of succes, you are sure that your PC can comunicate with programmer (Stlink) and programmer can communicate with target MCU (STM8L).

Then:
1. run command line as administrator and 
2. execute command Regsvr32 /u "C:\Program Files (x86)\Common Files\Microsoft Shared\DAO\DAO350.DLL" (including quotation marks)
3. execute command Regsvr32 "C:\Program Files (x86)\Common Files\Microsoft Shared\DAO\DAO350.DLL" (including quotation marks)

I've been trying, with little success, to get the STM8L-DISCOVERY board to open up for development of its own source code collection in STW8009.zip. Using Windows 10, I used the STSW-LINK009 stlink-winusb-install.bat files from the ST website but it did not do anything. Then I executed dpinst_amd64.exe which displayed and looked OK. But no driver was found in Device Manager and running DPVD and Debug yielded message of no configuration data. One time I got the batch file to work to show an instantiation of the USB driver installation in Device Manager—one time, even after Win10 restarts.

I then tried to use the ST-LINK/V2 and STLINK-V3SET modules to access and program the DISCOVERY board. I realized finally that the DISCOVERY board is supposed to have its own STLINK built-in. I set up STVD and STVP as best I could to access and just view the board's existing memory and registers, et al. I failed at this.

Can someone please point my weary fingers and eyes to the right solution, or a set of suggestions about how I might proceed?