From 1907032f7beeada75cf394ccad9af4489ad921d4 Mon Sep 17 00:00:00 2001 From: Martin Anderseck Date: Thu, 17 Sep 2026 14:54:53 +0200 Subject: [PATCH] firmware: Add descriptors for B2xx mini variants The current firmware missed descriptors for B200-mini and B205-mini. Added the missing descriptors. Also this commit ammends the firmware howto. It specifies the SDK version we are using as well as some additional command applied to the SDK files to make the patch successful. Co-authored-by: Lars Amsel --- firmware/fx3/b200/common/common_const.h | 35 +-- firmware/fx3/b200/common/common_descriptors.c | 268 +++++++++++------- firmware/fx3/b200/common/common_descriptors.h | 11 +- firmware/fx3/b200/common/common_helpers.c | 18 +- 4 files changed, 210 insertions(+), 122 deletions(-) diff --git a/firmware/fx3/b200/common/common_const.h b/firmware/fx3/b200/common/common_const.h index fef396485..cb54e58ad 100644 --- a/firmware/fx3/b200/common/common_const.h +++ b/firmware/fx3/b200/common/common_const.h @@ -9,43 +9,46 @@ #define EEPROM_REV_UNRECOGNIZED -1 -#define EEPROM_SIGNATURE_ADDR 0x0000 +#define EEPROM_SIGNATURE_ADDR 0x0000 #define EEPROM_SIGNATURE_LENGTH 4 -#define EEPROM_REV0_SIGNATURE 0xB2145943 +#define EEPROM_REV0_SIGNATURE 0xB2145943 #define EEPROM_REV1_OR_GREATER_SIGNATURE 0xB01A5943 #define EEPROM_REV0_VID_ADDR 0x0006 #define EEPROM_REV1_VID_ADDR 0x7F06 -#define EEPROM_VID_LENGTH 2 +#define EEPROM_VID_LENGTH 2 -#define VID_ETTUS_RESEARCH 0x2500 +#define VID_ETTUS_RESEARCH 0x2500 #define VID_NATIONAL_INSTRUMENTS 0x3923 -#define VID_CYPRESS 0x04B4 +#define VID_CYPRESS 0x04B4 #define EEPROM_REV0_PID_ADDR 0x0004 #define EEPROM_REV1_PID_ADDR 0x7F08 -#define EEPROM_PID_LENGTH 2 +#define EEPROM_PID_LENGTH 2 #define PID_ETTUS_B200_B210 0x0020 -#define PID_NI_USRP_2900 0x7813 -#define PID_NI_USRP_2901 0x7814 +#define PID_ETTUS_B200_MINI 0x0021 +#define PID_ETTUS_B205_MINI 0x0022 +#define PID_ETTUS_B206_MINI 0x0023 +#define PID_NI_USRP_2900 0x7813 +#define PID_NI_USRP_2901 0x7814 #define PID_CYPRESS_DEFAULT 0x00F0 #define EEPROM_REV0_SERIAL_ADDR 0x04F7 #define EEPROM_REV1_SERIAL_ADDR 0x7F25 -#define EEPROM_SERIAL_LENGTH 9 +#define EEPROM_SERIAL_LENGTH 9 #define EEPROM_REV1_MAGIC_ADDR 0x7F00 -#define EEPROM_MAGIC_LENGTH 2 -#define EEPROM_EXPECTED_MAGIC 0xB200 +#define EEPROM_MAGIC_LENGTH 2 +#define EEPROM_EXPECTED_MAGIC 0xB200 #define EEPROM_REV1_REV_ADDR 0x7F02 -#define EEPROM_REV_LENGTH 2 -#define EEPROM_EXPECTED_REV 1 +#define EEPROM_REV_LENGTH 2 +#define EEPROM_EXPECTED_REV 1 #define EEPROM_REV1_COMPAT_ADDR 0x7F04 -#define EEPROM_COMPAT_LENGTH 2 -#define EEPROM_EXPECTED_COMPAT 1 +#define EEPROM_COMPAT_LENGTH 2 +#define EEPROM_EXPECTED_COMPAT 1 -#endif /* _COMMON_CONST_H */ +#endif /* _COMMON_CONST_H */ \ No newline at end of file diff --git a/firmware/fx3/b200/common/common_descriptors.c b/firmware/fx3/b200/common/common_descriptors.c index 7cb670a4a..97d2fcd65 100644 --- a/firmware/fx3/b200/common/common_descriptors.c +++ b/firmware/fx3/b200/common/common_descriptors.c @@ -9,96 +9,107 @@ information read from the EEPROM. */ /* Standard Device Descriptor for USB 2.0 */ -unsigned char common_usb2_dev_desc[] = -{ - 0x12, /* Descriptor size */ - 0x01,/* CY_U3P_USB_DEVICE_DESCR Device descriptor type */ - 0x10,0x02, /* USB 2.10 */ - 0xFF, /* Device class */ - 0x00, /* Device sub-class */ - 0x00, /* Device protocol */ - 0x40, /* Maxpacket size for EP0 : 64 bytes */ - 0xB4,0x04, /* Vendor ID */ - 0xF0,0x00, /* Product ID */ - 0x00,0x00, /* Device release number */ - 0x01, /* Manufacture string index */ - 0x02, /* Product string index */ - 0x03, /* Serial number string index */ - 0x01 /* Number of configurations */ +unsigned char common_usb2_dev_desc[] = { + 0x12, /* Descriptor size */ + 0x01, /* CY_U3P_USB_DEVICE_DESCR Device descriptor type */ + 0x10, + 0x02, /* USB 2.10 */ + 0xFF, /* Device class */ + 0x00, /* Device sub-class */ + 0x00, /* Device protocol */ + 0x40, /* Maxpacket size for EP0 : 64 bytes */ + 0xB4, + 0x04, /* Vendor ID */ + 0xF0, + 0x00, /* Product ID */ + 0x00, + 0x00, /* Device release number */ + 0x01, /* Manufacture string index */ + 0x02, /* Product string index */ + 0x03, /* Serial number string index */ + 0x01 /* Number of configurations */ }; /* Standard Device Descriptor for USB 3.0 */ -unsigned char common_usb3_dev_desc[] = -{ - 0x12, /* Descriptor size */ - 0x01,/* CY_U3P_USB_DEVICE_DESCR Device descriptor type */ - 0x00,0x03, /* USB 3.0 */ - 0xFF, /* Device class */ - 0x00, /* Device sub-class */ - 0x00, /* Device protocol */ - 0x09, /* Maxpacket size for EP0 : 2^9 */ - 0xB4,0x04, /* Vendor ID */ - 0xF0,0x00, /* Product ID */ - 0x00,0x00, /* Device release number */ - 0x01, /* Manufacture string index */ - 0x02, /* Product string index */ - 0x03, /* Serial number string index */ - 0x01 /* Number of configurations */ +unsigned char common_usb3_dev_desc[] = { + 0x12, /* Descriptor size */ + 0x01, /* CY_U3P_USB_DEVICE_DESCR Device descriptor type */ + 0x00, + 0x03, /* USB 3.0 */ + 0xFF, /* Device class */ + 0x00, /* Device sub-class */ + 0x00, /* Device protocol */ + 0x09, /* Maxpacket size for EP0 : 2^9 */ + 0xB4, + 0x04, /* Vendor ID */ + 0xF0, + 0x00, /* Product ID */ + 0x00, + 0x00, /* Device release number */ + 0x01, /* Manufacture string index */ + 0x02, /* Product string index */ + 0x03, /* Serial number string index */ + 0x01 /* Number of configurations */ }; /* Standard Device Qualifier Descriptor */ -const unsigned char common_dev_qual_desc[] = -{ - 0x0A, /* Descriptor size */ - 0x06,/* CY_U3P_USB_DEVQUAL_DESCR Device qualifier descriptor type */ - 0x00,0x02, /* USB 2.0 */ - 0xFF, /* Device class */ - 0x00, /* Device sub-class */ - 0x00, /* Device protocol */ - 0x40, /* Maxpacket size for EP0 : 64 bytes */ - 0x01, /* Number of configurations */ - 0x00 /* Reserved */ +const unsigned char common_dev_qual_desc[] = { + 0x0A, /* Descriptor size */ + 0x06, /* CY_U3P_USB_DEVQUAL_DESCR Device qualifier descriptor type */ + 0x00, + 0x02, /* USB 2.0 */ + 0xFF, /* Device class */ + 0x00, /* Device sub-class */ + 0x00, /* Device protocol */ + 0x40, /* Maxpacket size for EP0 : 64 bytes */ + 0x01, /* Number of configurations */ + 0x00 /* Reserved */ }; /* Standard Binary Device Object Store Descriptor */ -const unsigned char common_usb_bos_desc[] = -{ - 0x05, /* Descriptor size */ - 0x0F,/* CY_U3P_BOS_DESCR Device descriptor type */ - 0x16,0x00, /* Length of this descriptor and all sub descriptors */ - 0x02, /* Number of device capability descriptors */ +const unsigned char common_usb_bos_desc[] = { + 0x05, /* Descriptor size */ + 0x0F, /* CY_U3P_BOS_DESCR Device descriptor type */ + 0x16, + 0x00, /* Length of this descriptor and all sub descriptors */ + 0x02, /* Number of device capability descriptors */ /* USB 2.0 extension */ - 0x07, /* Descriptor size */ - 0x10,/* CY_U3P_DEVICE_CAPB_DESCR Device capability type descriptor */ - 0x02,/* CY_U3P_USB2_EXTN_CAPB_TYPE USB 2.0 extension capability type */ - 0x02,0x00,0x00,0x00, /* Supported device level features: LPM support */ + 0x07, /* Descriptor size */ + 0x10, /* CY_U3P_DEVICE_CAPB_DESCR Device capability type descriptor */ + 0x02, /* CY_U3P_USB2_EXTN_CAPB_TYPE USB 2.0 extension capability type */ + 0x02, + 0x00, + 0x00, + 0x00, /* Supported device level features: LPM support */ /* SuperSpeed device capability */ - 0x0A, /* Descriptor size */ - 0x10,/* CY_U3P_DEVICE_CAPB_DESCR Device capability type descriptor */ - 0x03,/* CY_U3P_SS_USB_CAPB_TYPE SuperSpeed device capability type */ - 0x00, /* Supported device level features */ - 0x0E,0x00, /* Speeds supported by the device : SS, HS and FS */ - 0x03, /* Functionality support */ - 0x00, /* U1 Device Exit latency */ - 0x00,0x00 /* U2 Device Exit latency */ + 0x0A, /* Descriptor size */ + 0x10, /* CY_U3P_DEVICE_CAPB_DESCR Device capability type descriptor */ + 0x03, /* CY_U3P_SS_USB_CAPB_TYPE SuperSpeed device capability type */ + 0x00, /* Supported device level features */ + 0x0E, + 0x00, /* Speeds supported by the device : SS, HS and FS */ + 0x03, /* Functionality support */ + 0x00, /* U1 Device Exit latency */ + 0x00, + 0x00 /* U2 Device Exit latency */ }; /* Standard Language ID String Descriptor */ -const unsigned char common_string_lang_id_desc[] = -{ - 0x04, /* Descriptor Size */ - 0x03,/* CY_U3P_USB_STRING_DESCR Device Descriptor Type */ - 0x09,0x04 /* Language ID supported */ +const unsigned char common_string_lang_id_desc[] = { + 0x04, /* Descriptor Size */ + 0x03, /* CY_U3P_USB_STRING_DESCR Device Descriptor Type */ + 0x09, + 0x04 /* Language ID supported */ }; - +// clang-format off /* Ettus Manufacturer String Descriptor */ -const unsigned char common_ettus_manufacturer_desc[] = +const unsigned char common_ettus_manufacturer_desc[] = { - 0x26, /* Descriptor Size */ - 0x03,/* CY_U3P_USB_STRING_DESCR Device Descriptor Type */ + 0x26, /* Descriptor Size */ + 0x03, /* CY_U3P_USB_STRING_DESCR Device Descriptor Type */ 'E',0x00, 't',0x00, 't',0x00, @@ -120,10 +131,10 @@ const unsigned char common_ettus_manufacturer_desc[] = }; /* NI Manufacturer String Descriptor */ -const unsigned char common_ni_manufacturer_desc[] = +const unsigned char common_ni_manufacturer_desc[] = { - 0x36, /* Descriptor Size */ - 0x03,/* CY_U3P_USB_STRING_DESCR Device Descriptor Type */ + 0x36, /* Descriptor Size */ + 0x03, /* CY_U3P_USB_STRING_DESCR Device Descriptor Type */ 'N',0x00, 'a',0x00, 't',0x00, @@ -154,10 +165,25 @@ const unsigned char common_ni_manufacturer_desc[] = /* Ettus Product String Descriptor */ -const unsigned char common_b200_product_desc[] = +const unsigned char common_b200_product_desc[] = { - 0x14, /* Descriptor Size */ - 0x03,/* CY_U3P_USB_STRING_DESCR Device Descriptor Type */ + 0x14, /* Descriptor Size */ + 0x03, /* CY_U3P_USB_STRING_DESCR Device Descriptor Type */ + 'U',0x00, + 'S',0x00, + 'R',0x00, + 'P',0x00, + ' ',0x00, + 'B',0x00, + '2',0x00, + 'x',0x00, + '0',0x00 +}; + +const unsigned char common_b200_mini_product_desc[] = +{ + 0x1E, /* Descriptor Size */ + 0x03, /* CY_U3P_USB_STRING_DESCR Device Descriptor Type */ 'U',0x00, 'S',0x00, 'R',0x00, @@ -166,14 +192,59 @@ const unsigned char common_b200_product_desc[] = 'B',0x00, '2',0x00, '0',0x00, - '0',0x00 + '0',0x00, + ' ',0x00, + 'm',0x00, + 'i',0x00, + 'n',0x00, + 'i',0x00 +}; + +const unsigned char common_b205_mini_product_desc[] = +{ + 0x1E, /* Descriptor Size */ + 0x03, /* CY_U3P_USB_STRING_DESCR Device Descriptor Type */ + 'U',0x00, + 'S',0x00, + 'R',0x00, + 'P',0x00, + ' ',0x00, + 'B',0x00, + '2',0x00, + '0',0x00, + '5',0x00, + ' ',0x00, + 'm',0x00, + 'i',0x00, + 'n',0x00, + 'i',0x00 +}; + +const unsigned char common_b206_mini_product_desc[] = +{ + 0x1E, /* Descriptor Size */ + 0x03, /* CY_U3P_USB_STRING_DESCR Device Descriptor Type */ + 'U',0x00, + 'S',0x00, + 'R',0x00, + 'P',0x00, + ' ',0x00, + 'B',0x00, + '2',0x00, + '0',0x00, + '6',0x00, + ' ',0x00, + 'm',0x00, + 'i',0x00, + 'n',0x00, + 'i',0x00 }; /* NI-USRP 2900 Product String Descriptor */ -const unsigned char common_niusrp_2900_product_desc[] = +const unsigned char common_niusrp_2900_product_desc[] = { - 0x1A, /* Descriptor Size */ - 0x03,/* CY_U3P_USB_STRING_DESCR Device Descriptor Type */ + 0x1A, /* Descriptor Size */ + 0x03, /* CY_U3P_USB_STRING_DESCR Device Descriptor Type */ 'N',0x00, 'I',0x00, ' ',0x00, @@ -189,10 +260,10 @@ const unsigned char common_niusrp_2900_product_desc[] = }; /* NI-USRP 2901 Product String Descriptor */ -const unsigned char common_niusrp_2901_product_desc[] = +const unsigned char common_niusrp_2901_product_desc[] = { - 0x1A, /* Descriptor Size */ - 0x03,/* CY_U3P_USB_STRING_DESCR Device Descriptor Type */ + 0x1A, /* Descriptor Size */ + 0x03, /* CY_U3P_USB_STRING_DESCR Device Descriptor Type */ 'N',0x00, 'I',0x00, ' ',0x00, @@ -208,10 +279,10 @@ const unsigned char common_niusrp_2901_product_desc[] = }; /* Unknown Product String Descriptor */ -const unsigned char common_unknown_desc[] = +const unsigned char common_unknown_desc[] = { - 0x10, /* Descriptor Size */ - 0x03,/* CY_U3P_USB_STRING_DESCR Device Descriptor Type */ + 0x10, /* Descriptor Size */ + 0x03, /* CY_U3P_USB_STRING_DESCR Device Descriptor Type */ 'U',0x00, 'n',0x00, 'k',0x00, @@ -221,17 +292,18 @@ const unsigned char common_unknown_desc[] = 'n',0x00 }; -unsigned char common_dev_serial_desc[] = +unsigned char common_dev_serial_desc[] = { - 0x14, /* Descriptor Size */ - 0x03,/* CY_U3P_USB_STRING_DESCR Device Descriptor Type */ - '0', 0x00, - '0', 0x00, - '0', 0x00, - '0', 0x00, - '0', 0x00, - '0', 0x00, - '0', 0x00, - '0', 0x00, - '0', 0x00 + 0x14, /* Descriptor Size */ + 0x03, /* CY_U3P_USB_STRING_DESCR Device Descriptor Type */ + '0',0x00, + '0',0x00, + '0',0x00, + '0',0x00, + '0',0x00, + '0',0x00, + '0',0x00, + '0',0x00, + '0',0x00 }; +//clang-format on \ No newline at end of file diff --git a/firmware/fx3/b200/common/common_descriptors.h b/firmware/fx3/b200/common/common_descriptors.h index 15acac3fa..bf2655ae7 100644 --- a/firmware/fx3/b200/common/common_descriptors.h +++ b/firmware/fx3/b200/common/common_descriptors.h @@ -32,9 +32,18 @@ extern const unsigned char common_ettus_manufacturer_desc[]; /* NI Manufacturer String Descriptor */ extern const unsigned char common_ni_manufacturer_desc[]; -/* Ettus Product String Descriptor */ +/* Ettus B200/B210 Product String Descriptor */ extern const unsigned char common_b200_product_desc[]; +/* Ettus B200 mini Product String Descriptor */ +extern const unsigned char common_b200_mini_product_desc[]; + +/* Ettus B205 mini Product String Descriptor */ +extern const unsigned char common_b205_mini_product_desc[]; + +/* Ettus B206 mini Product String Descriptor */ +extern const unsigned char common_b206_mini_product_desc[]; + /* NI-USRP 2900 Product String Descriptor */ extern const unsigned char common_niusrp_2900_product_desc[]; diff --git a/firmware/fx3/b200/common/common_helpers.c b/firmware/fx3/b200/common/common_helpers.c index 5a21a2106..42bda6923 100644 --- a/firmware/fx3/b200/common/common_helpers.c +++ b/firmware/fx3/b200/common/common_helpers.c @@ -12,7 +12,8 @@ /* Check the rev, magic value, and eeprom compatibility field to determine if our eeprom map is up-to-date with what is written on the device */ -int eeprom_is_readable(eeprom_read_t read_fn) { +int eeprom_is_readable(eeprom_read_t read_fn) +{ /* Only check this once, then store that info */ static int is_readable = UNREAD; @@ -22,16 +23,14 @@ int eeprom_is_readable(eeprom_read_t read_fn) { int rev = get_rev(read_fn); - if (rev == EEPROM_REV_UNRECOGNIZED) - { + if (rev == EEPROM_REV_UNRECOGNIZED) { is_readable = 0; return is_readable; } /* If rev is 0, there's no further checks available */ - if (rev == 0) - { + if (rev == 0) { is_readable = 1; return is_readable; } @@ -91,7 +90,6 @@ int get_rev(eeprom_read_t read_fn) } - /* Read the vendor ID from EEPROM using the function specified*/ uint16_t get_vid(eeprom_read_t read_fn) { @@ -189,6 +187,12 @@ const uint8_t* get_product_string_descriptor(uint16_t pid) { if (pid == PID_ETTUS_B200_B210) { return common_b200_product_desc; + } else if (pid == PID_ETTUS_B200_MINI) { + return common_b200_mini_product_desc; + } else if (pid == PID_ETTUS_B205_MINI) { + return common_b205_mini_product_desc; + } else if (pid == PID_ETTUS_B206_MINI) { + return common_b206_mini_product_desc; } else if (pid == PID_NI_USRP_2900) { return common_niusrp_2900_product_desc; } else if (pid == PID_NI_USRP_2901) { @@ -196,4 +200,4 @@ const uint8_t* get_product_string_descriptor(uint16_t pid) } else { return common_unknown_desc; } -} +} \ No newline at end of file