Part Number: LAUNCHXL-CC2650
Hello,
I have a problem regarding to simple peripheral (lb) example I tried to load the program to my launchpad it loaded successfully but I wasn't able to find the device using my mobile (android phone) but when I tried to load simple_peripheral STK it actually appeared but of course I can't edit it or use it in this case and it disconnect after few second when ever i try anything
I was trying to send some data from my mobile to my device display using UART on my computer (string variable)
I am using SDK ble_sdk_2_02_02_25
I tried this changes to the code
#include <ti/drivers/uart/UARTCC26XX.h>
#include <stdio.h>
UART_Handle uart;
UART_Params uartParams;
char echoPrompt[] = "\fEchoing characters:\r\n";
uint8 status_snv;
uint8 write_buffer[10];
uint8 read_buffer[10];
static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1)
{
// Initialize application
SimpleBLEPeripheral_init();
Util_startClock(&periodicClock);
/* Create a UART with data processing off. */
UART_Params_init(&uartParams);
uartParams.writeDataMode = UART_DATA_BINARY;
uartParams.readDataMode = UART_DATA_BINARY;
uartParams.readReturnMode = UART_RETURN_FULL;
uartParams.readEcho = UART_ECHO_OFF;
uartParams.baudRate = 115200;
uart = UART_open(Board_UART0, &uartParams);
if (uart == NULL) {
return;
}
UART_write(uart, echoPrompt, sizeof(echoPrompt));
// Application main loop
for (;;)
{
// Waits for a signal to the semaphore associated with the calling thread.
// Note that the semaphore associated with a thread is signaled when a
// message is queued to the message receive queue of the thread or when
// ICall_signal() function is called onto the semaphore.
ICall_Errno errno = ICall_wait(ICALL_TIMEOUT_FOREVER);
if (errno == ICALL_ERRNO_SUCCESS)
{
ICall_EntityID dest;
ICall_ServiceEnum src;
ICall_HciExtEvt *pMsg = NULL;
if (ICall_fetchServiceMsg(&src, &dest,
(void **)&pMsg) == ICALL_ERRNO_SUCCESS)
{
uint8 safeToDealloc = TRUE;
if ((src == ICALL_SERVICE_CLASS_BLE) && (dest == selfEntity))
{
ICall_Stack_Event *pEvt = (ICall_Stack_Event *)pMsg;
// Check for BLE stack events first
if (pEvt->signature == 0xffff)
{
if (pEvt->event_flag & SBP_CONN_EVT_END_EVT)
{
// Try to retransmit pending ATT Response (if any)
SimpleBLEPeripheral_sendAttRsp();
}
}
else
{
// Process inter-task message
safeToDealloc = SimpleBLEPeripheral_processStackMsg((ICall_Hdr *)pMsg);
}
}
if (pMsg && safeToDealloc)
{
ICall_freeMsg(pMsg);
}
}
// If RTOS queue is not empty, process app message.
while (!Queue_empty(appMsgQueue))
{
sbpEvt_t *pMsg = (sbpEvt_t *)Util_dequeueMsg(appMsgQueue);
if (pMsg)
{
// Process message.
SimpleBLEPeripheral_processAppMsg(pMsg);
// Free the space from the message.
ICall_free(pMsg);
}
}
}
if (events & SBP_PERIODIC_EVT)
{
events &= ~SBP_PERIODIC_EVT;
write_buffer[0] += 0x1;
write_buffer[1] += 0x1;
write_buffer[2] += 0x1;
write_buffer[3] += 0x1;
status_snv = osal_snv_write(0x80,10, (uint8_t *)write_buffer );
//Do ADC Polling and Data processing
read_buffer[0] = 0x0;
read_buffer[1] = 0x0;
read_buffer[2] = 0x0;
read_buffer[3] = 0x0;
status_snv = osal_snv_read(0x80,10, (uint8_t *)read_buffer );
sprintf(echoPrompt,"%x%x%x%x\r\n",read_buffer[0],read_buffer[1],read_buffer[2],read_buffer[3]);
UART_write(uart, echoPrompt, 10);
Util_startClock(&periodicClock);
// Perform periodic application task
SimpleBLEPeripheral_performPeriodicTask();
}
#ifdef FEATURE_OAD
while (!Queue_empty(hOadQ))
{
oadTargetWrite_t *oadWriteEvt = Queue_get(hOadQ);
// Identify new image.
if (oadWriteEvt->event == OAD_WRITE_IDENTIFY_REQ)
{
OAD_imgIdentifyWrite(oadWriteEvt->connHandle, oadWriteEvt->pData);
}
// Write a next block request.
else if (oadWriteEvt->event == OAD_WRITE_BLOCK_REQ)
{
OAD_imgBlockWrite(oadWriteEvt->connHandle, oadWriteEvt->pData);
}
// Free buffer.
ICall_free(oadWriteEvt);
}
#endif //FEATURE_OAD
}
}
thank you so much for any help
with best regards
Bassel