Hi Nagaraj,
You have some good examples in the simpleBLEPeripheral example project.
[quote user="nagaraj hegde"]whether there was a loss of connection in case if that happens [/quote]
Have a look at peripheralStateNotificationCB function, example case GAPROLE_WAITING_AFTER_TIMEOUT which is"Device just timed out from a connection but is not yet advertising, is in waiting period before advertising again". You can also intercept the periperal.c, look at gapRole_ProcessGAPMsg with case GAP_LINK_TERMINATED_EVENT.
[quote user="nagaraj hegde"] If there is a way, after that CC2540 should be in a phase where it does periodic advertisements[/quote]
You could use an OSAL timer to start and stop advertisements periodically.
[quote user="nagaraj hegde"]If I want to put cc2540 into PM3, whats the best way to do that? Is these any straight APIs from stack which I can make use of?[/quote]
This is performed automatically if there is no connection and no OSAL events are scheduled.
Best Regards