This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

USBPWDN bit of USB System Control Register (USBSCR) [1C32h] is not working

Hi TI Tech support,

With DSP C5504, USB System Control Register (USBSCR) [1C32h] bit 15, USBPWDN is always in ON state. Regardless USB cable is plug-in with PC or not, Bit 15 is 0.

In our equipment when Blue-tooth is on, USB module shall be off. Then following code is used. But anyway, USBPWDN  is always 0 and could not be set to 1.

void usb_power_ctr(Uint16 mode)
{
    if(mode)
        *(ioport unsigned int *)USBSCR  = 0x6040;  //USB power on
    else
        *(ioport unsigned int *)USBSCR  = 0xE040;  //USB power off
}

Please help. Thanks.

Howard





  • Hi Howard,

    Sorry for the delay in responding.

    I'm not a USB expert (and I have forwarded this query to our SW team), but here are my thoughts...

    USBPWDN is the USB module power status/control bit - it will be 1 if the entire USB module is powered down (regardless of USB connected or not)

    USBVBUSDET seems to be more useful for detecting if the USB cable is inserted or not (except I'm not sure how)

    Also look into the Soft Connect feature...

    Check these resources:

    C5504 Datasheet: http://www.ti.com/lit/ug/sprugh9/sprugh9.pdf

    C5504 System User's Guide: http://www.ti.com/lit/ug/sprugh6/sprugh6.pdf

    C5504 USB User's Guide: http://www.ti.com/lit/ug/sprugh9/sprugh9.pdf

    Also see the USB CSL examples to study/copy: http://www.ti.com/tool/sprc133

    I will also ask our SW team to respond to this post, but there may be a delay caused by the holiday season.

    Best Regards,
    Mark

  • Hi Howard,

    Are you able to get what you want to work?

    Maybe I am not sure if you are trying to detect the presence of the USB connection (ie VBUS detect) or if you are trying to power down the USB peripheral when your Bluetooth device takes over.

    You should see section 1.5.3.2 Peripheral Domain Clock Gating of the TMS320C5504 DSP System User's Guide for the proper sequence.

    In particular, read 1.5.3.2.2 Peripheral Clock Stop Request/Acknowledge Register

    You must execute a handshaking procedure before stopping the clock to the EMIF, USB, and UART. This handshake procedure ensures that current bus transactions are completed before the clock is stopped. The peripheral clock stop request/acknowledge register (CLKSTOP) enables this handshaking mechanism.

    To stop the clock to the EMIF, USB, or UART, set the corresponding clock stop request bit in the CLKSTOP register, then wait for the peripheral to set the corresponding clock stop acknowledge bit. Once this bit is set, you can idle the corresponding clock in the PCGCR1 and PCGCR2.

    To enable the clock to the EMIF, USB, or UART, first enable the clock the peripheral through PCGCR1 or PCGCR2, then clear the corresponding clock stop request bit in the CLKSTOP register.

    The peripheral clock stop request/acknowledge register (CLKSTOP) is shown in Figure 1-16 and
    described in Table 1-25.

    Hope this helps,
    Mark

  • Hi Mark,

    Thanks for your helps.

    With my understanding, for each module of DSP, there are two type of power consumptions. One called dynamical power which is controlled by clock and another one is static power consumption which may or may not be turned on/off individually.

    In my case, there are three questions:

    1. How to dynamically turn USB module on/off from application? There is no such example in CSL

    2. In my previously email, the code shows a way to turn USBPWDN on / off. It is NOT working. USBPWDN  can be changed from memory utility of CCS as I/O but not in app. Would you please tell me why.

    3. What is best way to dynamically turn USB module on/off without re-initialize entire DSP. Please help.

    Thanks,

    Howard

  • Hi Howard,

    Let me answer your questions.

    Howard Wang said:
    1. How to dynamically turn USB module on/off from application? There is no such example in CSL

    Follow the procedure in the C5504 System User Guide - 1.5.3.4.1 Clock Configuration Process for the USB Domain... (sorry there is not yet a CSL example for this)

    Set suspendm bit in faddr - tells USB host that USB is going away
    Request/ ack clock stop
    Clock gate USB (bit 2 of PCGCR2 to 1) - stopping clock to peripheral eliminates active power consumption (but keeps static/leakage power consumption)
    Disable USB oscillator

    Note: Stopping clocks to a peripheral only affects active power consumption; it does not affect leakage power consumption. USB leakage power consumption can be reduced to zero by not powering the USB.

    Further power savings possible by disabling USB supplies...
    Disable USB 1.3V LDO (not present on C5504 - turn off external 1.3V USB supplies)
    Turn off USB 3.3V supplies

    If the USB peripheral is not used ever, then you can terminate the USB pins - See Table 3-13. USB2.0 Terminal Functions - "When the USB peripheral is not used..."

    If not using DMA and not using USB, you can also idle MPORT to save some power - See 1.5.3.1 CPU Domain Clock Gating

    Howard Wang said:
    2. In my previously email, the code shows a way to turn USBPWDN on / off. It is NOT working. USBPWDN  can be changed from memory utility of CCS as I/O but not in app. Would you please tell me why.

    This is interesting - you can write to address 0x1C32 in the IO memory (USB System Control Register (USBSCR)) with the memory viewer in CCS and the setting will stay? But if you set this bit in your program, then the setting will not stay? I will try to reproduce this.

    However, you should still follow the above procedure.

    Howard Wang said:
    3. What is best way to dynamically turn USB module on/off without re-initialize entire DSP. Please help.

    The best way is to follow the procedure. Section 1.5.3.4.1 has instructions for turning off the peripheral and also for turning it back on. The DSP can continue to run its program and does not require re-initialization - only the USB peripheral requires re-initialization.

    I'm not sure about the USBPWDN bit... Please let me know if this procedure works for you.

    Hope this helps,
    Mark