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.

CC2540 USB dongle sample projects

Other Parts Discussed in Thread: CC2540

Hello everyone,

My question is about the CC2540 USB dongle. The TI have sample projects for the CC2540 keyfob in the file path: "C:\Texas Instruments\BLE-CC254x-1.4.0\Projects\ble", thats okay. 

But I want to programm on the CC2540 USB dongle. Are there any sample projects for the CC2540 USB dongle, which I can use for my costumized own application?

I need your help arguently. 

Thanks a lot!

  • Hello Sohail,

    The USB example is the hostTestRelease project.  It uses the USB for sending HCI Commands through Virtual Comport .  This can be modified to send your own commands.  There is also the bootloader SBL or UBL? that uses the USB for communication.

    Thanks,

  • hi greenja,


    1. I add following lines in hostTestRelaese project  to get data on hyperterminal.

       // USART 0 at alternate location 1
      PERCFG |= 0x00;
      // Peripheral function on Rx and Tx (P0_2-3)
      P0SEL |= 0x0C;
      // UART mode
      U0CSR = 0x80;
      // MSB first
      U0GCR = 0x20;
      // UART BAUDRATE 115200
      U0GCR |= 0x0B;
      U0BAUD = 0xD8;
       
     // configure UART
      uart_config.configured           = TRUE;
      uart_config.baudRate             = HAL_UART_BR_115200;
      uart_config.flowControl          = FALSE;
      uart_config.flowControlThreshold = 0;
      uart_config.rx.maxBufSize        = 15;
      uart_config.tx.maxBufSize        = 15;
      uart_config.idleTimeout          = 15;
      uart_config.intEnable            = 0;
      uart_config.callBackFunc         = NULL;
     
      HalUARTOpen(HAL_UART_PORT_0,&uart_config);
     
      U0CSR &= ~0x02; // Clear TX_BYTE
      U0DBUF = 'A';
      while (!(U0CSR & 0x02)); // Wait for TX_BYTE to be set

    also try to use HalUARTWrite(HAL_UART_PORT_0,"A",1)  instead of above three lines.

    But not getting output on terminal even after setting proper values of serial settings.

    2. After i have load cc2540 with any central or peripheral ble application, it would not able to communicate.(Not detected in PC as I plugged it into PC. drivers for that already installed) why this happen? if i want to make it possible then what i have to change in that code.


    please update this as soon as possible

    Thanks,

    Rahul

  • Hello Rahul,

    You actually do not need to add any lines of code to use the hostTestRelease with the virtual comport.  You just have to check to see if the USB buffer has received data or write to it directly to send data.

    Perhaps you should look at the USB example found in the swru257 http://www.ti.com/litv/zip/swrc257 examples and the USB Software examples found in the swru222 http://www.ti.com/lit/pdf/swru222.  This will help you to understand how to use the USB functions and setting that are already initialized in the code.  The swru222.zip contains the USB Software User's Guide.

    Thanks,

  • I read the pdf but i can not understand where i have to write UART_Write function();

    for this i also try following in HCI_EXT_App_Init() function;

     HalUARTOpen(HAL_UART_PORT_0,&uart_config);
      HalUARTWrite(HAL_UART_PORT_0,"rahulTiwari",osal_strlen("rahulTiwari"));

    if it is already initialized then ii should display above string on hyperterminal as I connect dongle to my PC.

  • Hello Rahul,

    I just realized I misinterpreted your original post.  All the projects for the KeyFob can work with the USB Dongle.  In the Workspace you select which project configuration you want to build.

    Look at the CC2540/41 Software Example User's Guide.  In section 4.2.2 it show how to change the project Options, Configurations and Defines. http://www.ti.com/lit/pdf/swru271

    Thanks,