Skip to content

Commit

Permalink
Support for "STM32+Audio" v2-1 firmware (#790)
Browse files Browse the repository at this point in the history
* Add pid for "STM32+Audio" v2-1 firmware

* Add support for "STM32+Audio" v2-1 firmware,.

* Add udev rules for "STM32+Audio" firmware
  • Loading branch information
Azq2 authored and xor-gate committed Apr 13, 2019
1 parent 224f6ee commit feb8661
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
4 changes: 4 additions & 0 deletions etc/udev/rules.d/49-stlinkv2-1.rules
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
# ie, STM32F0, STM32F4.
# STM32VL has st/linkv1, which is quite different

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"
Expand Down
9 changes: 5 additions & 4 deletions include/stlink/usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
extern "C" {
#endif

#define STLINK_USB_VID_ST 0x0483
#define STLINK_USB_PID_STLINK 0x3744
#define STLINK_USB_PID_STLINK_32L 0x3748
#define STLINK_USB_PID_STLINK_NUCLEO 0x374b
#define STLINK_USB_VID_ST 0x0483
#define STLINK_USB_PID_STLINK 0x3744
#define STLINK_USB_PID_STLINK_32L 0x3748
#define STLINK_USB_PID_STLINK_32L_AUDIO 0x374a
#define STLINK_USB_PID_STLINK_NUCLEO 0x374b

#define STLINK_SG_SIZE 31
#define STLINK_CMD_SIZE 16
Expand Down
8 changes: 5 additions & 3 deletions src/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ stlink_t *stlink_open_usb(enum ugly_loglevel verbose, bool reset, char serial[16
}
}

if ((desc.idProduct == STLINK_USB_PID_STLINK_32L) || (desc.idProduct == STLINK_USB_PID_STLINK_NUCLEO)) {
if ((desc.idProduct == STLINK_USB_PID_STLINK_32L) || (desc.idProduct == STLINK_USB_PID_STLINK_NUCLEO) || (desc.idProduct == STLINK_USB_PID_STLINK_32L_AUDIO)) {
struct libusb_device_handle *handle;

ret = libusb_open(list[cnt], &handle);
Expand Down Expand Up @@ -901,7 +901,7 @@ stlink_t *stlink_open_usb(enum ugly_loglevel verbose, bool reset, char serial[16

// TODO - could use the scanning techniq from stm8 code here...
slu->ep_rep = 1 /* ep rep */ | LIBUSB_ENDPOINT_IN;
if (desc.idProduct == STLINK_USB_PID_STLINK_NUCLEO) {
if (desc.idProduct == STLINK_USB_PID_STLINK_NUCLEO || desc.idProduct == STLINK_USB_PID_STLINK_32L_AUDIO) {
slu->ep_req = 1 /* ep req */ | LIBUSB_ENDPOINT_OUT;
} else {
slu->ep_req = 2 /* ep req */ | LIBUSB_ENDPOINT_OUT;
Expand Down Expand Up @@ -973,6 +973,7 @@ static size_t stlink_probe_usb_devs(libusb_device **devs, stlink_t **sldevs[]) {
}

if (desc.idProduct != STLINK_USB_PID_STLINK_32L &&
desc.idProduct != STLINK_USB_PID_STLINK_32L_AUDIO &&
desc.idProduct != STLINK_USB_PID_STLINK_NUCLEO)
continue;

Expand All @@ -996,7 +997,8 @@ static size_t stlink_probe_usb_devs(libusb_device **devs, stlink_t **sldevs[]) {
break;
}

if (desc.idProduct != STLINK_USB_PID_STLINK_32L &&
if (desc.idProduct != STLINK_USB_PID_STLINK_32L &&
desc.idProduct != STLINK_USB_PID_STLINK_32L_AUDIO &&
desc.idProduct != STLINK_USB_PID_STLINK_NUCLEO)
continue;

Expand Down

0 comments on commit feb8661

Please sign in to comment.