How to create a composite USB device for mass storage AND CDC ACM?

On my S7G2 I realized 3 mass storage devices accessible over USB. Now I need an additional USB communication channel via CDC ACM over the same USB port.
Unfortunately the Synergy-configurator allows only one "USBX Device Configuration". Either "Mass Storage" OR "Communication (CDC)". It's not possible to create a second device configuration with separate class code and string descriptors in parallel.
Is there a decription or project example for such a composite device. All found sources and explanations were outdated for years and did not work.

Parents
  • Hello . Unfortunately, I wasn't able to find any recent sources for the implementation either. Kindly let us know if you've figured out a workaround to this or if you still need help, so that I can escalate your question to the team.

    -Jayesh
    If this response, or one provided by another user, answers your question, please verify the answer. Thank you!
    Renesas Engineering Community Moderators
    https://community.renesas.com/
    https://academy.renesas.com/
    en-support.renesas.com/.../

  • Thanks for the hint. I tried to reproduce (again) the description from your link (before you removed it). This was not easy because of the copy&paste-errors there.

    Thread "USB-Storage-Thread"
        Symbol: usb_storage_thread
        Name: USB-Storage-Thread
        Stack size (bytes): 49152
        Priority: 2
        Auto start: Disabled
        Time slicing interval (ticks): 20
        
        Instance "g_ux_device_class_storage USBX Device Class Mass Storage"
          Name: g_ux_device_class_storage
          Mass Storage Class Parameter Setup: Manual (User Manual Setup if LUN is greater than 1)
          User Setup Callback (Only valid if Parameter Setup is Manual): ux_device_class_storage_user_setup
          Last LBA of Storage Media (Only valid if Parameter Setup is Auto): 0
          Bytes Per Sector of Storage Media (Only valid if Parameter Setup is Auto): 512
          Type of Storage Media (Only valid if Parameter Setup is Auto): 0
          Removable Flag of Storage Media (Only valid if Parameter Setup is Auto): 0
          Media Read Function Callback (Only valid if Parameter Setup is Auto): dummy1
          Media Write Function Callback (Only valid if Parameter Setup is Auto): dummy2
          Media Status Function Callback (Only valid if Parameter Setup is Auto): dummy3
          USBX Device Storage Instance Activate Callback Function: NULL
          USBX Device Storage Instance Deactivate Callback Function: NULL
          Vendor ID Name: NULL
          Product ID Name: NULL
          Product Revision Number: NULL
          Product Serial Number: NULL
          Name of generated initialization function: ux_device_class_storage_init
          Auto Initialization: Disable
          
          Instance "USBX Device Class Mass Storage Source"
            Show linkage warning: Disabled
            
          Instance "USBX Device Configuration"
            Vendor ID: 0x045B
            Product ID: 0x5302
            Device Release Number: 0x0100
            Index of Manufacturer String Descriptor: 0x01
            Index of Product String Descriptor: 0x02
            Index of Serial Number String Descriptor: 0x03
            Class Code: Miscellaneous
            Index of String Descriptor describing this configuration: 0x05
            Size of USB Descriptor in bytes for this configuration (Modify this value only for Vendor-specific Class, otherwise set zero): 0x00
            Number of Interfaces (Modify this value only for Vendor-specific Class, otherwise set zero): 0x00
            Self-Powered: Disable
            Remote Wakeup: Disable
            Maximum Power Consumption (in 2mA units): 250
            Supported Language Code: 0x0409
            Name of USBX String Framework: usbx_string_framework
            Total index number of USB String Descriptors in USBX String Framework: 6
            Name of USBX Language Framework: NULL
            Number of Languages to support (US English is applied if zero is set): 0
            Name of generated initialization function: ux_device_init
            Auto Initialization: Disable
            
            Instance "g_sf_el_ux_dcd_fs_0 USBX Port DCD on sf_el_ux for USBFS"
              Name: g_sf_el_ux_dcd_fs_0
              USB Controller Selection: USBFS
              
              Instance "g_transfer0 Transfer Driver on r_dmac USBFS FIFO 0"
                Name: g_transfer0
                Channel: 1
                Mode: Block
                Transfer Size: 1 Byte
                Destination Address Mode: Fixed
                Source Address Mode: Incremented
                Repeat Area (Unused in Normal Mode): Source
                Destination Pointer: NULL
                Source Pointer: NULL
                Number of Transfers: 0
                Number of Blocks (Valid only in Repeat and Block Mode): 0
                Offset value: 0
                Activation Source: USBFS FIFO 0
                Auto Enable: False
                Callback: NULL
                Transfer End Interrupt Priority: Priority 5
                
              Instance "g_transfer1 Transfer Driver on r_dmac USBFS FIFO 1"
                Name: g_transfer1
                Channel: 2
                Mode: Block
                Transfer Size: 1 Byte
                Destination Address Mode: Incremented
                Source Address Mode: Fixed
                Repeat Area (Unused in Normal Mode): Destination
                Destination Pointer: NULL
                Source Pointer: NULL
                Number of Transfers: 0
                Number of Blocks (Valid only in Repeat and Block Mode): 0
                Offset value: 0
                Activation Source: USBFS FIFO 1
                Auto Enable: False
                Callback: NULL
                Transfer End Interrupt Priority: Priority 5
                
            Instance "USBX on ux"
              USBX Pool Memory Name: g_ux_pool_memory
              USBX Pool Memory Size: 0x10000
              User Callback for Host Event Notification(Only valid for USB Host): NULL
              User Callback for Device Event Notification(Only valid for USB Device): NULL
              Name of generated initialization function: ux_common_init
              Auto Initialization: Disable
              
              Instance "USBX Source"
                Show linkage warning: Disabled
                
          Instance "g_usb_interface_descriptor_storage_0 USBX Interface Configuration Mass Storage Class"
            Name: g_usb_interface_descriptor_storage_0
            Interface Number of Bulk-Only Data Interface: 0x02
            Endpoint Number to be used for Bulk Out transfer: Endpoint 4
            Endpoint Number to be used for Bulk In transfer: Endpoint 5
            
        Instance "g_sf_comms0 Communications Framework on sf_el_ux_comms_v2"
          Name: g_sf_comms0
          Name of generated initialization function: sf_comms_init0
          Auto Initialization: Enable
          
          Instance "g_ux_device_class_cdc_acm0 USBX Device Class CDC-ACM"
            Name: g_ux_device_class_cdc_acm0
            USBX CDC-ACM instance_activate Function Callback: ux_cdc_device0_instance_activate
            USBX CDC-ACM instance_deactivate Function Callback: ux_cdc_device0_instance_deactivate
            USBX CDC-ACM parameter_change Function Callback: NULL
            Name of generated initialization function: ux_device_class_cdc_acm_init0
            Auto Initialization: Enable
            
            Instance "USBX Device Configuration"
              Vendor ID: 0x045B
              Product ID: 0x5302
              Device Release Number: 0x0100
              Index of Manufacturer String Descriptor: 0x01
              Index of Product String Descriptor: 0x02
              Index of Serial Number String Descriptor: 0x03
              Class Code: Miscellaneous
              Index of String Descriptor describing this configuration: 0x05
              Size of USB Descriptor in bytes for this configuration (Modify this value only for Vendor-specific Class, otherwise set zero): 0x00
              Number of Interfaces (Modify this value only for Vendor-specific Class, otherwise set zero): 0x00
              Self-Powered: Disable
              Remote Wakeup: Disable
              Maximum Power Consumption (in 2mA units): 250
              Supported Language Code: 0x0409
              Name of USBX String Framework: usbx_string_framework
              Total index number of USB String Descriptors in USBX String Framework: 6
              Name of USBX Language Framework: NULL
              Number of Languages to support (US English is applied if zero is set): 0
              Name of generated initialization function: ux_device_init
              Auto Initialization: Disable
              
              Instance "g_sf_el_ux_dcd_fs_0 USBX Port DCD on sf_el_ux for USBFS"
                Name: g_sf_el_ux_dcd_fs_0
                USB Controller Selection: USBFS
                
                Instance "g_transfer0 Transfer Driver on r_dmac USBFS FIFO 0"
                  Name: g_transfer0
                  Channel: 1
                  Mode: Block
                  Transfer Size: 1 Byte
                  Destination Address Mode: Fixed
                  Source Address Mode: Incremented
                  Repeat Area (Unused in Normal Mode): Source
                  Destination Pointer: NULL
                  Source Pointer: NULL
                  Number of Transfers: 0
                  Number of Blocks (Valid only in Repeat and Block Mode): 0
                  Offset value: 0
                  Activation Source: USBFS FIFO 0
                  Auto Enable: False
                  Callback: NULL
                  Transfer End Interrupt Priority: Priority 5
                  
                Instance "g_transfer1 Transfer Driver on r_dmac USBFS FIFO 1"
                  Name: g_transfer1
                  Channel: 2
                  Mode: Block
                  Transfer Size: 1 Byte
                  Destination Address Mode: Incremented
                  Source Address Mode: Fixed
                  Repeat Area (Unused in Normal Mode): Destination
                  Destination Pointer: NULL
                  Source Pointer: NULL
                  Number of Transfers: 0
                  Number of Blocks (Valid only in Repeat and Block Mode): 0
                  Offset value: 0
                  Activation Source: USBFS FIFO 1
                  Auto Enable: False
                  Callback: NULL
                  Transfer End Interrupt Priority: Priority 5
                  
              Instance "USBX on ux"
                USBX Pool Memory Name: g_ux_pool_memory
                USBX Pool Memory Size: 0x10000
                User Callback for Host Event Notification(Only valid for USB Host): NULL
                User Callback for Device Event Notification(Only valid for USB Device): NULL
                Name of generated initialization function: ux_common_init
                Auto Initialization: Disable
                
                Instance "USBX Source"
                  Show linkage warning: Disabled
                  
            Instance "g_usb_interface_desc_cdcacm_0 USBX Interface Configuration CDC-ACM"
              Name: g_usb_interface_desc_cdcacm_0
              Interface Number of Communications Class interface: 0x00
              Interrupt Transfer endpoint to use for Communications Class: Endpoint 3
              Polling period for Interrupt Endpoint (in mS/125us units for FS/HS): 0x0F
              Interface Number of Data Class interface: 0x01
              Bulk In Transfer endpoint to use for Data Class: Endpoint 1
              Bulk Out Transfer endpoint to use for Data Class: Endpoint 2
              Index of String Descriptor Describing Communications Class interface (Interface Descriptor:iInterface).: 0x06
              Index of String Descriptor Describing Data Class interface (Interface Descriptor:iInterface).: 0x00
              

    Finally I ended up in a hardfault where the call stack is not really helpful to find out the reason for this issue. :-(

  • Till now I didn't find a working solution for my problem.
    Are there any hints from the Renesas-Staff?

  • Hello . Apologies for the delay. I've submitted a ticket for this issue and I'll let you know once I receive the response from the team. 

    -Jayesh
    If this response, or one provided by another user, answers your question, please verify the answer. Thank you!
    Renesas Engineering Community Moderators
    https://community.renesas.com/
    https://academy.renesas.com/
    en-support.renesas.com/.../

  • Hello . Apologies for the delay. This is the response I received from the team:

    "There isnt a  updated AN for composite device on Synergy.  If customer wants help troubleshooting please ask him to submit a ticket and his project.

    Renesas Technical Support"

    So you can just go to https://en-support.renesas.com/dashboard and submit a ticket for further assistance from the team.

    -Jayesh
    If this response, or one provided by another user, answers your question, please verify the answer. Thank you!
    Renesas Engineering Community Moderators
    https://community.renesas.com/
    https://academy.renesas.com/
    en-support.renesas.com/.../

  • When you hit hardfault, it is frustating as you dont know what causes it.  I usually add Segger hardfault handler to my project. When a hardfault is encountered, I can still step out of the hole and inspect which ever codes I was trying to execute before falling into this fault.  Hopefully it will give hint how to resolve it.  

    Cortex-M Fault - SEGGER Wiki

    For your case, I need to enable this macro, UX_SYSTEM_DEVICE_ONLY. The isr is trying to execute code from hcd.  In your case, only dcd is used.  This is on SSP 2.2.0/e2studio 2022-04.  I dont know what effect on EWARM or SSP version you are using.

  • Thanks, I opend a ticked hoping that there will be a functional solution because my project became time critical meanwhile.

  • Thanks for this hint. At the moment I don't have enough time to try to implement this. Do you think that this will work for a Renesas-Controller too because the registers used there are from the STM32?

  • The Segger Hardfault Handler deals with ARM Cortex M core registers.  I have use it on Synergy and RA.

  • Via the ticket system I got a running example for the S7G2-SK-board (see attached file).

    Using the configurations from there I was able to realize at least one MSC and a DCD. For three MSC and one DCD there are not enough pipes available within a device. So I can continue finishing my project.

    SSP_2_3_0_S7G2_SK_USB_Composite_MSC_CDC.zip

  • In principle the both devices works now. I have drive access and can communicate via USB.
    But a little issue is left there. The device description in the system is a bit weird.
    There are listet three devices. The first (type unknown) shows the Name provided in the string framework. But the description is "NULL" and it is listed with three drive letters.
    The both remaining devices are listet with the right type and allocation but with cryptic device names:

    Attached the string framework and the configurator settings. Are there any hints how to get the right device descriptions?

    unsigned char usbx_string_framework[] = {
        /* String Device Framework:
        Byte 0 and 1: Word containing the language ID: 0x0409 for US
        Byte 2 : Byte containing the index of the descriptor
        Byte 3 : Byte containing the length of the descriptor string
        */

        /* Manufacturer string descriptor : Index 1 */
        0x09, 0x04, 0x01, 0x14,
        'I', 'M', 'M', ' ', 'e', 'l', 'e', 'c',
        't', 'r', 'o', 'n', 'i', 'c', 's', ' ', 'G', 'm', 'b', 'H',

        /* Product string descriptor : Index 2 */
        0x09, 0x04, 0x02, 0x13,
        'I', 'M', 'M', '-', 'K', '2', ' ',
        'D', 'r', 'i', 'v', 'e', ' ', 'A', 'c', 'c', 'e', 's', 's',

        /* Serial Number string descriptor : Index 3 */
        0x09, 0x04, 0x03, 0x08,
        '0', '0', '0', '0', '0', '0', '0', '0',

        /* MSC Class string : Index 4 */
        0x09, 0x04, 0x04, 0x0A,
        'M', 'S', 'C', ' ', 'D', 'E', 'V', 'I', 'C', 'E',

        /* Alternate configuration information : Index 5 */
        0x09, 0x04, 0x05, 0x0E,
        'S', 'e', 'r', 'i','a','l',' ','C','o','n','s','o','l','e'
    };

Reply
  • In principle the both devices works now. I have drive access and can communicate via USB.
    But a little issue is left there. The device description in the system is a bit weird.
    There are listet three devices. The first (type unknown) shows the Name provided in the string framework. But the description is "NULL" and it is listed with three drive letters.
    The both remaining devices are listet with the right type and allocation but with cryptic device names:

    Attached the string framework and the configurator settings. Are there any hints how to get the right device descriptions?

    unsigned char usbx_string_framework[] = {
        /* String Device Framework:
        Byte 0 and 1: Word containing the language ID: 0x0409 for US
        Byte 2 : Byte containing the index of the descriptor
        Byte 3 : Byte containing the length of the descriptor string
        */

        /* Manufacturer string descriptor : Index 1 */
        0x09, 0x04, 0x01, 0x14,
        'I', 'M', 'M', ' ', 'e', 'l', 'e', 'c',
        't', 'r', 'o', 'n', 'i', 'c', 's', ' ', 'G', 'm', 'b', 'H',

        /* Product string descriptor : Index 2 */
        0x09, 0x04, 0x02, 0x13,
        'I', 'M', 'M', '-', 'K', '2', ' ',
        'D', 'r', 'i', 'v', 'e', ' ', 'A', 'c', 'c', 'e', 's', 's',

        /* Serial Number string descriptor : Index 3 */
        0x09, 0x04, 0x03, 0x08,
        '0', '0', '0', '0', '0', '0', '0', '0',

        /* MSC Class string : Index 4 */
        0x09, 0x04, 0x04, 0x0A,
        'M', 'S', 'C', ' ', 'D', 'E', 'V', 'I', 'C', 'E',

        /* Alternate configuration information : Index 5 */
        0x09, 0x04, 0x05, 0x0E,
        'S', 'e', 'r', 'i','a','l',' ','C','o','n','s','o','l','e'
    };

Children