TI中文支持网
TI专业的中文技术问题搜集分享网站

SK-TDA4VM: 在mcu3_0中使用UART4发送数据,出现只发送一次数据问题,后面就不发送。

Part Number:SK-TDA4VM

1.帮忙看一下这个代码,用UART4发送数据时,为什么数据只发送一次,就发送不了了,

eg:如下代码执行,只收得到UART HELLO WORD,收不到字符串sssaannnh

char testIdPrompt[24] = "UART HELLO WORD\r\n";
char crPrompt[16] = "sssaannnh\r\n";
UART_write(uart, (void *)(uintptr_t)testIdPrompt, sizeof(testIdPrompt));
//Osal_delay(100);
UART_write(uart, (void *)(uintptr_t)crPrompt, sizeof(crPrompt));

#if 1
/* Define the UART test interface */
typedef struct UART_Tests_s
{bool(*testFunc)(bool);booldmaMode;int16_t  testId;chartestDesc[80];

} UART_Tests;

UART_PAR uartParity = UART_PAR_NONE;
uint32_t verifyLoopback = FALSE;

UART_Tests Uart_tests[] =
{{NULL, false, 1, "\r\n UART non-DMA read write test in block mode"},{NULL, }
};

static void UART_initConfig_test(bool dmaMode)
{UART_HwAttrs uart_cfg;/* Get the default UART init configurations */UART_socGetInitCfg(4, &uart_cfg);uart_cfg.edmaHandle = NULL;uart_cfg.dmaMode= FALSE;uart_cfg.loopback= verifyLoopback;/* Set the DMA enabled UART init configurations */UART_socSetInitCfg(4, &uart_cfg);
}



int UART_mcutest_print_test_desc22(UART_Tests *test)
{linData_tlinMasterData;UART_Handle uart = NULL;UART_Params uartParams;chartestIdPrompt[24] = "UART HELLO WORD\r\n";
	charcrPrompt[16] = "sssaannnh\r\n";chartestId[16] = {0, };int8_tstatus= 0;uint8_tprotectId= 0;UART_init();appLogPrintf("APP: Init  mcu2_1 print_test000 H0  EZHU... !!!\n");/* UART SoC init configuration */UART_initConfig_test(false);//关闭DMAappLogPrintf("APP: Init  mcu2_1 print_test111 HEZHU... !!!\n");/* Initialize the default configuration params. */UART_Params_init(&uartParams);uartParams.parityType = uartParity;appLogPrintf("APP: Init  mcu2_1 print_test222 HEZHU... !!!\n");uart = UART_open(4, &uartParams);if(uart == NULL){appLogPrintf("\nFailed to get the UART handle\n");return -1;}appLogPrintf("APP: Init  mcu2_1 print_test333 HEZHU... !!!\n");/* Print unit test ID */sprintf(testId, "%d", test->testId);UART_write(uart, (void *)(uintptr_t)testIdPrompt, sizeof(testIdPrompt));//Osal_delay(100);UART_write(uart, (void *)(uintptr_t)crPrompt, sizeof(crPrompt));UART_write(uart, (void *)(uintptr_t)testId, sizeof(testId));//UART_write(uart, (void *)(uintptr_t)crPrompt, sizeof(crPrompt));UART_close(uart);return 0;
}
#endif 

static void appMain(void* arg0, void* arg1)
{appUtilsTaskInit();appInit();appRun();appLogPrintf("APP: Init  mcu3_0 test_sta HEZHU... !!!\n");UART_mcutest_print_test_desc22(&Uart_tests[0]);appLogPrintf("APP: Init  mcu3_0 test_end HEZHU... !!!\n");#if 1while(1){appLogWaitMsecs(100u);}#elseappDeInit();#endif
}

void StartupEmulatorWaitFxn (void)
{volatile uint32_t enableDebug = 0;do{}while (enableDebug);
}

static uint8_t gTskStackMain[8*1024]
__attribute__ ((section(".bss:taskStackSection")))
__attribute__ ((aligned(8192)));

int main(void)
{TaskP_Params tskParams;TaskP_Handle task;Board_initCfg boardCfg;/* This is for debug purpose - see the description of function header */StartupEmulatorWaitFxn();boardCfg = BOARD_INIT_PINMUX_CONFIG |BOARD_INIT_MODULE_CLOCK;if (BOARD_SOK !=  Board_init(boardCfg)){appLogPrintf("Board_init failed!... \n");return (false);}OS_init();TaskP_Params_init(&tskParams);tskParams.priority = 8u;tskParams.stack = gTskStackMain;tskParams.stacksize = sizeof (gTskStackMain);task = TaskP_create(appMain, &tskParams);if(NULL == task){OS_stop();}OS_start();return 0;
}

uint32_t appGetDdrSharedHeapSize()
{return DDR_SHARED_MEM_SIZE;

}

zhu he:

使用的SDK版本是:ti-processor-sdk-rtos-j721e-evm-08_01_00_13

串口使用的参数都是使用的默认参数,请问是否是不是某个参数不对,导致只发送一次的,帮忙看一下。谢谢

希望尽快帮忙查看一下,急!!

由于项目紧急,直接联系电话:13212709586

,

Cherry Zhou:

您好我们已收到您的问题并升级到英文论坛寻求帮助,链接如下,如有答复将尽快回复您:

e2e.ti.com/…/sk-tda4vm-the-data-be-sent-only-once

,

Cherry Zhou:

您好,

请问您有用到SDK中的示例吗?

,

zhu he:

就是按照SDK中的示例操作的。

,

Cherry Zhou:

参考的是哪个示例?

,

zhu he:

SDK中这个文件中的测试示例,ti-processor-sdk-rtos-j721e-evm-08_01_00_13/pdk_jacinto_08_01_00_36/packages/ti/drv/uart/test/src/main_uart_test.c

赞(0)
未经允许不得转载:TI中文支持网 » SK-TDA4VM: 在mcu3_0中使用UART4发送数据,出现只发送一次数据问题,后面就不发送。
分享到: 更多 (0)