ST-Link v2 프로그래머를 tty*로 나열하려고 합니다.
존재하다
OS: Arch Linux x86_64
Host: Inspiron 7580
Kernel: 5.5.2-arch1-1
장치를 연결하면 다음과 같은 출력이 생성됩니다.
journalctl -a
kernel: usb 1-1: new full-speed USB device number 31 using xhci_hcd
kernel: usb 1-1: New USB device found, idVendor=0483, idProduct=3748, bcdDevice= 1.00
kernel: usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
kernel: usb 1-1: Product: STM32 STLink
kernel: usb 1-1: Manufacturer: STMicroelectronics
kernel: usb 1-1: SerialNumber: SÿnReIBg
~을 위한
lsusb -v
Bus 001 Device 031: ID 0483:3748 STMicroelectronics ST-LINK/V2
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 64
idVendor 0x0483 STMicroelectronics
idProduct 0x3748 ST-LINK/V2
bcdDevice 1.00
iManufacturer 1 STMicroelectronics
iProduct 2 STM32 STLink
iSerial 3 SÿnReIBg
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0027
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 3
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 4 ST Link
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
can't get device qualifier: Resource temporarily unavailable
can't get debug descriptor: Resource temporarily unavailable
Device Status: 0x0000
(Bus Powered)
내 udev 규칙 idVendor=0483, idProduct=3748
은 다음과 같습니다 49-stlinkv2.rules
.
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3748", \
MODE:="0666", \
SYMLINK+="stlinkv2_%n"
이 장치는 이전에 Ubuntu에서 작동했습니다.
Nucleo-64 보드에 내장된 ST-Link는 ttyACM0
문제가 없는 것으로 표시됩니다. 작동 코어 보드의 출력:
journalctl -a
kernel: usb 1-1: new full-speed USB device number 32 using xhci_hcd
kernel: usb 1-1: New USB device found, idVendor=0483, idProduct=374b, bcdDevice= 1.00
kernel: usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
kernel: usb 1-1: Product: STM32 STLink
kernel: usb 1-1: Manufacturer: STMicroelectronics
kernel: usb 1-1: SerialNumber: 066DFF494849887767073715
kernel: usb-storage 1-1:1.1: USB Mass Storage device detected
kernel: scsi host1: usb-storage 1-1:1.1
kernel: cdc_acm 1-1:1.2: ttyACM0: USB ACM device
kernel: scsi 1:0:0:0: Direct-Access MBED microcontroller 1.0 PQ: 0 ANSI: 2
kernel: sd 1:0:0:0: [sda] 328 512-byte logical blocks: (168 kB/164 KiB)
kernel: sd 1:0:0:0: [sda] Write Protect is off
kernel: sd 1:0:0:0: [sda] Mode Sense: 03 00 00 00
kernel: sd 1:0:0:0: [sda] No Caching mode page found
kernel: sd 1:0:0:0: [sda] Assuming drive cache: write through
kernel: sd 1:0:0:0: [sda] Attached SCSI removable disk
lsusb -v
Bus 001 Device 032: ID 0483:374b STMicroelectronics ST-LINK/V2.1
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
idVendor 0x0483 STMicroelectronics
idProduct 0x374b ST-LINK/V2.1
bcdDevice 1.00
iManufacturer 1 STMicroelectronics
iProduct 2 STM32 STLink
iSerial 3 066DFF494849887767073715
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0080
bNumInterfaces 4
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 300mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 3
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 4 ST-Link Debug
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0020 1x 32 bytes
bInterval 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 8 Mass Storage
bInterfaceSubClass 6 SCSI
bInterfaceProtocol 80 Bulk-Only
iInterface 5 ST-Link mass storage
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Interface Association:
bLength 8
bDescriptorType 11
bFirstInterface 2
bInterfaceCount 2
bFunctionClass 2 Communications
bFunctionSubClass 2 Abstract (modem)
bFunctionProtocol 1 AT-commands (v.25ter)
iFunction 6 ST-Link VCP Ctrl
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 2
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 2 Communications
bInterfaceSubClass 2 Abstract (modem)
bInterfaceProtocol 1 AT-commands (v.25ter)
iInterface 6 ST-Link VCP Ctrl
CDC Header:
bcdCDC 1.10
CDC Call Management:
bmCapabilities 0x00
bDataInterface 3
CDC ACM:
bmCapabilities 0x06
sends break
line coding and serial state
CDC Union:
bMasterInterface 2
bSlaveInterface 3
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x84 EP 4 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0002 1x 2 bytes
bInterval 255
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 3
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 10 CDC Data
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 7 ST-Link VCP Data
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x05 EP 5 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x85 EP 5 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0010 1x 16 bytes
bInterval 0
can't get device qualifier: Resource temporarily unavailable
can't get debug descriptor: Resource temporarily unavailable
Device Status: 0x0000
(Bus Powered)
내 udev 규칙 idVendor=0483, idProduct=374b
은 다음과 같습니다 49-stlinkv2-1.rules
.
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374a", \
MODE:="0666", \
SYMLINK+="stlinkv2-1_%n"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374b", \
MODE:="0666", \
SYMLINK+="stlinkv2-1_%n"
답변1
작동 중인 장치가 다음과 같이 보고하는 것을 확인했습니다.
Bus 001 Device 032: ID 0483:374b STMicroelectronics ST-LINK/V2.1
그리고 문제 장치는 다음과 같이 보고됩니다.
Bus 001 Device 031: ID 0483:3748 STMicroelectronics ST-LINK/V2
이 PDF 2페이지의 ST-LINK 버전 개요를 참조하십시오.
Nucleo-64 보드에 내장된 ST-LINK는 ST-LINK/V2-1이며 여기에는 USB 대용량 저장 인터페이스 및 가상 COM 포트와 같은 추가 USB 인터페이스가 있습니다. 후자는 ttyACMn
Linux에서 장치로 나열됩니다.
기본 ST-LINK/V2(-1 접미사 없음)에는 가상 COM 포트가 없으므로 TTY 장치로 매핑할 것이 없습니다.
전원을 켜면 기본 ST-LINK/V2는 펌웨어 업그레이드 모드가 되며 STM8 또는 STM32 디버그 모드로 전환하려면 전용 명령이 필요합니다(로드된 펌웨어에 따라 다름). 반면, ST-LINK/V2-1 이상에서는 이미 실행 중인 펌웨어로 시작하고 펌웨어 업그레이드 모드로 전환하려면 전용 명령이 필요합니다.
이것stlink-tool
유용TTY 장치는 실제로 사용되지 않지만 원시 USB 명령이 사용됩니다. 를 사용하므로 libusb-1.0
이를 사용하려면 사용자 계정이 해당 원시 USB 장치 노드에 액세스할 수 있는지 stlink-tool
확인해야 합니다 . 명령이 장치를 로 보고하는 /dev/bus/usb/*/*
경우 올바른 장치 노드는 각각 입니다.lsusb
Bus 001 Device 031
/dev/bus/usb/001/031