[Kinetis] KSDK1.2里的uart0串口怎么用?

[复制链接]
1199|7
 楼主| tianranyixiao 发表于 2015-12-12 22:02 | 显示全部楼层 |阅读模式
新手,在KDS下用KSDK1.2和PE建了一个KL16Z64系列的uart0串口程序,按照API手册里的例子发送数据,然而程序跑的时候一直卡在 LPSCI_DRV_SendDataBlocking函数里,不知道为什么,求助!
 楼主| tianranyixiao 发表于 2015-12-12 22:04 | 显示全部楼层
本帖最后由 tianranyixiao 于 2015-12-12 23:06 编辑

附工程文件pan.baidu.com/s/1pJVM9Wv
 楼主| tianranyixiao 发表于 2015-12-12 22:07 | 显示全部楼层
附件怎么上传不了?
 楼主| tianranyixiao 发表于 2015-12-12 23:01 | 显示全部楼层
我去,连URL链接都发不了。。
那只能贴代码了

  1. int main(void)
  2. /*lint -restore Enable MISRA rule (6.3) checking. */
  3. {

  4.         uint8_t sourceBuff[26] ={'hello'}; // sourceBuff is populated with desired data
  5.         uint8_t readBuffer[10] = {0}; // readBuffer is populated with LPSCI_DRV_ReceiveData function
  6.         uint32_t byteCount = sizeof(sourceBuff);
  7.         uint32_t rxRemainingSize = sizeof(readBuffer);
  8.         // for each use there, set timeout as "1"
  9.         // lpsciState is the run-time state. Pass in memory for this
  10.         // declared previously in the initialization chapter


  11.   /* Write your local variable definition here */

  12.   /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
  13.   PE_low_level_init();
  14.   /*** End of Processor Expert internal initialization.                    ***/

  15.   /*** Don't write any code pass this line, or it will be deleted during code generation. ***/
  16.   /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/
  17.   #ifdef PEX_RTOS_START
  18.     PEX_RTOS_START();                  /* Startup of the selected RTOS. Macro is defined by the RTOS component. */
  19.   #endif
  20.   /*** End of RTOS startup code.  ***/
  21.   /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/

  22.     LPSCI_DRV_SendDataBlocking(&lpsciCom1_State, sourceBuff, byteCount, 1); // function won’t return until transmit is complete
  23.   for(;;){

  24.           LPSCI_DRV_ReceiveDataBlocking(&lpsciCom1_State, readBuffer, 1, 1); //function won’t return until it receives all data


  25.   }
  26.   /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
  27. } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
 楼主| tianranyixiao 发表于 2015-12-12 23:05 | 显示全部楼层
最后还是把工程文件附件发上来了
pan.baidu.com/s/1pJVM9Wv
Micachl 发表于 2015-12-13 20:38 | 显示全部楼层
这是单步调试的时候在这个函数里面出不来吗
NXP_TICS_Jeremy 发表于 2015-12-14 09:21 | 显示全部楼层
首先在Debug的时候,确认一下UART0的寄存器初始化是否正确,包括传输模式,波特率选择等待
NXP_TICS_Robin 发表于 2015-12-15 09:18 | 显示全部楼层
建议楼主下载最新的Kinetis SDK 1.3 Mainline,新版本会修复一些老版本bug。
另外建议将工程压缩后,通过此附件按钮上传到帖子里。
附件.jpg
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

主题

5

帖子

0

粉丝
快速回复 在线客服 返回列表 返回顶部