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

Other Parts Discussed in Thread: CC2540

请问CC2540的串口修改应该在哪里修改呢?

 

  • 协议栈默认调用了NPI.C->NPI_InitTransport()

    你可以参考这个函数:

    void NPI_InitTransport( npiCBack_t npiCBack )
    {
      halUARTCfg_t uartConfig;

      // configure UART
      uartConfig.configured           = TRUE;
      uartConfig.baudRate             = NPI_UART_BR;
      uartConfig.flowControl          = NPI_UART_FC;
      uartConfig.flowControlThreshold = NPI_UART_FC_THRESHOLD;
      uartConfig.rx.maxBufSize        = NPI_UART_RX_BUF_SIZE;
      uartConfig.tx.maxBufSize        = NPI_UART_TX_BUF_SIZE;
      uartConfig.idleTimeout          = NPI_UART_IDLE_TIMEOUT;
      uartConfig.intEnable            = NPI_UART_INT_ENABLE;
      uartConfig.callBackFunc         = (halUARTCBack_t)npiCBack;

      // start UART
      // Note: Assumes no issue opening UART port.
      (void)HalUARTOpen( NPI_UART_PORT, &uartConfig );

      return;
    }

  • 你是要修改SimpleBLEPeripheral等 添加UART,还是修改hal_uart.c相关的协议栈源代码?,如果是前者,请下载TI ble WIKI里下载SerialApp的uart demo,里面包含了完整的UART使用设置。

    该demo需要配合ti的pc端的工具一起运行,建议复制SerialApp的UART部分代码,然后添加到SimpleBLEPeripheral等demo中,我这里写了一份详细的ble协议栈的uart使用指南,麻烦参考,见附件。

    BLE协议栈UART调试指南.pdf
  • 你好,有没有uart1的demo,谢谢