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.

BLE Stack Size

Other Parts Discussed in Thread: CC2540

Hi,

I have a high volume application which the CC2540 would be a nice fit for. I have not downloaded any of the software yet, read the datasheets in detail or purchased any of the tools but would like to know quickly at a high level what resources the BLE stack requires in terms of flash, RAM, processor time when transferring data etc.

Also can the sleep timer be used to provide a RTC? 

Thanks

  • Hi, for the 1st question check the TI site for datasheets since there are several flavors (128, 256kb) of the cc2540. For the second one, the timer2 is susceptible to changes due to events and power managing issues so I would not rely on it for a RTC.

  • Thanks for your response.

    I would have thought that the stack size is independent of the flash size. I wanted to understand how much of the 128KB device the stack used to decide if a 256KB version is required. e.g. if the stack requires 64KB, there is 64KB for application which may not be enough. Can anyone provide more detail?

    I have had a closer look at the timers and it appears the sleep timer can be used to maintain the Timer2 count when in sleep mode but this seems to be optional - from the user guide: "When Timer 2 is used together with the Sleep Timer, the timing function is provided even when the system enters low-power modes PM1 and PM2" 

    If this mode is not used then the Sleep timer looks like it should provide an accurate uninterrupted count when used with a 32.768kHz xtal and the compare mode could be used to generate a wake up event without affecting the count.

    I cannot see in the user guide how the Timer2 - Sleep timer sync is controlled. It also appears that the sleep timer value cannot be written. Does Timer 2 need to be maintained by the sleep timer to keep the BLE running correctly?

    Can anyone provide more detail on this or implementation details if they have done it. The application is very high volume / low cost so I would like to avoid using an external RTC chip.

    It would be odd if an RTC function was not available given the low power 32.768k XOSC is available. Surely an extra timer could have been added to achieve this?

    Thanks

    Mike

     

  • Sorry for the RAM / flash thing, I was not wearing my glasses when I've written this.

    The chip has 8kB RAM. From the developer's guide, for the simpleBLEperipheral, which is not a very high-demanding resource app:

    101 560 bytes of CODE memory

    26 bytes of DATA memory (+ 62 absolute )

    5 699 bytes of XDATA memory

    192 bytes of IDATA memory

    8 bits of BIT memory

    3 602 bytes of CONST memory

    Errors: none

    Warnings: none

    This information is useful, in that it tells the total amount of code space (CODE memory) and RAM (XDATA memory) being used by the project. The sum of the CODE memory plus CONST memory must not exceed the maximum flash size of the device (either 128KB or 256KB, depending on the version of the CC2540). The size of the XDATA memory must not exceed 7936 bytes, as the CC2540 contains 8kB of SRAM (256 bytes are reserved).

    You can get an approximate value :)

    For the timer question, I would not use the timer2 since it is devoted to OSAL things. As you wish. Perhaps due to the initial development I did, which made me somewhat confused. Feel free to ask again to a TI folk :)

  • Thanks,

    I was looking at using the sleep timer, not Timer2 as Timer2 is required by the BLE stack. Perhaps a TI tech can help me - volume is 1M+ pcs per year

     

     

  • Do TI engineers answer questions here or do I need to contact them directly?

     

    Thanks

  • Hi Michael,

    Sorry for the late response. For our next stack release (BLEv1.2) the size is planned to be around 40KB to 120KB depending on the configuration and functionality wanted. We can talk more of this offline, we'll contact you.

    BR

  • Hello Nick,

    Can you contact me offline to talk about the 40K Stack size?

    Thanks

  • Hi Jonathan,

    I don't remember if i did contact you back then, but now we have an official release of BLEv1.2.1 so no reason to take this offline. I just checked with our most optimized  projects SimpleBLEObserver and SimpleBLEBroadcaster which are compiled to 43kB and 39kB respectively. It seems like I was fairly on spot :)

    Best Regards.

  • Hi Nick,

    Do you know the size of the BLE stack for the thermometer project?

    Thanks,

    Alexa

  • Hi Alexa, 

    You can check that in the bottom of the .map file located in the "Output" folder in the IAR project. Note that you will have to compile in order for the file to be generated.

    I would think around 128 KB.

    Best Regards