no audible USB connection tone when using USBHS

I have wasted an enormous amount of time attempting to get a simple threaded console app running. I get no audible USB connection tone when using USBHS, but I do get the audible tone with UDBFS. However, I never get connected. The USB serial port I plug into never gets initialized by Windows10, so my open fails ( eventually, I extended the timeout to one minute ). I have attached my simple project and will accept any comments, guidance, hints - darn near anything!

Thanks,
Gary L. Coakley
  • Which device and board are you using?
  • FYI, I have uploaded console_demo.zip which is written for the S7G2-SK.

    It uses the USB FS interface (on the S7G2-SK the USB-FS is configured for USB function on J5)

    The project is written for Windows 10, so the "USBX Device Configuration" Class Code is set to Miscellaneous - Not CDC

    In addition, the "g_sf_comms0 Communications Framework on sf_el_ux_comms" Timeout in ticks is set to 0xFFFFFFFF

    This means that your application will wait indefinitely for the USB cable to be inserted. For some reason the default for this is 10 seconds!?

    The console will allow you to view a random number as generated by the on chip TRNG, and to set / read the on chip RTC.

    Hope this helps.
    Richard
  • In reply to Richard:

    It helped very much. I did get your demo running, made my demo conform to yours and got my demo running. So, we made progress.

    But, when I try to add Console I/O to Netx Webserver and the Mass storage USB flash device, My demo hangs at SF_EL_UX_COMMS_Open() line 139 waiting for a semaphore that never gets released.

    I have attached a ZIP of my project that runs very well - except for no console I/O. I also attached a screenshot of the call to the get_semaphore function that is never returning.

    Thanks is advance.
    Regards,
    Gary
  • In reply to Gary:

    It helped very much.  I did get your demo running, made my demo conform to yours and got my demo running.  So, we made progress.
     
    But, when I try to add Console I/O to Netx Webserver and the Mass storage USB flash device, My demo hangs at SF_EL_UX_COMMS_Open() line 139 waiting for a semaphore that never gets released.
     
    I have attached a ZIP of my project that runs very well - except for no console I/O. I also attached a screenshot of the call to the get_semaphore function that is never returning.
     
    Thanks is advance.
    Regards,
    Gary
     
    P.S. - I had to do this twice to figure out how to attach files - sorry!
     
     
    Here's a Link to the project archive: https://1drv.ms/u/s!AsQFNiWZQ9qIjnVseRZo1OUViPk2
     
     
     
  • In reply to Gary:

    Hi Gary,

    Please try assigning more memory to USBX memory pool, recommended size for Host Mass Storage is 65536, for Device CDC is 18432, so I suggest adding these values (lower value can work as well, but just to be sure):

     

    Moreover, I observed that once I run the application with the USB connected to PC (CDC), the application waits for the semaphore. But when I disconnect and connect the wire again, it works as expected. I suppose it might be related to threads' priorities.

    Regards,
    adboc

  • Adboc

    There is definitely an initialization issue, but I don't think it's related to the task priorities. I experimented with the priorities of the three tasks using USB and in every case they behaved the same.

    If you start the project with the USB Serial disconnected from the PC, and then plug it in after the project is running, all is well. And, as you noted, if you unplug and then replugin the serial line, all is well.

    I couldn't find any way to start the project, successfully, with the USB serial line connected to the PC. Whether or not that is an issue worthy of Renesas investigation and correction is not my call, but it would seem to be, IMHO.

    Thank you, though, for your feedback. That does allow me to continue development for now.

    Gary
  • In reply to Gary:

    Hi Gary,

    The CDC activation callback tries to create a semaphore if it has not been created yet and since it's being called from ISR, ThreadX returns TX_CALLER_ERROR. Please, add tx_application_define_user.c to src/ folder:

    tx_application_define_user.c.txt
    #include "USB_Kbd.h"
    
    void tx_application_define_user(void * first_unused_memory);
    
    void tx_application_define_user(void * first_unused_memory)
    {
        if (NULL != g_sf_comms0.p_ctrl)
        {
            sf_el_ux_comms_instance_ctrl_t * p_ux_comms_ctrl = (sf_el_ux_comms_instance_ctrl_t *) g_sf_comms0.p_ctrl;
    
            /* Check if the semaphore for g_sf_comms0 is ready. */
            if (0x53454D41 != p_ux_comms_ctrl->semaphore.tx_semaphore_id)
            {
                tx_semaphore_create (&p_ux_comms_ctrl->semaphore, (CHAR *) "UX_COMMS_SEMAPHORE", 0);
            }
        }
    }
    

    Regards,
    adboc

  • In reply to adboc:

    Thank you!!!! All is well now!