NXP MCU 技术论坛
直播中

王秀兰

7年用户 1361经验值
私信 关注
[问答]

如果设置了usbStringPtr,则ROM引导加载程序会导致重置怎么处理?

我尝试配置 ROM 引导加载程序,但如果我设置 usbStringsPointer 而不是进入 ROM 引导加载程序,将导致 MCU 软件复位。
谁能帮我配置结构?一定有问题。
#define USB_STRING_DESCRIPTOR 0x03

const uint8_t USB_STR_0[4] = {0x02,0x03,0x09,0x04}; /* RM 14.4.5.2 */

__attribute__((section(".usb_str"))) usb_strings_t usb_str = {
//Länge, +utf16 string
.vendor = { 18,USB_STRING_DESCRIPTOR,'T',0,'Y',0,'R',0,'A',0,'C',0,'O',0,'N',0,'T',0 },
.product_description = { 12,USB_STRING_DESCRIPTOR,'V',0,'D',0,'8',0,'5',0,'0',0},
.serial_nr = { 18,USB_STRING_DESCRIPTOR,'1',0,'2',0,'3',0,'4',0,'5',0,'6',0,'7',0,'8',0 },

.str_size = {sizeof(USB_STR_0),18,12,18},
};



const uint8_t * const g_string_descriptors[4] =
{
        USB_STR_0,
        usb_str.vendor,
usb_str.product_description,
usb_str.serial_nr,
};


const Languages_desc_t g_languages =
{
        .STR0_ptr = USB_STR_0,
        .Size = sizeof(USB_STR_0),
        .Num = (uint16_t) 0x0409,
        .StringDescriptors = g_string_descriptors,
        .Sizes = usb_str.str_size,
};


__attribute__((section(".cfg_section"))) volatile const bootloader_config_t bcfg = {
.tag = 0x6766636B, //!< Magic Number
        .crcStartAddress = 0xFFFFFFFF, //!< Disable CRC check
        .crcByteCount = 0xFFFFFFFF, //!< Disable CRC check
        .crcExpectedValue = 0xFFFFFFFF, //!< Disable CRC check
.enabledPeripherals = ENABLE_PERIPHERAL_USB_HID,
        .i2cSlaveAddress = 0x10, //!< Use default I2C address(0x10)
        .peripheralDetectionTimeoutMs = 10000, //!< Use user-defined timeout(ms)
        .usbVid = 0x22B5, //!< Use default Vendor ID(0x15A2)
        .usbPid = 0x0850, //!< Use default Product ID(0x0073)
.usbStringsPointer = (uint32_t)&g_languages,
        .clockFlags = 0xFE, //!< 0 bit cleared: Enable High speed mode. NOTE: Enabling high speed mode makes UART connection worse, requires pull-up on UART RX line!
.clockDivider = 0xff, //!< Use clock divider(0)
.mmcauPtr = 0x410,
.FOPTConfig = {0x45FFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFF3DFE},
};

更多回帖

发帖
×
20
完善资料,
赚取积分