打印
[Kinetis]

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

[复制链接]
789|7
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
新手,在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链接都发不了。。
那只能贴代码了

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

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


  /* Write your local variable definition here */

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

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

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

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


  }
  /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/

使用特权

评论回复
5
tianranyixiao|  楼主 | 2015-12-12 23:05 | 只看该作者
最后还是把工程文件附件发上来了
pan.baidu.com/s/1pJVM9Wv

使用特权

评论回复
6
Micachl| | 2015-12-13 20:38 | 只看该作者
这是单步调试的时候在这个函数里面出不来吗

使用特权

评论回复
7
NXP_TICS_Jeremy| | 2015-12-14 09:21 | 只看该作者
首先在Debug的时候,确认一下UART0的寄存器初始化是否正确,包括传输模式,波特率选择等待

使用特权

评论回复
8
NXP_TICS_Robin| | 2015-12-15 09:18 | 只看该作者
建议楼主下载最新的Kinetis SDK 1.3 Mainline,新版本会修复一些老版本bug。
另外建议将工程压缩后,通过此附件按钮上传到帖子里。

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

1

主题

5

帖子

0

粉丝