cancel
Showing results for 
Search instead for 
Did you mean: 

Cube0 - USB - CustomHID: Report Size

fussenegger
Associate II
Posted on May 11, 2015 at 13:23

Hi,

I got a question concerning the Cube USB library used on the L0 series. I am trying to implement the CustomHID class provided in the USB library. I am developing on the STM32L053 discovery board. I used the usbd_conf.c and usbd_desc.c from the usbHID demonstration from the STM32L053 Discovery package, the USB core files and the CustomHID class files. As far as I can see the customHID example implements a report with 2 byte input and 2 byte output. For my application I need to transfer more than 2 bytes at once. Therefore I used a report definition with an output/input of 16 byte and also increased the buffer sizes in the customhid.h file. After that my application becomes unstable and even crashes. With an input/output buffer of 2 or 4 byte it is working perfectly.

<
usbd_customhid.h
>
#define CUSTOM_HID_EPIN_ADDR 0x81
#define CUSTOM_HID_EPIN_SIZE 0x10
#define CUSTOM_HID_EPOUT_ADDR 0x01
#define CUSTOM_HID_EPOUT_SIZE 0x10

Am I missing some other changes in the template application? Maybe another buffer in the lower layers which becomes to small?

<
usbd_conf.c
>
HAL_PCDEx_PMAConfig(pdev->pData , 0x00 , PCD_SNG_BUF, 0x18);
HAL_PCDEx_PMAConfig(pdev->pData , 0x80 , PCD_SNG_BUF, 0x58);
HAL_PCDEx_PMAConfig(pdev->pData , 0x81 , PCD_SNG_BUF, 0x100);

Do I have to changes these addresses to make more space in the buffer? Best Regards Markus #usb #cube0 #customhid
2 REPLIES 2
D.Cedric
Associate II
Posted on June 14, 2015 at 01:05

The examples on stm32L152 uses a sendBuffer[2] buffer to transmit data. Try to locate this variable and increase the number of places in the table.

fussenegger
Associate II