Posted on Leave a comment

How to use the ST-LINK/V2-1 in STM32L476G-DISCO Board to program the STM32 on an external application board

Here is the video showing all the steps.

ST-Link V2-1 on STM32L476G-Disco Board

To use the ST-LINK/V2-1 to program the STM32 on an external application board (out of the STM32L476VGT6 onboard), remove the two jumpers from CN3 as shown in the above figure in red, and connect the board to the CN4 software debug connector according to Table.
Make sure the jumpers JP6.3V3, and JP5.OFF are set.
JP3, must be ON if CN4 pin 5 (NRST) is used in the external application board.

PinCN4 FunctionJTAG PIN NumberJTAG NameNote
1VappVDD from ApplicationDo not Connect Vapp to JTAG.
2SWCLKSWD Clock9TCK
3GNDGround1 to 9GND
4SWDIOSWD data input/output7TMS
5NRSTRESET of target MCU15nSRST
6SWORESERVED

Note: Do not connect Vapp to JTAG on the external board unless you know about the power domain of the external board.
Power the board separately.

You can use STM32CubeProgrammer to read the memory and also write the hex file into the microcontroller.

Here I am using mini stm32 v3.0 as an example.

The mini stm32 v3.0 has an STM32F103RB microcontroller along with a JTAG interface for programming and debugging.

Posted on 1 Comment

How to start a project for STM32L476 Discovery in STM32 Cube IDE

Download the STM32 Cube IDE from https://www.st.com/en/development-tools/stm32cubeide.html

Watch this video tutorial.

Write a program using STM32L476G-DISCO

Step1: Install STM32 Cube IDE

Step2: Create a New Workspace
A workspace is a directory which will contain all your code and library related to your project.

Step 3: click on “Start new STM32 Project” button

Step 4: Select your board “stm32l476G-DISCO”

Step 5: Give your project a name
Do not change any options

Step 6: Select “YES” when prompted for “Initialze all peripheral with their default mode”
It is very important that you select YES other wise it will remove all the associated peripherals and you have to manually add the desired peripherals one by one; which is very difficult for beginners.

After these steps your project is created and it will open a STM32 CUBEMX inside your IDE.

Please watch the video. As there are a lots of steps and instruction which are difficult to explain by writing alone. Video will show you a step by step procedure and give you a basic explainition.

You can now change the option or you can proceed forward and click on generate code. This will create all the required code changes.

Now you can open you “main.c” file inside your IDE and write code.

Posted on Leave a comment

Overview of STM32L476 Discovery Kit

This development board from STMicroelectronics has different peripherals such as an LCD screen, MEMS sensor, USB OTG, Microphone and a 16 MegaByte memory.

It has a cr2032 battery socket on the back. So you can use a 3-volt cr2032 battery to power this board. But for that, you have to change the jumper from 3v3 to batt.

Here is a video providing overview of the stm32l476 discovery kit.