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.

CCS/CC2640: Adding NPI_SPI into simple_peripheral project , but compiling failed

Part Number: CC2640

Tool/software: Code Composer Studio

Adding NPI_SPI into simple_peripheral project , but compiling failed . 

My detail steps is shown as followed:

1.On CC2640 LAUNCHPAD , add NPI_SPI into simple_peripheral project according to 《Cc2640_Adding_a_UART_or_SPI_driver_to_a_Sample_Project》.

2. download the “tl.h” and “tl.c ” file . The path is shown in attachments 6(6) and 6(7).

3. add NPI_SPI into simple_peripheral project according to 《Cc2640_Adding_a_UART_or_SPI_driver_to_a_Sample_Project》.

4.compile the simple_peripheral project , but it failed , as shown in picture 1 .

5. the reason why compiling failed is that "sem" is not defined in this project .The code is shown as followed:

#if defined (NPI_USE_UART) || defined (NPI_USE_SPI)
  //initialize and pass information to TL
  TLinit(&sem, &SimpleBLEPeripheral_TLCBs, TRANSPORT_TX_DONE_EVENT,
         TRANSPORT_RX_EVENT, MRDY_EVENT);
#endif //TL

6.Attachments

(1) TI official guide 《Cc2640_Adding_a_UART_or_SPI_driver_to_a_Sample_Project》 can de downloaded here :

(2) TI official guide 《NPI》 can de downloaded here :

(3) the location of simple_peripheral project in my computer is shown as followed:
C:\ti\simplelink_cc2640r2_sdk_1_40_00_45\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral

(4) simplelink_cc2640r2_sdk_1_40_00_45 can de downloaded here :

(5) CC2640R2 launchpad can be bought here :

(6) “tl.h” can de downloaded here :


(7) “tl.c” can de downloaded here :


7.my developing environment
CCS:Code Composer Studio 7.2.0
SDK:simplelink_cc2640r2_sdk_1_40_00_45
hardware:CC26640R2 launchpad develop kit
VS: Microsoft Visual C++ 2010 Express
OS:win7 64 bit

  • Hi Heng,

    The guide you are following is intended for the CC2640, not the CC2640R2F.

    I would suggest you take a look at the Serial Port Profile (SPP) examples on github: github.com/.../simplelink_sdk-1.40
  • Thanks for your reply!

    After downloading and compiling the spp_ble_client project from Github , it shows build success . However , the  spp_ble_client project  is based on UART , instead fo SPI , as shown in picture 1 .Where can  spp_ble_client project based on SPI be downloaded ?

    The  SDITLUART_initializeTransport()  function  in  sdi_tl_uart.c  shows the uart init parameters , shown as followed:

    void SDITLUART_initializeTransport(Char *tRxBuf, Char *tTxBuf, sdiCB_t sdiCBack)
    {
        // Set UART transport callbacks
        TransportRxBuf = tRxBuf;
        TransportTxBuf = tTxBuf;
        sdiTransmitCB = sdiCBack;
    
        // Initialize the UART driver
        Board_initUART();
    
        // Configure UART parameters.
        UART_Params_init(&paramsUART);
        paramsUART.baudRate = SDI_UART_BR;
        paramsUART.readDataMode = UART_DATA_BINARY;
        paramsUART.writeDataMode = UART_DATA_BINARY;
        paramsUART.dataLength = UART_LEN_8;
        paramsUART.stopBits = UART_STOP_ONE;
        paramsUART.readMode = UART_MODE_CALLBACK;
        paramsUART.writeMode = UART_MODE_CALLBACK;
        paramsUART.readEcho = UART_ECHO_OFF;
    
        paramsUART.readCallback = SDITLUART_readCallBack;
        paramsUART.writeCallback = SDITLUART_writeCallBack;
    
        //paramsUART.readReturnMode = UART_RETURN_FULL;
    
        // Open / power on the UART.
        uartHandle = UART_open(Board_UART0, &paramsUART);
        if(uartHandle != NULL)
        {
          //DEBUG("ERROR in UART_open");
        }
        //Enable Partial Reads on all subsequent UART_read()
        UART_control(uartHandle, UARTCC26XX_CMD_RETURN_PARTIAL_ENABLE,  NULL);
    
    
    #if (SDI_FLOW_CTRL == 0)
        // This call will start repeated Uart Reads when Power Savings is disabled
        SDITLUART_readTransport();
    #endif // SDI_FLOW_CTRL = 0
    
        return;
    }

    Where can  spp_ble_client project based on SPI be downloaded ?

  • Hi,

    NPI/SDI still contains SPI support. You would have to tweak the application a bit to enable it to use the underlying SPI transport. For example, you would have to define NPI_USE_SPI in preprocessor settings.

    Best wishes

  • I have already add the predefined symbols "NPI_USE_SPI" according to the second step of 《Cc2640 Adding a UART or SPI driver to a Sample Project》 ,  as shown in picture 1 .

    Can you find out other possible reasons why the compiling failed ? 

     

  • In the SDI folder of SPP project , only "sdi_tl_uart.c " can be found . "sdi_tl_spi.c" can never be found in the SDK,  as shown in picture 1. 

    Where can the  "sdi_tl_spi.c"  of SPP be downloaded ? 

  • Hi,

    You have to add the files to the project from here:
    C:\ti\simplelink_cc2640r2_sdk_1_40_00_45\source\ti\blestack\npi\src

    Best wishes
  • I am having the same issues with my CC2640 (non R2) project. I have found npi_tl_spi.h and npi_tl_spi.c, but after searching my entire hard drive I cannot fin the missing file that is throwing the error shown in the image. Where can spi_tl_spi.h be found?

  • Hi,

    You should replace all instance of sdi_tl_spi with npi_tl_spi (for ex. in sdi_tl.c) since you are using npi_tl_spi.h which should still work.

    Best wishes
  • I understand that npi_tl_spi adds the ability to use packets that are similar to bootloader packets. Will replacing all instance of sdi_tl_spi with npi_tl_spi force me to use packets to send/receive bytes?
  • Hi,

    If you do a diff between the NPI and SDI, you should see that the only file changed was npi_task/sdi_task. The other files were just cosmetic name changes. 

    You should be able to keep sdi_task and tweak it to use the original npi files that comes with the SDK. 

    Best wishes

  • Zahid Haq,

    I would love to do a diff. Where can spi_tl_spi.h be found?

  • For the latest CC2640 SDK, you should find the npi files in this directory:
    C:\ti\simplelink\ble_sdk_2_02_02_25\src\components\npi\src

    Best wishes
  • Where can spi_tl_spi.h be found?