MCF51QE128 SCI1 Framing and Noise Errors (DEMOQE board)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MCF51QE128 SCI1 Framing and Noise Errors (DEMOQE board)

2,220 Views
jmaniak
Contributor I
I'm working with a MCF51QE128 on a DEMOQE board, developing C code using the AsynchroSerial bean provided by CodeWarrior for MicroControllers V6.1.  (Only the TX and RX lines seem to be connected to the RS-232 connection)

My goal is to have the AS1_OnRxChar subroutine store received data into an array. Basically, a 3-byte message (row(0 to 47), column(0 to 95), value(0 to 255)) is required to update an entry in the array. The Events.c file containing the relevant subroutine is attached.

Currently, I am using HyperTerminal (57600 Baud, 8-N-1 : the same set up as in the bean) to check if the array is being updated properly. Although sometimes the array may be somewhat updated, most of the time Framing and Noise errors are being flagged.

From similar posts, I saw that these errors often resulted from baudrate mismatches.  The Bean Inspector shows that the internal bus clock is running at 25.165824 MHz, and the actual baud rate for SCI1 is 58254.222 baud.

I thought that this was the issue, so I've tried dropping the baud rate down to 2400 baud, which gives an ~2401 baud on SCI1, according to the Bean Inspector - still getting the Framing and Noise errors. I was worried that my laptop might be Tx'ing at a bad speed, so I tried using minicom on a different machine, with the same errors. I've also attached an capture from my super cheap scope.  (Probing the RX pin on the MCU port of the DEMOQE board, while receiving a " " )

Thinking that my subroutine was simply too slow compared to the rate at which data was being received, I tried commenting everything out in the subroutine except the AS1_RecvChar call and the error check - still getting the errors.

Could anyone give me some advice as to how I could go about cleanly receiving data via the RS232 connection on this board?  Please let me know what additional information I can provide that could help resolve this issue. I apologize that the capture from the scope may not be of much use, I'm a bit limited as it's a $100 DSO-101. If there's something in particular anyone wants to see, let me know and I'll do my best to get a decent capture and annotate the waveform.






Message Edited by jmaniak on 2008-03-02 11:44 PM
Labels (1)
0 Kudos
4 Replies

409 Views
ProcessorExpert
Senior Contributor III
To achieve baudrate 115200 the Internal bus clock frequency must be an integer multiple (1,2,3,..) of 1.843 MHz (115200 * 16). To achieve a suitable bus clock value using the Internal Clock Source module a specific value of reference clock (either internal or external) must be used. For baudrate 115200 a possible values of reference clock are 32.4kHz and 36kHz (see attached xls file for more detailed info).

Calculation of the communication speed can be found in the Timing dialog of the "Baud rate" property on tab Clock path (Clock path table is available in Advanced or Expert view modes only).

It is difficult to say whether it is better to use the internal clock or external clock source. It depends on the current user application. For communication via serial bus correctly trimmed internal clock is sufficient. If you are not using the factory value of the trim oscillator the "Initialize trim value" property should be set to “yes” and the "Use custom trim reference frequency" option in "P&E Connection Manager" window should be correspond to the value in the "Internal oscillator frequency" property.

Here you can find more information about some problems with trimming of the internal oscillator:
http://forums.freescale.com/freescale/board/message?board.id=8BITCOMM&message.id=8842&query.id=65552...

Processor Expert Support Team
www.processorexpert.com


Message Edited by ProcessorExpert on 2008-05-06 10:09 AM
0 Kudos

409 Views
jmaniak
Contributor I
Thanks for the excellent explanation and spreadsheet. That really helped us get the CPU bean configured correctly - we're now getting a baud rate of 115200 without framing or noise errors.

For future reference, where could I find documents such as that spreadsheet? Before posting, I searched through these forums and the Processor Expert website (and of course the datasheet, which is a bit tough to digest), but didn't come across anything like that.  It would certainly be useful to know of another place to reference before making a forum post.

Thanks again,
Jon


Message Edited by jmaniak on 2008-05-09 12:39 AM
0 Kudos

409 Views
ProcessorExpert
Senior Contributor III
The described problem could be caused by incorrect setting of the bus clock frequency. Could you please specify your clock setting of the cpu bean?
What clock source are you using - External Clock or Internal Clock? In case you are using the Internal Clock, is the internal oscillator trimmed correctly?

Processor Expert Support Team
www.processorexpert.com
0 Kudos

409 Views
jmaniak
Contributor I
Hi, thank you for your assistance. This is the first project I've worked on with this device and Processor Expert, so it is quite possible that I've misconfigured something.

I've tried a few bus clock frequencies, but the at the last build, the device was configured to run in high speed mode, using the internal clock.  The Internal Bus clock frequency was 4.194304 MHz.

Under the Internal clock settings, the internal oscillator frequency is set to 32.768 kHz, with "Initialize trim value"  set to 'no' -- so this may be the culprit? Would it be a better idea to use the external clock provided on the demo board?

I've attached screenshots of the Bean Inspector for both the CPU and AsynchroSerial beans, just to provide any additional information I missed here.

My goal is to send data to the board from the RS-232 port of my laptop.  I'd be happy if I could achieve any fairly high baud rates (saw that 115200 baud was achieved the assembly example), at least 9600.

Thanks again for your time and help.
0 Kudos