Skip to main content
Knowledgebase
Home
Renesas Electronics America - Knowledgebase

The product information is displayed as “Unknown” when the data size of the USB String Descriptor is changed. Why?

Latest Updated:05/17/2017

Question:

When I changed the data size of the USB string descriptor with the RSK HID sample code from 44-byte to 64-byte, the product information of the RSK HID sample application changed to display “Unknown.” Can you explain to me why this happened?

Answer:

The data size of the USB string descriptor in HID sample code has been designed to be 44-byte and should not be changed. The product information of the Renesas HID sample application will be displayed as "Unknown" when either of the situations below are true.

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

The specifications for the HID sample code have been designed as below whereas the above conditions exist in your case, which is why you get the "Unknown" message.
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-bytes, you may need to send a "Null" packet after sending the maximum packet size of data to notify the USB Host.
Null packet can be sent by writing 1 to the BVAL bit.
The modified sample code is shown below. Add the following source code the existing sample code where necessary.

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 until we 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 send */
                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 Send */
static uint16_t req_zero_length_send = 0;
 

Suitable Products
Renesas Starter Kit for RX630
Renesas Starter Kit+ for RX62N
Renesas Starter Kit+ for RX63N
Renesas Starter Kit+ for RX63N-256K