Skip to main content
Knowledgebase
Home
Renesas Electronics Europe - Knowledgebase

The product information is displayed as “Unknown” when the data size of the USB String Descriptor has been changed

Latst Updated:03/22/2017

Question:

As I changed the data size of the USB String Descriptor with the RSK HID sample code from 44-byte to 64-byte, I see the product information of the RSK HID Sample Application displayed as “Unknown”.

Answer:

The data size of the USB String Descriptor in HID sample code has been designed to be 44-byte and not to be changed. The product information of the Renesas HID Sample Application will be displayed as "Unknown" when the requirements below are satisfied.

The required data size from the USB host is the maximum packet size or more.
The transmit data size from the USB device = n times as large as the maximum packet size.

The specifications for the HID sample code have been designed as below and the above conditions are being satisfied in your case.
The required data size from the USB Host: 257-byte
The transmit data size from the USB device: 64-byte
The maximum packet size(CONTROL_IN_PACKET_SIZE): 64-byte

Application notes including the sample code
Renesas Starter Kit for RX630
  - [CubeSuite+ & CC-RX] RSK Sample Code Application Note (R20AN0276EJ0100)
  - [e2 studio & CC-RX] RSK Sample Code Application Note (R01AN1243EG0200)
  - [e2 studio & GNU] RSK Sample Code Application Note (R01AN1718EG0100)
  - [HEW & CC-RX] RSK Sample Code Application Note (R01AN1242EG0100) 
Renesas Starter Kit+ for RX62N
  - [CubeSuite+ & CC-RX] RSK Sample Code Application Note (R20AN0279EJ0100)
  - [HEW & CC-RX] RSK Sample Code Application Note (R01AN0318EG0100)
  - [HEW & GNU] RSK Sample Code Application Note (R01AN1795EG0100) 
Renesas Starter Kit+ for RX63N
  - [CubeSuite+ & CC-RX] RSK Sample Code Application Note (R01AN2508EG0100)
  - [CubeSuite+ & CC-RX] RSK Sample Code Application Note (R20AN0272EJ0100)
  - [e2 studio & CC-RX] RSK Sample Code Application Note (R01AN1396EG0100)
  - [HEW & CC-RX] RSK Sample Code Application Note (R01AN1395EG0100) 
Renesas Starter Kit+ for RX63N-256K
  - [e2 studio & CC-RX] RSK Sample Code Application Note (R01AN2507EG0100)


To change the data size of the USB String Descriptor to 64-byte, you may need to send Null packet after sending the maximum packet size of data to notify to the USB Host.
Null packet can be sent by writing 1 to the BVAL bit.
The modified sample code is as below. Add the following source code in blue to the existed sample code.

1.    Add the transmission determination of the maximum packet size of data 
\Samples\HID\Target\USBStack\usb_hal.c
The following code is an extract of the WriteControlINPacket() function.

static void WriteControlINPacket(void)
{
    uint16_t Count = 0;
    uint16_t req_wLength;

  ===== The rest is omitted.=====

    /*Wait for buffer to be ready*/
    while(USBIO.CFIFOCTR.BIT.FRDY == 0){;}
     /* Issue Zero-Length send request at Max packet size transmission */
     req_wLength = USBIO.USBLENG;
     if( g_Control.m_IN.m_DataBuff.NumBytes < (uint32_t)req_wLength )
     {
         if( CONTROL_IN_PACKET_SIZE == (uint16_t)g_Control.m_IN.m_DataBuff.NumBytes )
         {
             req_zero_length_send = 1;
         }
     }
    /* Write data to the IN Fifo untill have written a full packet
    or we have no more data to write */
    while((Count < CONTROL_IN_PACKET_SIZE) &&
     (g_Control.m_IN.m_DataBuff.NumBytes != 0))
    {
        ===== The rest is omitted. =====

2.    Add the transmission of Null packet
\Samples\HID\Target\USBStack\usb_hal.c
The following code is an extract of the HandleBEMP() function.
static void HandleBEMP(void)
{
  ===== The rest is omitted. =====
        /*If we are performing a CONTROL IN DATA*/
        if(STATE_CONTROL_IN == g_Control.m_etState)

        {
            /* Request for Zero Length transmission after at Max Packet transmission */
            if( req_zero_length_send == 1 )
            {
                req_zero_length_send = 0;
                /*Wait for buffer to be ready*/
                while(USBIO.CFIFOCTR.BIT.FRDY == 0){;}
                /* Zero-length sending */
                USBIO.CFIFOCTR.BIT.BVAL = 1;
            }
            else
            {
                /*If there is more data to send*/
                if(g_Control.m_IN.m_DataBuff.NumBytes != 0)
                    WriteControlINPacket();
                }
                else
                {
                  ===== The rest is omitted.=====
                }
            }
        ===== The rest is omitted.=====
 

*Declare the 0(zero) size transmission request flag (Null packet) in the beginning address.
/* Request of Zero-Length Sending */
static uint16_t req_zero_length_send = 0;
 

Suitable Products
<main role="main">
Renesas Starter Kit for RX630
Renesas Starter Kit+ for RX62N
Renesas Starter Kit+ for RX63N
Renesas Starter Kit+ for RX63N-256K
</main>