Skip to main content
Visitor II
September 24, 2021
Question

How to do the pin connections for STM32L476RGT6U on PCB so that a program can be uploaded?

  • September 24, 2021
  • 10 replies
  • 4633 views

I'm trying to mount STM32L476RGT6U on pcb. I want to upload program using IDE to the controller on the pcb. Please advice me the suitable connection diagram to fullfill this particular requirement.​

    This topic has been closed for replies.

    10 replies

    Graduate II
    September 24, 2021

    For direct connect exist internal bootloader and around five usable buses (USB,UART,I2C,SPI...). Read bootloader docs.

    Simpler is use SWD interface for debug and load code. But here you need next hw to provide stlink IF.

    Diagram here is simple for basic designs two wires and gnd .

    Super User
    September 24, 2021

    Make it easy on yourself and use a standard connector used by the programmer of your choice.

    https://www.st.com/en/development-tools/stlink-v3mini.html#documentation

    0693W00000FAOVIQA5.png

    Visitor II
    September 24, 2021

    So what is it uses ? Like should I connect my pcb mounted MCU with this and thorough this to pc ? If so, what should be it's connection ? How STM32L476RGT6U should be connected to this ?

    Please help me a bit more on how to use it ?

    Or should I mount this ​stlink V3 mini on pcb itself with MCU ?

    Graduate II
    September 24, 2021

    The U parts are on ST boards, they are not retail parts.

    Perhaps you can review the part Data Sheet, and board schematics, for say NUCLEO, DISCO or EVAL series board, to get some idea what you're doing.

    The debug interface mainly needs connectivity of SWDIO and SWCLK pins, the NRST and SWO pins are also very helpful.

    >>Or should I mount this ​stlink V3 mini on pcb itself with MCU ?

    Most would use a header connector, and then a cable to the debug pod

    Super User
    September 24, 2021

    Put a 14-pin header on your board and connect the signals in the table to the relevant pins on your board. For example, T_SWO is the SWO of the target MCU, which is pin PB3 on your board. T_VCC should connect to the power rail on your board. Note that you will still need to provide the board power.

    Visitor II
    September 24, 2021

    Can you refer to any manual or material which can help me ?​

    Super User
    September 24, 2021
    If what I linked previously didn’t help, not sure I can do anything.
    Visitor II
    September 25, 2021

    0693W00000FAPaiQAH.jpg

    Graduate II
    September 25, 2021
    Visitor II
    September 27, 2021

    Is there any way I can use I2C to upload the program into MCU?

    Visitor II
    September 28, 2021

    Thanks, TDK. I have followed AN2606 (Page329/417, Table. 133) and understood the I2C connection procedure. I have modified the circuit, it would be very helpful if you kindly verify and let me know whether that is correct or not. As per your advice, I'll go for PCB fabrication.

    0693W00000FAbJ5QAL.jpg0693W00000FAbIgQAL.jpg

    Graduate II
    September 28, 2021

    Page 60 datasheet

    3.37.1 Serial wire JTAG debug port (SWJ-DP) The Arm® SWJ-DP interface is embedded, and is a combined JTAG and serial wire debug port that enables either a serial wire debug or a JTAG probe to be connected to the target. Debug is performed using 2 pins only instead of 5 required by the JTAG (JTAG pins could be re-use as GPIO with alternate function): the JTAG TMS and TCK pins are shared with SWDIO and SWCLK, respectively, and a specific sequence on the TMS pin is used to switch between JTAG-DP and SW-DP.

    Reply for your primary question how load to MCU is place pinheader to your schematics 4pin on your image : NRST , TMS(PA13) , GND, TCK(PA14)

    And you can use without complicated bootloders and uart. You connect this 4 wires to STLINKvx pinheader and programmer into USB.

    Visitor II
    September 29, 2021

    Hi,

    I have modified as per your suggestion please let me know if it is right or not. Here I have made the BOOT0 to GND because I am using JTAG. Will it work?

    0693W00000FAkrlQAD.jpg0693W00000FAktvQAD.jpg0693W00000FAkuAQAT.jpg

    Graduate II
    September 29, 2021
    If you don’t plan test system bootloader , then BOOT0 to GND , otherwise to GND over R 10k for example.
    When your code don’t plan use PA13,14 then SWD will work without NRST then you realy use GND and two wires.
    And no NRST isnt connected to TRST...
    Visitor II
    September 28, 2021

    If I use an ST-LINK V2, whose pins are as shown as follows.

    0693W00000FAiyeQAD.jpg 

    as per your suggestion, should I need to connect

    1. NRST (of MCU) to TRSR (ST-LINK V2)
    2. PA13 to TMS
    3. PA14 to TCK
    4. GND to GND

    Is it so ? Aksing you to get confirmation. If so, should I pulldown BOOT0 to the ground?

    In this way can I debug and upload the program to MCU?

    Graduate II
    September 29, 2021

    What Pin# on the MCU does pin 7 on the header go to? NJTRST (PB4?)

    Pin 10 here should be MCU NRST/NRESET

    If you expect your code to run when the board powers up, BOOT0 should be low

    Visitor II
    September 29, 2021

    0693W00000FApKbQAL.jpg0693W00000FApKlQAL.jpgYes, as per the reference manual TRST which is pin 7 on the header will go to PB4 (Pin 56 of STM32L476RGT6U).

    Pin 10 which is MCU RST on the header, will go to NRST (Pin 7 of STM32L476RGT6U).

    Ok! I got it, Boot0 will be lowered after the program is uploaded and ready to run. Isn't it?

    I have complied with all the changes you have told and attaching the schematic here. Can you please verify?

    NOTE: I've another doubt that, I have connected NRST with Pin 10 of ST-LINK V2 and is grounded as per the reference manual screenshot attached. So is it correct or not? Will, it (NRST & Pin 10 of Header) be grounded or not?