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/LAUNCHXL-CC2650:UART 代码不工作

Guru**** 2589275 points
Other Parts Discussed in Thread: CC2650

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

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/601664/ccs-launchxl-cc2650-uart-code-not-working

器件型号:LAUNCHXL-CC2650
Thread 中讨论的其他器件:CC2650

工具/软件:Code Composer Studio

你好!

我将 CC2650 Launchpad 与 CCS 搭配使用、并尝试通过 UART 将接收到的 advdata (信标)发送到我的 PC。  

我已经对 simple_peripheral_observer.c 文件和 main.c 文件中的代码进行了更改。 这是我的代码-  

包括-  

#include 
#include 

#include 
#include 
#include 
#include 
#include 
#include 
#include 

include "hci_tl.h"
#include "gatt.h"
#include "linkdb.h"
#include "gapgattserver.h"
#include "gattservapp.h"
#include "devinfoservice.h"
#include "simple_gatt_profile.h"

#if defined (feature_oad_oad.h)| defender"image_udit_nature_nature_en/h"


#include #include "nosrnature.包含#nature.包含#nature.h"#include #nec.nature.h










#include #include "#nosrg.nature.h"#include #include "#nosrg.包含#nature.h #include #include "nosrnature.包含#nature.nec.nature.h"#include "#nec.h #include "#include "#nature.nosrnature.h



#include "board_key.h"
#include "board.h"

#include "simple_peripheral_ob观察团.h"

#include 
#include 
#include 
#include "inc/hw_memmap.h"
#include "inc/hw_ints.h"

#include 

#include 
#include 

#include "iCall.h"
#include "hal_types.h" 

main.c 中的函数声明-  

extern void SimpleUART_createTask (void); 

simple_peripheral_observer.c 中的函数声明-  

静态空 SimpleUART_taskFxn (UARg a0、UARg A1); 

main.c 中的函数调用-  

SimpleUART_createTask(); 

simple_peripheral_observer.c 中的函数主体-  

void SimpleUART_createTask (void)
{
Task_Params taskParams;
//Board_initGeneral ();
//Board_initUART ();

Task_Params_init (&taskParams);
taskParams.STACKSIZE = TASKSTACKSIZE;
taskParams.stack =&task0Stack;
Task_construct(&task0Struct,(Task_Functr )SimpleUART_taskFxn,&taskParams,NULL );
} 

simple_peripheral_observer.c 中的函数主体-  

静态空 SimpleUART_taskFxn (UARg a0、UARg A1)
{
UART_Handle UART;
UART_Params uartParams;

//uart_init();
const char hello[]="UART 正在工作。\n";

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 = 9600;

UART = UART_OPEN (Board_UART0、uartParams);
如果(UART == NULL)
{
fflush (stdout);
printf ("UART 未打开。");
}
int 编号;
Number = UART_WRITE (UART、hello、sizeof (hello));
fflush (stdout);
printf ("UART 写入%d 个字节。\n"、编号);

}

代码构建完美、没有任何错误。 但是、我收到了警告-

"无效的工程路径:找到重复的路径条目(/simple_peripheral_observer _cc2650lp_app [包含路径] isSystemInclude:true includedPath:C:/ti/tirtos_cc13xx_cc26xx_2_20_01_08/products/tidrivers_cc13xx_cc26xx_2_20_01_10/packages)、路径:[/ssimple_peripheral_observer:cc2650lp_app]"

代码开始调试、但 UART 端口未打开。 我的代码是错误的吗? 或者、我是否需要在任何头文件中进行更改? 或者我的代码是否由于警告而无法正常工作?  

请为我提供解决方案建议。 提前感谢。

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

    除了 UART 不工作外、Simple Peripheral Observer 项目是否仍按预期运行? 您能看到广告吗?

    由于警告、我认为代码不起作用。 您是否将 UART 用于应用中的其他任何内容?
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    If UART is not opening, instead of

        if(uart == NULL)

        {
            fflush(stdout);
            printf("UART did not open.");
        }
    请尝试

    while (hUART == NULL)

      //nop

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

    您好!

    我首先尝试了'while (hUART == NULL)'、这给了我一个错误- 'hUART is undefined'

    因此、我使用 printf 语句尝试了'while (UART == NULL)'、并在控制台窗口中连续打印了"UART Did Not Open"。

    如何打开 UART?

    提前感谢。

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

    我正在使用 UART 将 AdvData 发送到 PC。 稍后、我将使用 UART 将 AdvData 发送到另一个 MCU。

    我已禁用外设代码的广播部分、以便将 CC2650配置为仅用作观测器、因此无法在 IO 应用程序上找到任何信标。

    除此之外、我不知道观测器是否正在接收信标。 您能建议我一种方法吗?

    提前感谢