Difference between revisions of "Using J-Link VCOM functionality"

From SEGGER Wiki
Jump to: navigation, search
Line 2: Line 2:
   
   
In general, the VCOM feature can be disabled and enabled for debug probes which comes
+
In general, the Viurtual COM Port(VCOM) feature can be disabled and enabled for debug probes which comes
 
with support for it via J-Link Commander and J-Link Configurator.
 
with support for it via J-Link Commander and J-Link Configurator.
   
Line 14: Line 14:
 
A small description of how to enable VCOM functionality for J-Link can be found on page 218 of the [https://www.segger.com/downloads/jlink/UM08001 J-Link User Guide].
 
A small description of how to enable VCOM functionality for J-Link can be found on page 218 of the [https://www.segger.com/downloads/jlink/UM08001 J-Link User Guide].
   
  +
= Checking VCOM state =
== Disabling readout protection ==
 
   
  +
Checking if VCOM is active can be done by opening the device manager.
=== J-Link Commander and J-Flash ===
 
  +
-screenshot-
J-Link Commander and J-Flash automatically detect secured STM32 devices and ask the user if it should be unlocked. Further information regarding this can be found here: [[Secured_ST_device_detected]]
 
   
  +
= Checking VCOM functionality =
=== Flasher standalone mode ===
 
In order to unlock a STM32 device in stand-alone mode, the unlock sequence needs to be configured in the init steps of the J-Flash project (see examples in the table below).
 
   
  +
The VCOM functionality can be tested for by simply connecting the Tx pin with the Rx pin - creating a loopback that way - and starting a terminal application.
=== Restoring factory defaults ===
 
  +
This leads to the Rx pin receiving the sent data meaning that VCOM is active and working.
The standalone software tool STM32 Unlock can be used to reset the Option Bytes of a STM32 device to factory default settings.
 
STM32 Unlock is part of the [https://www.segger.com/jlink-software.html J-Link software & documentation pack].
 
   
== Enabling readout protection ==
+
== Checking VCOM speed ==
   
  +
The speed at which VCOM is operating at can be checked by using an oscilloscope to measure the Tx signal.
All provided J-Link Commander command files and J-Flash projects set the read out protection to level 1 (ROP == Level 1).
 
  +
This can be easily done by sending the letter 'U', as it translates to 01010101 in binary, creating a regular square-wave signal.
In order to set ROP Level 2, the value "0xBB" needs to be changed to "0xCC" where indicated in the command file / Exit steps of the J-Flash project.
 
Please note that ROP Level 2 is permanent and can neither be reverted by SEGGER nor by ST.
 
 
{| class="wikitable"
 
|+STM32 series overview
 
! Sub-Family
 
! Core
 
! J-Link Commander and J-Flash:<br> native Unlock support
 
! J-Link Commander:<br> Lock via commanderfile
 
! STM32 Unlock tool support
 
! J-Flash:<br> Unlock project
 
! J-Flash<ref>For further information regarding native support in J-Flash and why native support is no longer implemented for new devices, please refer to this article: [[MCU_Security_Options]]</ref>:<br> native lock support
 
! J-Flash:<br> Lock project
 
|-
 
|STM32F0
 
|Cortex-M0
 
|scope="col" style="text-align:center" | [[File:YES.png|20px|link=]]
 
|[[:Media:STM32F0_Lock.jlink | STM32F0_Lock.jlink]]
 
|scope="col" style="text-align:center" | [[File:YES.png|20px|link=]]
 
|[[:Media:STM32F0_Unlock.jflash|STM32F0_Unlock.jflash]]
 
|scope="col" style="text-align:center" | [[File:YES.png|20px|link=]]
 
|[[:Media:STM32F0_Lock.jflash|STM32F0_Lock.jflash]]
 
|-
 
|STM32F1
 
|Cortex-M3
 
|scope="col" style="text-align:center" | [[File:YES.png|20px|link=]]
 
|[[:Media:STM32F1_Lock.jlink|STM32F1_Lock.jlink]]
 
|scope="col" style="text-align:center" | [[File:YES.png|20px|link=]]
 
|[[:Media:STM32F1_Unlock.jflash|STM32F1_Unlock.jflash]]
 
|scope="col" style="text-align:center" | [[File:YES.png|20px|link=]]
 
|[[:Media:STM32F1_Lock.jflash|STM32F1_Lock.jflash]]
 
|-
 
|STM32F2
 
|Cortex-M3
 
|scope="col" style="text-align:center" | [[File:YES.png|20px|link=]]
 
|[[:Media:STM32F2_Lock.jlink|STM32F2_Lock.jlink]]
 
|scope="col" style="text-align:center" | [[File:YES.png|20px|link=]]
 
|[[:Media:STM32F2_Unlock.jflash|STM32F2_Unlock.jflash]]
 
|scope="col" style="text-align:center" | [[File:YES.png|20px|link=]]
 
|[[:Media:STM32F2_Lock.jflash|STM32F2_Lock.jflash]]
 
|-
 
|STM32F3
 
|Cortex-M4
 
|scope="col" style="text-align:center" | [[File:YES.png|20px|link=]]
 
|[[:Media:STM32F3_Lock.jlink|STM32F3_Lock.jlink]]
 
|scope="col" style="text-align:center" | [[File:YES.png|20px|link=]]
 
|[[:Media:STM32F3_Unlock.jflash|STM32F3_Unlock.jflash]]
 
|scope="col" style="text-align:center" | [[File:YES.png|20px|link=]]
 
|[[:Media:STM32F3_Lock.jflash|STM32F3_Lock.jflash]]
 
|-
 
|[[STM32F4]]
 
|Cortex-M4
 
|scope="col" style="text-align:center" | [[File:YES.png|20px|link=]]
 
|[[:Media:STM32F4_Lock.jlink|STM32F4_Lock.jlink]]
 
|scope="col" style="text-align:center" | [[File:YES.png|20px|link=]]
 
|[[:Media:STM32F4_Unlock.jflash|STM32F4_Unlock.jflash]]
 
|scope="col" style="text-align:center" | [[File:YES.png|20px|link=]]
 
|[[:Media:STM32F4_Lock.jflash|STM32F4_Lock.jflash]]
 
|-
 
|[[STM32F7]]
 
|Cortex-M7
 
|scope="col" style="text-align:center" | [[File:YES.png|20px|link=]]
 
|[[:Media:STM32F7_Lock.jlink|STM32F7_Lock.jlink]]
 
|scope="col" style="text-align:center" | [[File:YES.png|20px|link=]]
 
|[[:Media:STM32F7_Unlock.jflash|STM32F7_Unlock.jflash]]
 
|scope="col" style="text-align:center" | [[File:NO.png|20px|link=]]
 
|[[:Media:STM32F7_Lock.jflash|STM32F7_Lock.jflash]]
 
|-
 
|STM32H7
 
|Cortex-M7
 
|N/A
 
|N/A
 
|scope="col" style="text-align:center" | [[File:NO.png|20px|link=]]
 
|N/A
 
|scope="col" style="text-align:center" | [[File:NO.png|20px|link=]]
 
|N/A
 
|-
 
|STM32L0
 
|Cortex-M0
 
|scope="col" style="text-align:center" | [[File:YES.png|20px|link=]]
 
|[[:Media:STM32L0_Lock.jlink|STM32L0_Lock.jlink]]
 
|scope="col" style="text-align:center" | [[File:YES.png|20px|link=]]
 
|[[:Media:STM32L0_Unlock.jflash|STM32L0_Unlock.jflash]]
 
|scope="col" style="text-align:center" | [[File:YES.png|20px|link=]]
 
|[[:Media:STM32L0_Lock.jflash|STM32L0_Lock.jflash]]
 
|-
 
|STM32L1
 
|Cortex-M3
 
|scope="col" style="text-align:center" | [[File:YES.png|20px|link=]]
 
|[[:Media:STM32L1_Lock.jlink|STM32L1_Lock.jlink]]
 
|scope="col" style="text-align:center" | [[File:YES.png|20px|link=]]
 
|[[:Media:STM32L1_Unlock.jflash|STM32L1_Unlock.jflash]]
 
|scope="col" style="text-align:center" | [[File:YES.png|20px|link=]]
 
|[[:Media:STM32L1_Lock.jflash|STM32L1_Lock.jflash]]
 
|-
 
|[[STM32L4]]
 
|Cortex-M4
 
|scope="col" style="text-align:center" | [[File:YES.png|20px|link=]]
 
|[[:Media:STM32L4_Lock.jlink|STM32L4_Lock.jlink]]
 
|scope="col" style="text-align:center" | [[File:YES.png|20px|link=]]
 
|[[:Media:STM32L4_Unlock.jflash|STM32L4_Unlock.jflash]]
 
|scope="col" style="text-align:center" | [[File:NO.png|20px|link=]]
 
|[[:Media:STM32L4_Lock.jflash|STM32L4_Lock.jflash]]
 
|}
 
 
All command files and J-Flash projects have a specific MCU selected.
 
For the sole purpose of locking the device via J-Link commander changing of the device name is not necessary,
 
<!-- See http://forum.segger.com/index.php?page=Thread&threadID=4150 -->
 
'''but it is mandatory to change the device name to the actual device used when using J-Flash or doing any flash programming in J-Link commander.'''
 
 
Please note that securing a device via J-Link command files is limited in a way that interpretation of return values,
 
if / else branches etc. are not available. Therefore, production programming and securing of devices can only be done with
 
J-Flash or the J-Link SDK.
 
In any case, it is the responsibility of the user to verify that the required read out protection is active before the programming device leaves the production facility.
 
   
 
<references/>
 
<references/>

Revision as of 16:22, 24 November 2017


In general, the Viurtual COM Port(VCOM) feature can be disabled and enabled for debug probes which comes with support for it via J-Link Commander and J-Link Configurator.

Note that VCOM can only be used when debugging via SWD target interface. Pin 5 = J-Link-Tx (out), Pin 17 = J-Link-Rx (in). Currently, only J-Link models with hardware version 9 or newer come with VCOM capabilities.

Enabling VCOM

A small description of how to enable VCOM functionality for J-Link can be found on page 218 of the J-Link User Guide.

Checking VCOM state

Checking if VCOM is active can be done by opening the device manager. -screenshot-

Checking VCOM functionality

The VCOM functionality can be tested for by simply connecting the Tx pin with the Rx pin - creating a loopback that way - and starting a terminal application. This leads to the Rx pin receiving the sent data meaning that VCOM is active and working.

Checking VCOM speed

The speed at which VCOM is operating at can be checked by using an oscilloscope to measure the Tx signal. This can be easily done by sending the letter 'U', as it translates to 01010101 in binary, creating a regular square-wave signal.