LP-AM261: Adding USB CDC Virtual Com functionality to application

Part Number: LP-AM261

Tool/software:

Hi

I am trying to integrate USB CDC Virtual Com functionality to application running on LP-AM261.

I was able to execute USB CDC echo example on LP-AM261.

But when I try to integrate the same with our application firmware, it is failing.

USB CDC device is not enumerating, In the device manager it shows as Unknown USB Device (Device Descriptor Request Failed).

Minimal information about USB is available at AM261x Technical Reference Manual and AM261x Register Addendum

Please provide us detailed documentation for USB CDC implementation/Usage on LP-AM261.

Please help in solving the above-mentioned issue.

Thanks

Nithin

  • Hi Nithin,

    1. Can you share some more details about what your application/firmware does?

    2. What modules does it configure/control? 

    3. Is it dependent on USB? Like configure only after some USB Event happens or is completely independent and runs parallel to the USB application

    4. Is your application FreeRTOS based or NoRTOS based? (The out-of-box USB CDC example is NoRTOS based.)

    USB CDC device is not enumerating, In the device manager it shows as Unknown USB Device (Device Descriptor Request Failed).

    Can you make sure you have the following steps completed: https://software-dl.ti.com/mcu-plus-sdk/esd/AM261X/latest/exports/docs/api_guide_am261x/SDK_DOWNLOAD_PAGE.html#autotoc_md16 (since you are able to run standard example on AM261x-LP, I think you do have the required USB drivers and setup, but just making sure we don't miss out the basic steps here)

    Minimal information about USB is available at AM261x Technical Reference Manual and AM261x Register Addendum

    Apologies, completely understandable how much of an issue this can be when developing. We are still working on improving our AM261x public collaterals and I can assure you it will be improved with time.

    Regards,
    Shaunak 

  • Hi Shaunak,

    Can you share some more details about what your application/firmware does?

    Our application will use the Virtual Com port in our application to communicate with PC.

    What modules does it configure/control? 

    Currently the firmware is sending back echo over usb virtual com

    Is it dependent on USB? Like configure only after some USB Event happens or is completely independent and runs parallel to the USB application

    Currently the firmware is just sending back echo.

    Once this is working, we will integrate other functionalities. Our end goal is communication firmware application and pc over virtual com

    Is your application FreeRTOS based or NoRTOS based? (The out-of-box USB CDC example is NoRTOS based.)

    Our application is RTOS based (It is not FreeRTOS)

    I understand that the example is NoRTOS based.

        Currently i am trying to test whether the basic USB CDC functionality in the application.

         Using noRTOS verstion of tusb_config.h (tinyusb\config\nortos\am261x\cdc_config\tusb_config.h)

         Calling cdc_echo_main calls in one of our RTOS tasks.

                 calling Drivers_usbOpen

                 calling Synopsis DWC task , tinyusb device task ,CDC handler  calls repeatedly

    Thanks

    Nithin

  • Hi Nithin,

    At a high level, If I understand correctly, the cdc_echo_main calls an RTOS task in your application, which then calls the Drivers_usbOpen()

    1. Make sure, you have System_init(), Board_init() calls before the cdc_echo_main() is called

    2. If you are using some other peripheral (such as UART), make sure not just Drivers_usbOpen() is called, rather Drivers_open() should be called. (this auto-generated function will internally call Drivers_usbOpen())

    3. For the RTOS based application, we do have a reference file cdc_echo_freertos (won't be directly applicable to AM261x), which shows how the task configuration should be done for the DSR (For AM243x and AM64x, here you can call the USB_dwcTask() instead), TinyUSB and CDC tasks. Mainly check the priorities assigned for each task.

    4. I also assume your Firmware triggers a USB communication only post the enumeration is successful.

    We do perform internal tests, where we use Python and shell scripts to communicate between Host PC and the AM261x (USB CDC device) and send/receive data between the host and device and it works fine. Let me know if you have any more questions.

    Regards,
    Shaunak

  • We are calling cdc echo main calls in an RTOS task

    1. Make sure, you have System_init(), Board_init() calls before the cdc_echo_main() is called

    Yes, we are calling all these initializations 

    2. If you are using some other peripheral (such as UART), make sure not just Drivers_usbOpen() is called, rather Drivers_open() should be called. (this auto-generated function will internally call Drivers_usbOpen())

    We are already calling all other peripherals initializations and are already working fine.

    We are facing the issue only in case of USB.

    3. For the RTOS based application, we do have a reference file cdc_echo_freertos (won't be directly applicable to AM261x), which shows how the task configuration should be done for the DSR (For AM243x and AM64x, here you can call the USB_dwcTask() instead), TinyUSB and CDC tasks. Mainly check the priorities assigned for each task.

    Is it necessary that 3 separate tasks are needed?

    Should i use custom tusb_config.h?

    Can you provide a RTOS working example for LP-AM261.

    so that it will be more helpful

    4. I also assume your Firmware triggers a USB communication only post the enumeration is successful.

    Currently the application is doing echo, so firmware will be triggering communication only after receiving data, ie after enumeration

  • Hi Nithin,

    Thanks for sharing additional information.

    Can you provide a RTOS working example for LP-AM261.

    It won't be possible to provide an example immediately due to release activities and other commitments. I have created an internal requirement and will discuss with our team to get it added in the SDK in the upcoming future releases. If I do have an application ready before an official SDK release, I will share it with you.

    Should i use custom tusb_config.h?

    You need to modify the tusb_config.h file to support OS. There is a macro "CFG_TUSB_OS" which needs to be changed when using an RTOS. If not FreeRTOS, can I know what RTOS are you using?  For FreeRTOS, we set the macro value to OPT_OS_FREERTOS.

    The low-level driver might also need some changes based on the OS being used. This has not been validated on the AM261x platform.

    Is it necessary that 3 separate tasks are needed?

    It generally should not break the functionality, just a general recommendation to avoid task blocking, interrupt handling according to proper priority.

    Best regards,
    Shaunak

  • Thank you for the update.

    You need to modify the tusb_config.h file to support OS. There is a macro "CFG_TUSB_OS" which needs to be changed when using an RTOS. If not FreeRTOS, can I know what RTOS are you using?  For FreeRTOS, we set the macro value to OPT_OS_FREERTOS.

    We are using uC/OS

  • I tried to create FreeRTOS example, but the behavior is same.

    Enumeration is not happening.

  • Hi Nithin,

    The porting required is not just at application level but also at the TinyUSB stack level for RTOS and maybe some tweaks in the USB LLD. Developing this layer and validating this internally will take time as mentioned earlier. Appreciate your patience so far. I have already raised a requirement with the team to enable FreeRTOS support over TinyUSB stack.

    Regards,
    Shaunak

  • Thank you for the update

  • Hi Nithin,

    I will be marking this thread as closed. Requesting you to wait until the USB Drivers and TinyUSB stack is ported to FreeRTOS and verified internally before pushing it in the public SDK.

    Regards,
    Shaunak

  • Hi Shaunak,

    Thank you for the update.

    Could you please share approximate timelines for it

    That will be really helpful for us 

    We tried integrating USB changes to FreeRTOS hello world example

    • When we add a single task is created
      • Called three functions are called inside it in a loop
        • USB_dwcTask and tud_task and cdc_task()
      • It is working
    • When we add 3 tasks
      • With decreasing order of priority USB_dwcTask ,tud_task ,cdc_task()
      • Only the USB_dwcTask is getting called.
      • Which is the highest priority task and which never goes to blocked state.
      • Other tasks are never getting called.

    Thank you

    Nithin 

  • Hi Nithin,

    Could you please share approximate timelines for it

    I am having discussion with the team on this.

    We tried integrating USB changes to FreeRTOS hello world example

    • When we add a single task is created
      • Called three functions are called inside it in a loop
        • USB_dwcTask and tud_task and cdc_task()
      • It is working

    When you say "it is working", do you mean that the USB example works fine and as expected (enumeration and CDC echo works fine)?

    Regards,
    Shaunak

  • I am having discussion with the team on this.

    Thank you

    When you say "it is working", do you mean that the USB example works fine and as expected (enumeration and CDC echo works fine)?

    Yes. enumeration and CDC echo is working

  • Hi Nithin,

    The example would be available in the SDK by 3Q2025 in one of the future SDK releases.

    Regards,
    Shaunak