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.

[参考译文] CC2541:CC2541串行通信

Guru**** 2546020 points
Other Parts Discussed in Thread: CC2541

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/578558/cc2541-cc2541-serial-communication

器件型号:CC2541

您好!

我正在尝试通过 UART 与 Arduino 通信。 我想从 Arduino 读取一些值并将其发送到 CC2541。  

我已经了解了 TIWiki 中的许多示例代码、但当我尝试开发自己的代码时、它不起作用。

我真的不知道我做了什么、这是因为代码、除了我直接使用 hal_UART、基本上是相同的:

void SerialInterface_Init( uint8 task_id )
{

serialInterface_TaskID = task_id;

//配置 UART 和寄存器回调函
数 halUARTCfg_t uartConfig;

//配置 UART
uartConfig.configured = true;
uartConfig.波特 率 = HAL_UART_BR_9600;
uartConfig.FlowControl = false;
uartConfig.flowControlThreshold = UART_FC_threshold;
uartConfig.Rx.maxBufSize = UART_RX_BUF_SIZE;
uartConfig.TX.maxBufSize = UART_TX_BUF_SIZE;
uartConfig.idleTimeout = UART_IDLE_TIMEOUT;
uartConfig.intEnable = UART_INT_ENABLE;
uartConfig.callBackFunc =(halUARTCBack_t) cSerialPacketParser;

//启动 UART
//注意:假定打开 UART 端口没有问题。
HalUARTOpen (UART_PORT,&uartConfig);
}


//用于获取 UART 数据
的回调函数 void cSerialPacketParser (uint8端口,uint8事件)
{
uint8 bytesLeft= NPI_RxBufLen ();
uint8 totalBytes = bytesbut;
//alloc_toc_ategetf

(*)

//获取缓冲区
HalUARTRead (UART_PORT、temp_Buf、totalBytes);

for (int i=0;i< totalBytes;i++)
printf (temp_buf[i]);

OSAL_mem_free (temp_Buf);
} 

结果是、尽管我仔细检查 Arduino 正在传输、但它不会读取任何内容。

谢谢!

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    在进行 UART 接收时是否禁用节能?
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    此项目完全禁用节能功能。 常开。

    预处理器值:

    INT_HEPASS_LEN=2048
    HALNODEBUG
    OSAL_CBTIMER_NUM_TESS=1
    HAL_AES_DMA=true
    HAL_DMA=true
    xPLUS_Broadcaster
    HAL_LCD=true
    HAL_LED=false
    HAL_key=true
    xHAL_UART_ISR=0
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    已解决、

    这是预处理器、我需要:

    HAL_UART=true
    HAL_UART_DMA=1


    谢谢、抱歉!