cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L031 program does not run.

Mads Enevoldsen
Associate II
Posted on February 28, 2017 at 16:22

1:

I have developed a small program for the STM32L031 Nucleo-32 using the example UART_TwoBoards_ComIT. The program run on the STM32L031 Nucleo-32 develop-board. When I load* the program to our own HW it does not start, I have tried with and without the compiler directive USE_STM32L0XX_NUCLEO_32. I suspect the system clock generation, but can’t find where it is setup.

*I load the program using STM flash_loader_demo_v2.8.0.

2:

I want to use the ST-LINK V2 for debug should the data port be connected to PA13?

Do any have a hint or comments that could help me?

-Mads

1 ACCEPTED SOLUTION

Accepted Solutions
Posted on March 02, 2017 at 08:48

Hi Clive

FYI

1: I forced the program to use the HSE clock now it works.

2 The TDO_SWO is optional now the bugger also works.

Problems solved!

-Mads

View solution in original post

6 REPLIES 6
Posted on February 28, 2017 at 16:36

You would need to connect both SWDIO (PA13) and SWCLK (PA14), VCC and GND would also need connections to the ST-LINK. The connection of NRST would also be desirable.

Make sure BOOT0 pin is pulled low to execute your code.

Then use a debugger to understand what is happening, or GPIO/USART signalling

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Max
ST Employee
Posted on March 01, 2017 at 05:45

There is already a STLink V2-1 embeded on the 

STM32L031 Nucleo-32 (on the bottom side of the PCB) and it is already properly connected unless you (removed some 0 Ohms resistors).

Check

http://www.st.com/content/ccc/resource/technical/document/user_manual/1b/03/1b/b4/88/20/4e/cd/DM00105928.pdf/files/DM00105928.pdf/jcr:content/translations/en.DM00105928.pdf

and

http://www.st.com/content/ccc/resource/technical/document/user_manual/e3/0e/88/05/e8/74/43/a0/DM00231744.pdf/files/DM00231744.pdf/jcr:content/translations/en.DM00231744.pdf

, you will get a lot of useful information
Posted on March 01, 2017 at 05:56

>>

When I load* the program to our own HW it does not start

Emphasis mine, the OP is discussing two situations, a working Nucleo, and a non-working custom board needing connectivity to an ST-LINK to debug the situation.

The Nucleo will have an 8 MHz clock source feed from the onboard ST-LINK. This is likely not present on the custom board, so BYPASS mode won't work, and HSE must start succesfully. Settings in SystemInit() need review.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on March 01, 2017 at 10:13

Hi Clive

I understand I can't use the SWIM connector, but what about TDO_SWO connection?

ST-LINK/V2

connector

(CN3)

ST-LINK/V2 function

Target connection

(JTAG)

Target connection

(SWD)

STM32L031

1,2

VAPP

Target VCC

MCU VDD(1)

MCU VDD(1)

VDD

3

TRST

JTAG TRST

JNTRST

GND(2)

GND

4

GND

GND

GND(3)

GND(3)

GND

5

TDI

JTAG TDO

JTDI

GND(3)

GND

6

GND

GND

GND(3)

GND(3)

GND

7

TMS_SWDIO

JTAG TMS, SW IO

JTMS

SWDIO

PA13

8

GND

GND

GND(3)

GND(3)

GND

9

TCK_SWCLK

JTAG TCK, SW CLK

JTCK

SWCLK

PA14

10

GND

GND

GND(3)

GND(3)

GND

11

NC

Not connected

Not connected

Not connected

NC

12

GND

GND

GND(3)

GND(3)

GND

13

TDO_SWO

JTAG TDI, SWO

JTDO

TRACESWO(4)

?

14

GND

GND

GND(3)

GND(3)

GND

15

NRST

NRST

NRST

NRST

NRST

16

GND

GND

GND(3)

GND(3)

GND

17

NC

Not connected

Not connected

Not connected

NC

18

GND

GND

GND(3)

GND(3)

GND

19

VDD

VDD (3.3V) (5)

Not connected

Not connected

NC

20

GND

GND

GND(3)

GND(3)

GND

-Mads

Posted on March 01, 2017 at 16:37

The Cortex-M0+ is supposedly able to support SWV via SWO, haven't verified myself, doesn't work on Cortex-M0 parts

If you need telemetry via the SWV (Serial Wire Viewer) you could experiment.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on March 02, 2017 at 08:48

Hi Clive

FYI

1: I forced the program to use the HSE clock now it works.

2 The TDO_SWO is optional now the bugger also works.

Problems solved!

-Mads