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.

LAUNCHXL-CC2650: Problem with simple_peripheral

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

  • Hey Bassel,

    As a sanity check, first check to see if you can connect to the out of box simple_peripheral example with your phone.

    Additionally, please refer to the spp_over_ble examples as I think this is what you're trying to do.

    Please let me know if this helps!

     

  • Hello Ammar
    thank you so much for replaying
    I can connect the hex file cc2650lp_simple_peripheral_rel.hex without problem but when I try to do so using stack and app I can't because the device dosen't appear
    Best regards
  • Are you flashing the stack project first, and then the application project?
  • yes I load first stack then I load app but for some reason it never shows up and I tried to reinstall SDK and now even STK example dosn't work
    what I'm trying to do is to send a message from my phone to the device and show it using UART
    you have mentioned this example spp over ble but I tried to find but I wasn't able to find is it in other place than SDK?
    thank you again for replying
    Best regards
  • What compiler are you using? Which version?

    The spp_over_ble example is located in a separate GIT repository here: github.com/.../spp_ble.md

    That being said, we'll need to fix the issues with your current SDK as you'll need it for the GIT example to work also.

  • Hi Ammar I'm useing ccs 8.2
    I tried to open the link of the page but it seems that it isn't exist anymore
    Thanks a lot for replying
    Best regards
    Bassel
  • Hey Bassel,

    I'm sorry, the link I provided had an extra '.' in it. I have edited that post and that link should be working now.
  • Any updates, Bassel?

    Are you still experiencing trouble with the SDK?
  • Hello Ammar,
    thanks for asking but the situation is still the same and I tried lots of stuff without any luck so I'm trying some other stuff like connecting an another device with my launchpad and trying to make a canal between them so I can send a message using the first device to my launchpad by sending the message through SmartRF studio 7....
    because I really have no idea what the problem is and it seems that I won't be able to find a solution ...I just wonder if it is actually a hardware problem or I'm still missing something
    but thanks again for remembering my issue
    Best regards
    Bassel
  • Can you try flashing just the simple_peripheral example (stack first and then application)? Don't use the hex file this time as we've tested that already. Once flashed, used LightBlue on your phone and see if you can find it.

    Let me know what comes of that, including any errors. Please let me know what version of CCS you are using, including the compiler version (under Project Properties> General). Also, what phone are you using to connect to the peripheral?

    Please provide a detailed account of what you're experiencing so I may assist you, including steps to reproduce the problems you're experiencing.
  • Hello Ammar,
    thanks for replying the problem is that I'm not able to find the device using BLE scan but there is no any error my CCS version is 8.2 and my compiler version is T1 v16.9.4.LTS and I am using SDK ble_sdk_2_02_02_25
    The phone I'm using is Xiaomi Redmi note 4x but of course I tried lots of other phones like Samsung note 8, Huawei Mate 10 light and others (they are all using Android and I haven't tested any IOS phone )
    so in general the problem is just that by scanning for the device I can't find anything and I tried that already and I have flashed I Stack first then the app still no luck .... maybe I'm doing something wrong but I really don't know exactly what my mistake is .....
    I don't know if there are any other details I should provide but the steps are :
    1.connect the device to my laptop (windows 10)
    2.load or debug the simple_peripheral_cc2650lp_stack
    3.load or debug the simple_peripheral_cc2650lp_app
    4. scan using my phone
    thing which I have tried :
    editing the code , reinstall the SDK,reinstall the CCS, trying other examples which don't use Bluetooth (they work just fine),trying other phones ,trying same example but for STK not LP (it dose actually connect for few second and then disconnect) project 0 from this page: dev.ti.com/.../index.html (it works just fine but it is just a hex file so the same case ) ,sensortag_cc2650lp_stack and app (can't find the device as well) and so many other stuff
    thank you so much for any help
    Best regards
    Bassel

  • Hey Bassel,

    Can you build the stack and app projects in your environment, and then send me the two separate hex files located in the FlashROM folder?

    I'd like to test it on a different launchpad.
  • Hey Bassel,

    It looks like there may have been some modifications to the application project. Can you walk me through the changes you made there?
  • Hello Ammar,
    thank you so much for replying ,I haven't made any modification to the code at all and I tried to uninstall the ble_sdk_2_02_02_25 and reinstall it and the result is the same
    Best regards
    Bassel
  • Can you share the application project folder with me? Be sure it includes the simple_peripheral.c file in particular.
  • Hello Ammar ,

    Thanks so much for replying

    and here is the file

    Best regards

    Bassel

    simple_peripheral.rar

  • Hey Bassel,

    I'm sorry you're experiencing this. I'm not sure what's going on here with your CCS environment. Have you tried creating a new workspace (in a new folder)? I've seen this fix issues in the past, so let me know if that works.
  • Hello Ammar,
    thank you so much for replying
    I think I'm just unlucky because this problem doesn't make any sense ! I know that but sense I have reached a dead end I have changed my project ....I know it would be more beautiful to be able to use my phone to do the job but I can use other device to send some packet instead of my phone and it works fine so thanks a lot for everything I'm really grateful to you
    Best regards
    Bassel