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 Dongle Reference Design + Peripheral Sample Code Doesn't Work

Other Parts Discussed in Thread: CC2540

Hi TI,

I designed a custom PCB with a CC2540, MOSFET switch and Accelerometer. The RF section is exactly per the USB Dongle Reference Design (even the layout). Now on the TI key fob I tried every single BT peripheral sample project that TI provides and it works fine (discoverable with BTool). None of those work on my design NOR another TI Dongle...

I can indeed compile "HostTestApp" and install it on the dongle and it works. I can't try "HostTestApp" on my device because I don't have USB brought out. Is there something specific about the Dongle Schematic that only allows it to work as a host and not a peripheral? Is there something obvious I should check on my design? I've already checked the 32MHz oscillator, the biasing resistors, decoupling caps, balun and antenna. I noted that the RF sections are not the same on the TI dongle and keyfob.

Thank you,

Joel

  • This is one of those projects where I spend days staring at two identical things and asking how they're not identical. Per tradition I finally get mad enough to post to the forum. Within minutes my problem is solved. My device doesn't have a 32.7KHz crystal which was causing OSAL to freeze when being put to sleep. Changing the HAL_BOARD_INIT() fixed this problem.

  • Hi Joel,

    I'm glad you realized the issue. The CC2450USB Dongle is not designed to support sleep mode, so for a peripheral design, the CC2540 Keyfob Design should be more appropriate.

    BR

  • Is this because I need the 32-kHz crystal for sleep mode? Can I enter sleep mode using the internal 32-kHz RC oscillator if I turn off the radio?

     

    thanks,

    joel

  • Hi Joel,

    Using the 32 kHz RCOSC for that would not be BLE-compliant, as the Bluetooth 4.0 specification requires that the slow clock (that are used for timing between connections) have an accuracy of +/-500 ppm or better.

    BR

  • Hi BR,

    Thanks for the reply. That's ok because I'd like to completely turn-off the BLE radio while I'm in sleep mode. My product falls asleep for several hours at a time and then wakes up and reinitializes. And unfortunately I don't have any more room for even the smallest of 32-KHz crystals. Right now when I have POWER_SAVING defined without the 32-KHz crystal, the program freezes on the following line:

    if (LL_PowerOffReq(halPwrMgtMode) == LL_SLEEP_REQUEST_ALLOWED)

    And the LL_PowerOffReq() function is defined in the TI library (zero documentation on it other than the header prototype). Is there any way I can put it into PM2 mode?

    thanks!
    joel

  • ping ping?!

    We've got our whole product designed and already fabbed 10k units, we just can't get it to to wake up from sleep with the internal RC oscillator. Disabling sleep of course kills the battery. The documentation states that "The Sleep Timer is a 24-bit timer running on the 32-kHz clock (either RCOSC or XOSC)". There's a whole bunch of funkiness going on because SLEEPCMD reserve bits are being set in the HAL and I can't find any documentation on it, even in the new January swru191c.pdf release. Like I mentioned we have turned off the BLE before it goes into sleep mode. However after writing to this undocumented register the proprietary function LL_PowerOffReq does not return.

    Help! We're completely stuck!

    thanks,

    joel

  • Hi Joel, Did you manage to sort out this issue? We're currently deciding whether or not to include a 32khz osc and want a bit more info on the perils of not including one.

  • Hey Joel, the same thing happens to me (described here).

    Did you get any answers or progress on this issue?

    Thanks in advance

  • I found that you can put the device to sleep by switching off the radio, switching to 32-khz, and then going to sleep

    void Battery_SetRcOsc()
    {
    CLKCONCMD |= 0x40; // switch to 16-MHz RCOSC
    while( (CLKCONSTA & 0x40) != 0x40 ); // wait for change
    CLKCONCMD |= 0x80; // switch to 32-kHz RCOSC
    while( (CLKCONSTA & 0x80) != 0x80 ); // wait for change
    }

    void Battery_UnsetRcOsc()
    {
    CLKCONCMD &= ~0x80; // switch to 32-kHz XTAL (for BLE)
    while( (CLKCONSTA & 0x80) == 0x80 );
    CLKCONCMD &= ~0x40; // switch to 32-MHz XTAL
    while( (CLKCONSTA & 0x40) == 0x40 );
    }

    __global_radio_power = false;
    GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &__global_radio_power );

    Battery_SetRcOsc()

    // do your sleep thing here

    __global_radio_power = true;
    GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &__global_radio_power );

    Battery_UnsetRcOsc()

  • Hey Joel,

    So you manually enter sleep mode? If so, where did you integrate this code (considering the OSAL/HAL/Application))?

    Why not let the OSAL main loop automatically enter sleep? (Like the scenario I describe here)

    Also, did you ever find out the reason why the LL_PowerOffReq(halPwrMgtMode) call hangs?


    Thanks

  • LL_PowerOffReq hangs because the proprietary binary provided by TI checks to make sure you have a 32.768khz external oscillator so that you stay within the BT certification. If you use the RC oscillator you would theoretically need to recertify the device with the RC oscillator which would be difficult because of the tolerance. The code above is just blocking and thus can be put anywhere in the OSAL system. I tried to get this code to work with OSAL, but BT is too tightly integrated into it.

    good luck.