查看: 3126|回复: 3

[已解决] KL15关于串口通讯的问题!!!(已解决)

[复制链接]

该用户从未签到

29

主题

56

帖子

0

中级会员

Rank: 3Rank: 3

积分
238
最后登录
1970-1-1
发表于 2013-7-18 11:14:40 | 显示全部楼层 |阅读模式
各位好,我在调试KL15MCU过程中遇到如下问题:串口发送时连续发送数据会出现数据重复现象,比如发送字符“Yes”接收到的数据可能是"YYYeeeesss"诸如此类,另外使用串口中断接收数据时,对于上位机发送的多字节数据MCU只能进行一次中断响应,之后就无法引起串口接收的中断,导致仅能接收到一字节数据,望给予指点,谢谢。
我知道答案 目前已有2人回答
回复

使用道具 举报

该用户从未签到

124

主题

3600

帖子

0

金牌会员

Rank: 6Rank: 6

积分
5781
最后登录
1970-1-1
发表于 2013-7-18 12:00:49 | 显示全部楼层

RE:KL15关于串口通讯的问题!!!

检查你主程序和中断函数中的中断设置是否正确,建议可以把你的代码贴出,可以有更多的人帮你检查。
回复 支持 反对

使用道具 举报

该用户从未签到

29

主题

56

帖子

0

中级会员

Rank: 3Rank: 3

积分
238
最后登录
1970-1-1
 楼主| 发表于 2013-7-22 10:54:54 | 显示全部楼层

RE:KL15关于串口通讯的问题!!!

串口使用PE初始化,设置如下:
/** ###################################################################
**     THIS COMPONENT MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
**     Filename    : UART1.c
**     Project     : ProcessorExpert
**     Processor   : MKL15Z128VFM4
**     Component   : AsynchroSerial
**     Version     : Component 02.601, Driver 01.00, CPU db: 3.00.000
**     Compiler    : IAR ARM C Compiler
**     Date/Time   : 2013-07-15, 16:33, # CodeGen: 84
**     Abstract    :
**         This component "AsynchroSerial" implements an asynchronous serial
**         communication. The component supports different settings of
**         parity, word width, stop-bit and communication speed,
**         user can select interrupt or polling handler.
**         Communication speed can be changed also in runtime.
**         The component requires one on-chip asynchronous serial channel.
**     Settings    :
**         Serial channel              : UART1
**
**         Protocol
**             Width                   : 8 bits
**             Stop bits               : 1
**             Parity                  : none
**             Breaks                  : Disabled
**             Input buffer size       : 0
**             Output buffer size      : 0
**
**         Registers
**
**         Input interrupt
**             Vector name             : INT_UART1
**             Priority                : 0
**
**         Output interrupt
**             Vector name             : INT_UART1
**             Priority                : 0
**
**         Used pins:
**         ----------------------------------------------------------
**           Function | On package           |    Name
**         ----------------------------------------------------------
**            Input   |     2                |  PTE1/SPI1_MOSI/UART1_RX/SPI1_MISO/I2C1_SCL
**            Output  |     1                |  PTE0/UART1_TX/RTC_CLKOUT/CMP0_OUT/I2C1_SDA
**         ----------------------------------------------------------
**
**
**
**     Contents    :
**         RecvChar        - byte UART1_RecvChar(UART1_TComData *Chr);
**         SendChar        - byte UART1_SendChar(UART1_TComData Chr);
**         GetCharsInRxBuf - word UART1_GetCharsInRxBuf(void);
**         GetCharsInTxBuf - word UART1_GetCharsInTxBuf(void);
**
**     Copyright : 1997 - 2012 Freescale, Inc. All Rights Reserved.
**     
**     http      : www.freescale.com
**     mail      : support@freescale.com
** ###################################################################*/
串口发送数据:
void USART_OUT(uint8_t *Data,uint16_t Len)
{
        uint16_t i;
        for(i=0; i
回复 支持 反对

使用道具 举报

该用户从未签到

85

主题

790

帖子

0

金牌会员

Rank: 6Rank: 6

积分
2279
最后登录
1970-1-1
发表于 2013-7-22 11:26:23 | 显示全部楼层

RE:KL15关于串口通讯的问题!!!(正解)

你这种连续发送的情况,建议使用DMA的方式,在我们官网的例程中有这方面应用的例程,你可以去参考一下。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 注册/登录

本版积分规则

关闭

站长推荐上一条 /3 下一条

Archiver|手机版|小黑屋|恩智浦技术社区

GMT+8, 2025-7-20 08:06 , Processed in 0.090203 second(s), 24 queries , MemCache On.

Powered by Discuz! X3.4

Copyright © 2001-2024, Tencent Cloud.

快速回复 返回顶部 返回列表