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.

CC2540 USB CDC and PM2 Low Power Mode

Other Parts Discussed in Thread: CC2540

I have a CC2540-based device with the TI BLE Stack. I added the USB CDC Libraries to the code in order to send serial commands to the device through a terminal.

I noticed that PM2 is not compatible with the USB Controller on the CC2540.

I tried setting a global flag in usb_interrupt.c (in the ISR) so that OSAL.c knows when USB is connected. This way, osal_run_system(void) will only call osal_pwrmgr_powerconserve() if the USB flag is not set.

This seemed like a great idea, only, the usbirqHandler(void) never gets called. I checked hal_sleep.c to see what interrupts are enabled when the device enters sleep mode and it appears that Port 2 interrupts (which contains USB) are enabled.

I am not even sure if the USB interrupt is even waking the device out of sleep mode.

Is it possible to wake the CC2540 up from PM2 through a USB interrupt? Is there a reliable way that I can make sure the computer detects the device over USB if it is periodically going in and out of PM2?

Any help would be appreciated.

Thanks,

Seth Berggren

  • In order to use PM2 with CC2540, a 32kHz XOSC is required to meet the sleep timing requirements of BLE. The CC2540USB dongle that is included in our kits does not have a 32kHz XOSC mounted.

  • This device is not the CC2540USB dongle. It is a vehicle On Board Diagnostic device that has USB connectivity. It has a HF XOSC and a LF XOSC crystal.

    The device needs to go into a low power mode to conserve energy. Unfortunately, PM2 will not allow the CDC ISR to function (no interrupt is generated).

    The hardware cannot distinguish between USB power and other power sources, so I currently do not have a way to detect if the device is plugged in over USB (which would allow me to disable PM2 while USB is plugged in).

    I need to know if it is possible for USB to generate an interrupt while the device is in PM2 (which would allow me to disable PM2 until USB is disconnected).

  • Hi Seth, 

    All functionality related to USB is powered down in PM2/3. PM1 is the lowest one you can go to and still get a USB interrupt. 

    If PM1 is not low enough, I guess you could hook a GPIO up to the D+ USB pin and have it sense whether you are being connected. GPIO interrupts still work in PM2/3.

    Peder