This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] MSP430F5529:用于 Windows 亮度控制的 MSP430 USB HID

Guru**** 2644665 points

Other Parts Discussed in Thread: MSP430F5529

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1542344/msp430f5529-msp430-usb-hid-for-windows-brightness-control

器件型号: MSP430F5529
主题: MSP430WARE 中讨论的其他部件

工具/软件:

我们正在使用 MSP430F5529 实现 USB 键盘。 键盘有两个亮度上调和亮度下调键、用于控制液晶屏的 Windows 亮度。

使用 ID 可通过下面的链接获取

https://learn.microsoft.com/en-us/windows-hardware/drivers/hid/display-brightness-control

在工程中的 keyboard.h 文件中添加十六进制值后、我们无法控制亮度。

PLS 建议如何实施。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    从 Microsoft 网站添加注释:

    Troubleshooting common errors
    Tip #1: Brightness increment/decrement HID usages only operate only on Mobile systems (battery powered) and require Windows 8.
    
    Tip #2: If the system is attached to an external monitor, the brightness increment/decrement will not function as legacy monitor transports do not support the ability to channel HID messages to them / from them.

     Note
    
     These HID usages operate only on mobile systems (battery powered) and require Windows 8.

    [引述 userid=“228235" url="“ url="~“~/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1542344/msp430f5529-msp430-usb-hid-for-windows-brightness-control

    在工程中的 keyboard.h 文件中添加十六进制值后、我们无法控制亮度。

    PLS 建议如何实施。

    [/报价]

    MCU 侧的一些注释:

    首先、需要确认需要发送的 USB 消息。

    任何 SDK 或协议参考?

    --------------------------------------------------------

    以下是使用 MSP430 创建 HID 器件的注释步骤:

    1.按照 https://learn.microsoft.com/en-us/windows-hardware/drivers/hid/display-brightness-control 说明创建 HID 报告描述符数组。

    2.将 MSP430 配置为 HID 设备。

    3.添加 GPIO 中断检测功能。

    C:\ti\MSP430Ware 3_80_14_01\examples\devices\MSP430F5xx_6xx\MSP430F55xx_MSP430F55xx\MSP430F55xx_CDI\C Code_Examples

    MSP430F55xx_P1_02.c

    4.按下检测 GPIO 键时向窗口报告。

    --------------------------------------------------------

    此处提供一些调试注释:

    1.插入 USB 时、在 Windows 的设备管理器中找到 MSP430 HID 设备。

    2.测试 GPIO 按钮检测功能,确保可以先进入 GPIO 中断。 (在 MSP430 调试模式下)

    3.测试 USB 消息(可以使用一些 HID 调试工具来监控来自 MSP430 的报告消息。)

    有关 MSP430 器件的使用、请参阅

    C:/ti/MSP430Ware_3_80_14_01/usblib430/release_notes.html

    本文档中提供了 HID 器件指南。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Helic、

    所有字母数字键均正常工作、是否有必要更改以启用中断方面的亮度控制键?

    首先、能否共享 HID 报告描述符数组示例-  

    Usage Page (Consumer)
    Usage (Consumer Control)
    Collection (Application)
    Logical Minimum (0x00)
    Logical Maximum (0x3FF)
    Usage Minimum (0x00)
    Usage Maximum (0x3FF)
    Report Size (16)
    Report Count (1)
    Input (Data, Array, Absolute)
    End Collection

    [quote userid=“571933" url="“ url="~“~/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1542344/msp430f5529-msp430-usb-hid-for-windows-brightness-control/5933867 添加 GPIO 中断检测。

    使用轮询模式检测密钥。 因为只有很少的键
    C:\ti\MSP430Ware 3_80_14_01\examples\devices\MSP430F5xx_6xx\MSP430F55xx_MSP430F55xx\MSP430F55xx_CDI\C Code_Examples
    MSP430F55xx_P1_02.c

    此致、

    Madhurya  

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    请参阅此文档: https://www.ti.com/lit/an/slaa514/slaa514.pdf

    此文档的代码中有 HID 器件示例。

    src\usb_config\descriptions.c

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您提及的是本文档 —  e2e.ti.com/.../usbkbd_5F00_430FW_5F00_1_5F00_1.zip

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    是的、其中包含 HID 实现示例。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Helic、
    这是用于桌面亮度控制的实现吗?

    BYTE const report_desc_HID0[]=
    {
        0x05, 0x01, 	                	// Usage Page (Generic Desktop)
        0x09, 0x06,		                // Usage (Keyboard)
        0xA1, 0x01,		                // Collection (Application)
        0x05, 0x07,		                // Usage Page (Key Codes)
        0x19, 0xE0,		                // Usage Minimum (224)
        0x29, 0xE7,		                // Usage Maximum (231)
        0x15, 0x00,		                // Logical Minimum (0)
        0x25, 0x01,		                // Logical Maximum (1)
        0x75, 0x01,		                // Report Size (1)
        0x95, 0x08,		                // Report Count (8)
        0x81, 0x02,		                // Input (Data, Variable, Absolute) -- Modifier byte
        0x95, 0x01,		                // Report Count (1)
        0x75, 0x08,	 	                // Report Size (8)
        0x81, 0x03,		 				// (81 01) Input (Constant) -- Reserved byte
        0x95, 0x05,		  				// Report Count (5)
        0x75, 0x01,						// Report Size (1)
        0x05, 0x08,						// Usage Page (Page# for LEDs)
        0x19, 0x01,						// Usage Minimum (1)
        0x29, 0x05,						// Usage Maximum (5)
        0x91, 0x02,						// Output (Data, Variable, Absolute) -- LED report
        0x95, 0x01,						// Report Count (1)
        0x75, 0x03,						// Report Size (3)
        0x91, 0x03,						// (91 03) Output (Constant) -- LED report padding
        0x95, 0x06,						// Report Count (6)
        0x75, 0x08,						// Report Size (8)
        0x15, 0x00,						// Logical Minimum (0)
        0x25, 0x66,						// Logical Maximum(102)  // was 0x65
        0x05, 0x07,						// Usage Page (Key Codes)
        0x19, 0x00,						// Usage Minimum (0)
        0x29, 0x66,						// Usage Maximum (102) // was 0x65
        0x81, 0x00,						// Input (Data, Array) -- Key arrays (6 bytes)
        0xC0								// End Collection
    };
    BYTE const report_desc_HID1[]=
    {
        0x06, 0x00, 0xff,	// Usage Page (Vendor Defined)
        0x09, 0x01,	// Usage Page (Vendor Defined)
        0xa1, 0x01,	// COLLECTION (Application)
        0x85, 0x3f,	// Report ID (Vendor Defined)
        0x95, MAX_PACKET_SIZE-1,	// Report Count
        0x75, 0x08,	// Report Size
        0x25, 0x01,	// Usage Maximum
        0x15, 0x01,	// Usage Minimum
        0x09, 0x01,	// Vendor Usage
        0x81, 0x02,	// Input (Data,Var,Abs)
        0x85, 0x3f,	// Report ID (Vendor Defined)
        0x95, MAX_PACKET_SIZE-1,	// Report Count
        0x75, 0x08,	// Report Size
        0x25, 0x01,	// Usage Maximum
        0x15, 0x01,	// Usage Minimum
        0x09, 0x01,	// Vendor Usage
        0x91 ,0x02,	// Ouput (Data,Var,Abs)
        0xc0	// end Application Collection

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    这应该位于 MSP430 的 USB descritor.x 文件中。

    请参阅以下内容、添加客户的亮度控制 HID 描述符。

    总之、所有与 USB HID 相关的内容都可以在该工程中找到。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Helic、

    我下载了 https://www.ti.com/tool/MSP430USBDEVPACK 工具以生成随附的文件。 之后的后续步骤是什么?  

    e2e.ti.com/.../descriptors.c

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    替换 USB 键盘示例或其他 USB HID 代码示例中的相同文件名。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    e2e.ti.com/.../H8_5F00_Keyboard.zip 这是我们的代码

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

      您的键盘项目中有一个 descriptor.c 文件。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    e2e.ti.com/.../2630.descriptors.c 。 但未找到 Windows 要求的亮度报告描述符。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    report_desc_hid0 给出一个示例描述符、您需要修改此 report_desc_hid0、这将适合您的 亮度 描述符。

    本文档介绍了 MSP430 HID 器件如何与 PC 配合使用。  https://www.ti.com/lit/an/slaa453a/slaa453a.pdf

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    在描述符中、需要设置以下数组:

    uint8_t const report_desc_HID0[]=
    {
        0x05, 0x01,                        // Usage Page (Generic Desktop)
        0x09, 0x06,                        // Usage (Keyboard)
        0xA1, 0x01,                        // Collection (Application)
        0x05, 0x07,                        // Usage Page (Key Codes)
        0x19, 0xE0,                        // Usage Minimum (224)
        0x29, 0xE7,                        // Usage Maximum (231)
        0x15, 0x00,                        // Logical Minimum (0)
        0x25, 0x01,                        // Logical Maximum (1)
        0x75, 0x01,                        // Report Size (1)
        0x95, 0x08,                        // Report Count (8)
        0x81, 0x02,                        // Input (Data, Variable, Absolute) -- Modifier byte
        0x95, 0x01,                        // Report Count (1)
        0x75, 0x08,                        // Report Size (8)
        0x81, 0x03,                        // (81 01) Input (Constant) -- Reserved byte
        0x95, 0x05,                        // Report Count (5)
        0x75, 0x01,                        // Report Size (1)
        0x05, 0x08,                        // Usage Page (Page# for LEDs)
        0x19, 0x01,                        // Usage Minimum (1)
        0x29, 0x05,                        // Usage Maximum (5)
        0x91, 0x02,                        // Output (Data, Variable, Absolute) -- LED report
        0x95, 0x01,                        // Report Count (1)
        0x75, 0x03,                        // Report Size (3)
        0x91, 0x03,                        // (91 03) Output (Constant) -- LED report padding
        0x95, 0x06,                        // Report Count (6)
        0x75, 0x08,                        // Report Size (8)
        0x15, 0x00,                        // Logical Minimum (0)
        0x25, 0x66,                        // Logical Maximum(102)  // was 0x65
        0x05, 0x07,                        // Usage Page (Key Codes)
        0x19, 0x00,                        // Usage Minimum (0)
        0x29, 0x66,                        // Usage Maximum (102) // was 0x65
        0x81, 0x00,                        // Input (Data, Array) -- Key arrays (6 bytes)
        0xC0                               // End Collection
    
    };

    我没有发现 “使用“设置为“亮度控制“。 请参考 Microsoft 帮助设置此阵列

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    uint8_t const report_desc_hid0[]=

       0x05、0x07                       、//使用页(通用桌面)
       0x09、0x06                       、//使用(键盘)
       0xA1、0x01、                       //收集(应用程序)
       0x19、0x00、                       //最小使用量 (00)
       0x29、0x64、                       //最大使用量 (100)
       0x15、0x00、                       //逻辑最小值 (0)
       0x25、0x64、                       //逻辑最大值 (100)
       0x75、0x10、                       //报告大小 (16)
       0x95、0x01、                       //报告计数 (1)
       0x81、0x02、                       //输入(数据,变量,绝对)--修改器字节
       0xC0                              //结束收集

    };

    针对亮度进行了修改。  如何进一步使用?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    有一个 USB send 函数将在此文件中使用以下描述符:

    C:\ti\msp\MSP430Ware 3_80_14_01\usblib430\MSP430_USB_Software\MSP430_USB_API\USB_API\USB_HID_API\UsbHidReq.c

    只需进行一些搜索、就可以获取调用栈。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Uint8_t usbGetHidDescriptor (void)

    这是一个要使用的吗? 如何发送 0x006F 用于亮度提高、发送 0x0070 用于亮度降低?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    是的、请检查搜索结果中的所有内容。

    对于 send 函数、您还可以尝试在此函数中搜索所有相关参数:usbSendNextPacketOnIEP0

    以下任务应与常规密钥库相同。

    您还需要确保所有 HID 配置都正确。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、Helic、
    您能否分享具体的详细信息?
    我们仍然无法设置任何内容

    此致、

    madhurya

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    抱歉、我这边没有更多详细信息。

    以下是建议您采取的步骤:

    [引述 userid=“571933" url="“ url="~“~/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1542344/msp430f5529-msp430-usb-hid-for-windows-brightness-control/6014840

    是的、请检查搜索结果中的所有内容。

    对于 send 函数、您还可以尝试在此函数中搜索所有相关参数:usbSendNextPacketOnIEP0

    以下任务应与常规密钥库相同。

    您还需要确保所有 HID 配置都正确。

    [/报价]
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    团队、

    我下载了键盘应用程序的此示例 —  https://www.ti.com/tool/download/TIDC742 

    此处共享 HID 使用 API - C:\Users\a0490028\Downloads\tidc742.zip\KBD430_sw\USB_api\USB_HID_API。 这是 API 用于发送数据-  

    如需了解更多相关信息、请访问 https://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPWare/2_00_00_41/exports/MSPWare_2_00_00_41/usblib430/MSP430_USB_Software/Documentation/Programmers_Guide_MSP430_USB_API.pdf 

    /********************************************************************************************
    uint8_t usbhid_sendData (const uint8_t* datauint16_t size、uint8_t intfNum);


    //************************************************************************************************
    //
    //! 通过 HID 接口接收\b 大小字节。
    //!
    //! \param data 是包含接收到的数据的数组。
    //! \param size 是要接收的字节数。
    //! \param intfNum 是要从哪个数据接口接收数据。
    //!
    //! 通过 HID 接口接收\b 大小字节\b intfNum 到存储器中(从开始)
    //! 地址\b 数据。 \b 大小没有固有的上限(超出 16 位
    //! 值)。
    //!
    //! 该函数可能返回\b usbhid_receive_started、表示 a
    //! 正在进行接收操作。 当\b size 个字节时、操作完成
    //! 正确接收信号。 应用程序应确保数据存储器缓冲区为
    //! 在整个接收操作期间可用。
    //!
    //! 该函数还可返回\b usbhid_receive_completed。 这意味着
    //! 在函数返回时接收操作完成。
    //!
    //! 如果在调用函数时未连接总线、则为函数
    //! 返回/b usbhid_bus_not_available、且没有开始任何操作。 如果\b 大小为 0、
    //! 该函数返回\b usbhid_General_error。 如果是前一个接收操作
    //! 该数据接口已经在进行中、函数返回值
    //! /b usbhid_interface_busy_error。
    //!
    //! USB 包含可确保有效传输数据的低级机制。
    //!
    //! 参见第节 7.2 of \e “编程人员指南:适用于 CDC/PHDC/HID/MSC 的 MSP430 USB API 堆栈“、以详细讨论
    //! 接收操作。
    //!
    //! \return 以下任一项:
    //!     -\busbhid_receive_started已执行接收操作
    //!       已成功启动。
    //!     -\b usbhid_receive_completed:接收操作已完成
    //!       已完成。
    //!     -/b usbhid_interface_busy_error:先前的接收操作是
    //!       进行中。
    //!     -\b kUSBHID_busNotAvailable:总线暂停或
    //!       已断开连接。
    //!     -/b usbhid_General_error:大小为零,或其他错误。
    //
    //************************************************************************************************
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、已向 FAE 发送演示、请与他们联系。

    感谢您的耐心。