Forums

LPC2368 UART IRQ wrong data

Started by gaRek January 6, 2013
Hello

I have a painfull problem with UART running @ LPC2368. Global scope is that I'm doing echo_test and receiving different data than send. First thing that should be checked are clocks, thats ok - checked. But I've observed weird behaviour recently:

1) Making uart implementation in the same file which contains main function, PLL initialization - works fine!
2) Making uart in ../libuart/ --> as above -works fine.

But system must be flexible for next vendors which we would like to use and our directories structure looks like this:

3) ../SystemCtrl/LPC2368/libuart/ ---> not working.. symptoms:
3a) sending 0x31 from PC => board echo: 0x39,
3b) sending 0x01 form PC => board echo: 0xf9,
3c) sending 0x02 from PC => board echo: 0xf2
but:
3d) sending 0x32 from PC => board echo: 0x32!!

I don't know from where offset came from..Can anybod explain me why? I'm using eclipse for development but the same problem was found while using Crossworks (also GCC) but noone from rowley helped me..I have declared enough memory for irq, lss file looks quite good and I didn't see any abnormal behaviour. If there is something I should post please tell me. I'm so desperate to solve this problem..

Every hint will be great!

Best Regards,
Krzysztof.

An Engineer's Guide to the LPC2100 Series

Czescz, Krzysztof,

When I had similar problems, reason was hardware (RS232 level converter).
Sometime oscilloscope could help, just to be sure that hardware works fine.

Best regards
Vlad
Hello Vladimir!

Thank you for your reply!

I'm aware of HW problems but I'm couriose about that when I'm implementing this code all in one file (i.e main.c) than everything is ok. But when I separate code into directories (like it is in point 3 in my first mail) than I have transmission errors. I'm woundering if I need something else in my project options (long calls flag is already attached - just to be sure - still not working)? How nesting files in directories may cause such kind of errors?

Best regards,
Krzysztof.
Hmm strange behavior.
0. Check UART connect mode ( usually 8N1 is used).
1. Check cpu clk
Try to make an 1sec periodical process. For example:

Send 1char per 1sec. Count 100 chars and the time in computer. If you have
1 or 2 % error -- it is fine. If more than 10% -- it is a problem with
clock setting.

2. Do not try to do Echo -- instead try to send character a b c d ... x y z

If it is OK then there is normal RX from board to PC

3. Try to take some example from somebody (You are welcome to download and
compile examples from my project)

4. Are you board is OKay? 0x01 --> 0xf9 seems like signal inversion

Take a separate ground wire and connect PC ground and Board Ground. May be
there is a problems with Power Supply and it help you.
Oh moust of my advices are useless because the problem in build.

Well I think the problem is still in pll or UART divider initialization.