AsynchroSerial connection with hyperterminal randomly quits working

cancel
Showing results for 
Search instead for 
Did you mean: 

AsynchroSerial connection with hyperterminal randomly quits working

Jump to solution
1,251 Views
lander
Contributor IV

I'm sending characters (AS1_SendChar(65);) to the HyperTerminal using the AsynchroSerial component from PE on CW 10.3 and sometimes it sends out the correct character but it mostly sends out a symbol shaped like a capital "L".  I'm using a K20 board on the TWR-SER tower and it took me a while to figure out the UART connections and such and I finally found the connection and then it just quit working every time.  I did restart both machines (the HyperTerminal is on a separate machine) and then the character showed up twice but just quit again.

My code is real simple, just the AS1_SendChar(65); function in the processor expert main.

If there is any other information needed, let me know. 

Thanks,

Liz   

0 Kudos
1 Solution
251 Views
Petr_H
NXP Employee
NXP Employee

Hi,

I have tried the project and I seem to have reproduced the behavior (I was getting 'A' instead of 'C' -char 67). Please see my comment below:

- The project uses internal oscillator instead of external crystal. The internal oscillator is not so accurate so the baud-rate might be also not accurate. The board is populated with 8MHz crystal so you  can change the clock settings in the CPU component to use it. After re-configuring to external crystal, the application works correctly - see the attached screenshot showing what I have set.

The internal oscillator may be made more accurate using "Trimming", but I don't know if this can be done using on-board OSJTAG, please see the documentation of the debug interface and debugger.

- I don't know if you have a previous experience with Processor Expert. The components IntFlash and AsynchroSerial are  "High Level Components" that come from older architectures like HCS08 and HCS12. They now can be used on Kinetis as well, however, they are internally using (inheriting) "LDD" components - you can see them when you "unfold" the component. On Kinetis, the LDD components usually provide more flexibility and features than High Level Components that ore oriented to compatibility with existing projects.

- You are sending only one character when the application starts. The problem might be when you reset the CPU that the pins may be in undefined state and there might be a glitch on the serial pin that would be received by the terminal as a first bit and an incorrect character might be received. But this is probably not case here, when the application is started by debugger.

best regards

Petr Hradsky

Processor Expert Support Team

View solution in original post

0 Kudos
5 Replies
251 Views
Petr_H
NXP Employee
NXP Employee

Hi,

please post a  project (a simplified version with just a CPU and serial component would be ok) showing the components setup and use.

best regards

Petr Hradsky

Processor Expert Support Team

0 Kudos
251 Views
lander
Contributor IV

Please see attached. 

0 Kudos
252 Views
Petr_H
NXP Employee
NXP Employee

Hi,

I have tried the project and I seem to have reproduced the behavior (I was getting 'A' instead of 'C' -char 67). Please see my comment below:

- The project uses internal oscillator instead of external crystal. The internal oscillator is not so accurate so the baud-rate might be also not accurate. The board is populated with 8MHz crystal so you  can change the clock settings in the CPU component to use it. After re-configuring to external crystal, the application works correctly - see the attached screenshot showing what I have set.

The internal oscillator may be made more accurate using "Trimming", but I don't know if this can be done using on-board OSJTAG, please see the documentation of the debug interface and debugger.

- I don't know if you have a previous experience with Processor Expert. The components IntFlash and AsynchroSerial are  "High Level Components" that come from older architectures like HCS08 and HCS12. They now can be used on Kinetis as well, however, they are internally using (inheriting) "LDD" components - you can see them when you "unfold" the component. On Kinetis, the LDD components usually provide more flexibility and features than High Level Components that ore oriented to compatibility with existing projects.

- You are sending only one character when the application starts. The problem might be when you reset the CPU that the pins may be in undefined state and there might be a glitch on the serial pin that would be received by the terminal as a first bit and an incorrect character might be received. But this is probably not case here, when the application is started by debugger.

best regards

Petr Hradsky

Processor Expert Support Team

View solution in original post

0 Kudos
251 Views
lander
Contributor IV

It is working!  Thank you.  The only thing is, the transmit is working fine now but the receive isn't working.  I'll copy and paste the chunk of code where I'm trying to receive from the console below.

// UART testing

// Receive a char and transmit char+1. (i.e receive A, transmit B)

for(i = 0;; i++){

     if(AS1_GetCharsInRxBuf() > 0){

     (void)AS1_RecvChar(&rec);

     (void)AS1_SendChar((AS1_TComData)(rec + 1));
}

0 Kudos
251 Views
Petr_H
NXP Employee
NXP Employee

Hi,

you should check error code returned by the functions.

I'd rather try it like this:

for (;;) {

  if (AS1_RecvChar(&rec) == ERR_OK) {

     (void)AS1_SendChar((AS1_TComData)(rec + 1));

  }

}

then try to check in debugger if you get to the sendchar line...


best regards

Petr Hradsky

Processor Expert Support Team

0 Kudos