S908QG16 w/Serial Bean dropping TX data using _SendBlock / _SendChar

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

S908QG16 w/Serial Bean dropping TX data using _SendBlock / _SendChar

跳至解决方案
2,324 次查看
jamesarm97
Contributor II
I am fighting a problem with my serial transmit. The bean seems to be dropping data during transmits. If I put a delay between each call to SendChar the data goes out. If I use SendBlock immediately followed by some SendChar's I only get the data put in the buffer by the SendChar function. I have an output buffer defined by the bean and can see the data going into the buffer. The OutIndxW and OutIndxR keep up with each other. I have tried all baudrates from 300 to 9600 and they all have the same problem. Here is my test example: It is almost like the tx interrupt is sending the data too fast.

//I don't usually get this one even though I see it in the buffer.
AS1_SendBlock("HELLO THERE", 11, &grc);
Delay250ms(2);
 
//These all go out
for (ch=0; ch<20; ch++) {
      if (AS1_SendChar(ch+'0') != ERR_OK) {
        BlinkRedLED();
      }
      Delay250ms(1);
  }

CW 6.1
**     THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
**     Filename  : AS1.C
**     Project   :
**     Processor : MC9S08QG8CDT
**     Beantype  : AsynchroSerial
**     Version   : Bean 02.433, Driver 01.23, CPU db: 2.87.119
**     Compiler  : CodeWarrior HCS08 C Compiler
**     Date/Time : 12/4/2007, 10:01 AM

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
867 次查看
CompilerGuru
NXP Employee
NXP Employee
Your code does not check the return value of AS1_SendBlock or the out parameter grc.
With interrupt driven, buffered output. a loop like
for (;:smileywink: {
  AS1_SendBlock("HELLO THERE", 11, &grc);
}

sends in 99 % nothing, and in 1% (or less), the AS1_SendBlock just sends the H.
Basically the first few AS1_SendBlock calls fill the buffer, and once the buffer is full AS1_SendBlock just returns that it did not send anything. Once a byte got send, a subsequent AS1_SendBlock just sends out the first character, a 'H'.

Daniel

在原帖中查看解决方案

0 项奖励
回复
1 回复
868 次查看
CompilerGuru
NXP Employee
NXP Employee
Your code does not check the return value of AS1_SendBlock or the out parameter grc.
With interrupt driven, buffered output. a loop like
for (;:smileywink: {
  AS1_SendBlock("HELLO THERE", 11, &grc);
}

sends in 99 % nothing, and in 1% (or less), the AS1_SendBlock just sends the H.
Basically the first few AS1_SendBlock calls fill the buffer, and once the buffer is full AS1_SendBlock just returns that it did not send anything. Once a byte got send, a subsequent AS1_SendBlock just sends out the first character, a 'H'.

Daniel
0 项奖励
回复