Garbled text from UART test

140 views
Skip to first unread message

Jeff

unread,
Feb 26, 2012, 10:44:30 AM2/26/12
to pic24-assemb...@googlegroups.com
I'm have been working at testing the UART and I'm getting a mess of special characters when I run a test.  I have my setup wired as on page 255, plus the LED and buttons later on.  I have tested with both a PIC24FJ32GA002 and PIC24HJ32GP202 with the same results.  I get the same results weather I use RealTerm, TeraTerm or the bootloader program.

I have looked through many of the files and I don't see anything that isn't correct.  My guess is it's a setting I don't have correct but I just can't get it.  I have been testing my setup with the  ledswc1.c example and everything works as expected with this, except the UART test.

Thanks for your help.

Jeff

Bryan A. Jones

unread,
Feb 27, 2012, 3:33:40 PM2/27/12
to pic24-assemb...@googlegroups.com
Jeff,

Some idea:

1. What baud rate do you use? lib/pic24_libconfig.h has a #define DEFAULT_BAUDRATE -- what is that set to? Does it agree with your terminal program? I assume you use no parity 8 data bit 1 stop bit.

2. Do you have an oscope or logic analyzer? If so, what is the measured baud rate? 1/(time of a bit) = baud rate, of course.

3. Connect tx and rx on your FTDI cable to make sure it echos characters properly.

Hope that helps!

Bryan



Jeff

--
You received this message because you are subscribed to the Google Groups "PIC24 Assembly-to-C Book" group.
To view this discussion on the web visit https://groups.google.com/d/msg/pic24-assembly-to-c-book/-/z_BCtyGgQzMJ.
To post to this group, send email to pic24-assemb...@googlegroups.com.
To unsubscribe from this group, send email to pic24-assembly-to-...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pic24-assembly-to-c-book?hl=en.



--
Bryan A. Jones, Ph.D.
Associate Professor
Department of Electrical and Computer Engineering
231 Simrall / PO Box 9571
Mississippi State University
Mississippi state, MS 39762
http://www.ece.msstate.edu/~bjones
bjones AT ece DOT msstate DOT edu
voice 662-325-3149
fax 662-325-2298

Our Master, Jesus Christ, is on his way. He'll show up right on
time, his arrival guaranteed by the Blessed and Undisputed Ruler,
High King, High God.
- 1 Tim. 6:14b-15 (The Message)

Jeff

unread,
Feb 27, 2012, 10:47:36 PM2/27/12
to pic24-assemb...@googlegroups.com
I was able to verify:

DEFAULT_BAUDRATE is set to 57600, the same as the terminal program.
An echo test is positive and works as expected through PuTTY

I don't have a scope, but it is on my list of items needed to be able to troubleshoot.  I have been researching options, but just have not decided what to purchase yet.

I loaded up the echo.c test code and the terminal starts displaying characters without interaction.  I think I my breadboard may have an incorrect setup.  I think will start over with a new breadboard setup and see where it leads me.

Thanks for the help.

Jeff

Jeff

unread,
Feb 27, 2012, 11:54:02 PM2/27/12
to pic24-assemb...@googlegroups.com
Rebuilt a Breadboard using a PIC24FJ32GA002 and loaded the echo.c and I get this.

I'm getting closer to a learning experience.  I'm just not sure what it is.

*****************************************************                          
* WARNING - this program was compiled for the wrong *                          
* chip or for an unknown revision of this chip!     *                          
* This program may produce unexpected behvior! Edit *                          
* the header files to properly define this chip or  *                          
* revision and to insure correct operation.         *                          
*                                                   *                          
* NOTE: If this was compiled for the correct chip,  *                          
* and only occurs at power-on (not during a MCLR    *                          
* reset, verify that AVDD and AVSS are connected.   *                          
* On the PIC24H32GP202, not connecting AVDD         *                          
* produces this message only at power-up.           *                          
*****************************************************                          
Fast RC Osc withü                                                              
Reset cause: Software Reset.                                                   
Error trapped: Unhandled interrupt,                                            
                                                                               
Device ID = 0x00000445 (PIC24FJ32GA002), revision 0x00003046 (unknown)



On Sunday, February 26, 2012 9:44:30 AM UTC-6, Jeff wrote:
On Sunday, February 26, 2012 9:44:30 AM UTC-6, Jeff wrote:

Bryan A. Jones

unread,
Feb 29, 2012, 7:36:15 PM2/29/12
to pic24-assemb...@googlegroups.com
Jeff,

The warning text can be ignored for now -- the library doesn't know about the specific rev of chip you're using, but that's not a problem. I'm surprised by an unhandled interrupt. Can you try again with a PIC24HJ32GP202, since it should print more info on the unhandled interrupt.

Bryan

--
You received this message because you are subscribed to the Google Groups "PIC24 Assembly-to-C Book" group.

To post to this group, send email to pic24-assemb...@googlegroups.com.
To unsubscribe from this group, send email to pic24-assembly-to-...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pic24-assembly-to-c-book?hl=en.

Jeff Lambert

unread,
Feb 29, 2012, 11:29:05 PM2/29/12
to pic24-assemb...@googlegroups.com
Bryan,

I tried it with the pic24hj32gp202.  The output is below.

Device ID = 0x00000F1D (PIC24HJ32GP202), revision 0x00003005 (A5)              
Fast RC Osc withþ                                                              
Reset cause: Software Reset.                                                   
Error trapped: Unhandled interrupt, Priority: 0x0D, Vector number: 0x02

Thanks Jeff

Bryan A. Jones

unread,
Mar 1, 2012, 11:22:27 AM3/1/12
to pic24-assemb...@googlegroups.com
Jeff,

Thanks. Per figure 9.3 in chapter 9, vector 2 is an address error (a word pointer referencing an odd address, typically). Have you modified the code in any way? Also, do you have the latest version of the library from http://www.ece.msstate.edu/courses/ece3724/main_pic24/labs/files/pic24_code_examples.zip?

Jeff Lambert

unread,
Mar 8, 2012, 11:38:25 AM3/8/12
to pic24-assemb...@googlegroups.com
I ordered a Microstick and tested the existing code base with with no change.  I then watched the video for the Microstick setup and downloaded the code at the link you provided.  Once this was done, I edited the code per the video and the "reset" example now works.

I'll go back and try my breadboard examples with the new code and verify.

Thank you.
Reply all
Reply to author
Forward
0 new messages