If you have copied the CC2540 USB reference design you might have missed that you need to add a 32kHz crystal to enable low power mode (i.e. POWER_SAVING). If you do not have the sleep crystal, you cannot put the device in sleep and therefore you have to remove POWER_SAVING from the project defines in order for the application to work properly.
You can compare the reference designs:
CC2540EM Reference design
CC2540USB Reference design
I don't think you need to add those many lines in SimpleBLEPeripheral_Main.c file.
Just make change from uint8 initial_advertising_enable = FALSE; to TRUE; in void SimpleBLEPeripheral_Init( uint8 task_id ) function in SimpleBLEPeripheral.c file. This should make hardware advertise itself and becomes discoverable.
Hope that it helps.
All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.