This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

HID USB

Hi.
I too have some question for HID USB demo example project for LPC2148 MCU.
Demo application work good but:
if don't change any code then firmware still send GetReport (button state).
In my code if send SetReport then show Led (on or off) and if use GetReport then read button state. but still receive GetReport events.
but if add to ReportDescriptor constant for ReportID then stop it , no automatic send GetReport.
this is not my problem (of course I need to know why to do it).

but now I need to know how to make interrupt with button and firmware send GetReport to PC with out of request form PC. I don't want every cycle time control if is change button state.
there must be some function , whee I set report ID and fill buffer with data and execute code .
and on PC I detect events.
what is that function???
I want create small USB RFID reader. if read card then automatic send events to PC so card is read. now I must repeated demand that the card was loaded or not

best regards

Parents
  • Hi.
    about max. packet size. Fifo forTx and Rx is max size 64 bytes (hardware defined).
    but this is size of user data with ReportID or with out???

    Step by step:
    original ReportDescriptor in Hid Demo is :

    const BYTE HID_ReportDescriptor[] = {
      HID_UsagePageVendor(0x00),
      HID_Usage(0x01),
      HID_Collection(HID_Application),
        HID_UsagePage(HID_USAGE_PAGE_BUTTON),
        HID_UsageMin(1),
        HID_UsageMax(3),
        HID_LogicalMin(0),
        HID_LogicalMax(1),
        HID_ReportCount(3),/*3*/
        HID_ReportSize(1),/*1*/
        HID_Input(HID_Data | HID_Variable | HID_Absolute),
        HID_ReportCount(1),
        HID_ReportSize(5),
        HID_Input(HID_Constant),
        HID_UsagePage(HID_USAGE_PAGE_LED),
        HID_Usage(HID_USAGE_LED_GENERIC_INDICATOR),
        HID_LogicalMin(0),
        HID_LogicalMax(1),
        HID_ReportCount(8),
        HID_ReportSize(1),
        HID_Output(HID_Data | HID_Variable | HID_Absolute),
      HID_EndCollection,
    };
    


    if open my application then receive 33 events per second (GetReport)
    but if add to report descriptor reportID.

    const BYTE HID_ReportDescriptor[] = {
      HID_UsagePageVendor(0x00),
      HID_Usage(0x01),
      HID_Collection(HID_Application),
        HID_UsagePage(HID_USAGE_PAGE_BUTTON),
        HID_UsageMin(1),
        HID_UsageMax(3),
        HID_LogicalMin(0),
        HID_LogicalMax(1),
            HID_ReportID(0x0A),
        HID_ReportCount(3),/*3*/
        HID_ReportSize(1),/*1*/
        HID_Input(HID_Data | HID_Variable | HID_Absolute),
        HID_ReportCount(1),
        HID_ReportSize(5),
        HID_Input(HID_Constant),
        HID_UsagePage(HID_USAGE_PAGE_LED),
        HID_Usage(HID_USAGE_LED_GENERIC_INDICATOR),
        HID_LogicalMin(0),
        HID_LogicalMax(1),
            HID_ReportID(0x0A),
        HID_ReportCount(8),
        HID_ReportSize(1),
        HID_Output(HID_Data | HID_Variable | HID_Absolute),
      HID_EndCollection,
    };
    


    then stop it. and I read data only if send request GetReport.

    About max record size. My AVR application use max packet size 8 bytes and record size is up to 256 bytes? (with report ID).

    I thinks so it's not just set in ReportDescriptor HID_ReportCount to 136 (example) and all work.

    is possible to help me with this code???
    If I use max record size 64bytes (max packet size) then user data are only 63 bytes + 1 report ID . is it right???
    where and how can I detect so this packet is last .

Reply
  • Hi.
    about max. packet size. Fifo forTx and Rx is max size 64 bytes (hardware defined).
    but this is size of user data with ReportID or with out???

    Step by step:
    original ReportDescriptor in Hid Demo is :

    const BYTE HID_ReportDescriptor[] = {
      HID_UsagePageVendor(0x00),
      HID_Usage(0x01),
      HID_Collection(HID_Application),
        HID_UsagePage(HID_USAGE_PAGE_BUTTON),
        HID_UsageMin(1),
        HID_UsageMax(3),
        HID_LogicalMin(0),
        HID_LogicalMax(1),
        HID_ReportCount(3),/*3*/
        HID_ReportSize(1),/*1*/
        HID_Input(HID_Data | HID_Variable | HID_Absolute),
        HID_ReportCount(1),
        HID_ReportSize(5),
        HID_Input(HID_Constant),
        HID_UsagePage(HID_USAGE_PAGE_LED),
        HID_Usage(HID_USAGE_LED_GENERIC_INDICATOR),
        HID_LogicalMin(0),
        HID_LogicalMax(1),
        HID_ReportCount(8),
        HID_ReportSize(1),
        HID_Output(HID_Data | HID_Variable | HID_Absolute),
      HID_EndCollection,
    };
    


    if open my application then receive 33 events per second (GetReport)
    but if add to report descriptor reportID.

    const BYTE HID_ReportDescriptor[] = {
      HID_UsagePageVendor(0x00),
      HID_Usage(0x01),
      HID_Collection(HID_Application),
        HID_UsagePage(HID_USAGE_PAGE_BUTTON),
        HID_UsageMin(1),
        HID_UsageMax(3),
        HID_LogicalMin(0),
        HID_LogicalMax(1),
            HID_ReportID(0x0A),
        HID_ReportCount(3),/*3*/
        HID_ReportSize(1),/*1*/
        HID_Input(HID_Data | HID_Variable | HID_Absolute),
        HID_ReportCount(1),
        HID_ReportSize(5),
        HID_Input(HID_Constant),
        HID_UsagePage(HID_USAGE_PAGE_LED),
        HID_Usage(HID_USAGE_LED_GENERIC_INDICATOR),
        HID_LogicalMin(0),
        HID_LogicalMax(1),
            HID_ReportID(0x0A),
        HID_ReportCount(8),
        HID_ReportSize(1),
        HID_Output(HID_Data | HID_Variable | HID_Absolute),
      HID_EndCollection,
    };
    


    then stop it. and I read data only if send request GetReport.

    About max record size. My AVR application use max packet size 8 bytes and record size is up to 256 bytes? (with report ID).

    I thinks so it's not just set in ReportDescriptor HID_ReportCount to 136 (example) and all work.

    is possible to help me with this code???
    If I use max record size 64bytes (max packet size) then user data are only 63 bytes + 1 report ID . is it right???
    where and how can I detect so this packet is last .

Children
No data