UART problem

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

UART problem

723 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jappelino on Thu Jan 28 06:15:41 MST 2010
Hi,

I am running the cortex M0 board hooked up to a XBEE Zigbee module. The first incoming characters are ok, but in the middle it seems like the same character is copied two extra times.

I am running at 38400, the data has previously been picked up with no problems on a bit banged software on a much smaller cpu.

Anybody experienced something simular or seen some errata on this?
0 Kudos
Reply
11 Replies

714 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jappelino on Sat Feb 13 06:10:34 MST 2010
I tried to download my projet frpm the Forum to another PC. In order to get it to build you need to have the example project for the 1100 series installed. The problem remains however
0 Kudos
Reply

714 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jappelino on Sat Feb 06 03:47:40 MST 2010
Ok here is the project, everything should be included.
0 Kudos
Reply

714 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_USA on Fri Feb 05 11:25:51 MST 2010

Quote: jappelino
I tried the new linker comand and made a clean build but the result is the same.

The buffer reading the UARTH port is global and the int buffer is local



Are you compiling with optimization or in a Release configuration?

Optimization can confuse source-level debuggers by deleting variables and re-arranging the code to reduce size and increase speed. Is it possible you could post your entire project? If so, use the Export feature on the LPCXpresso Quick Start panel and attach it to your posting.

Thank you,
-NXP
0 Kudos
Reply

714 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jappelino on Thu Feb 04 10:30:36 MST 2010
I tried the new linker comand and made a clean build but the result is the same.

The buffer reading the UARTH port is global and the int buffer is local
0 Kudos
Reply

714 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Thu Feb 04 03:53:15 MST 2010
Jappelino,

Can you try removing the "--gc-sections" option from:

Project Properties->C/C++ Build->Settings->MCU Linker->Miscellaneous

and see if you now see the correct variable value?

Also can you confirm whether the variables where you see the incorrect value are actually locals or globals?

With regards to your question about using printf,  please see the knowledgebase entry "Using printf in your applications" at:

http://lpcxpresso.code-red-tech.com/LPCXpresso/node/20

Regards,

CodeRedSupport.
0 Kudos
Reply

714 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jappelino on Tue Feb 02 11:20:12 MST 2010
[SIZE=2][COLOR=#005032][SIZE=2][COLOR=#005032]UARTHBuffer is declared as uint8_t which is declared as [B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]
unsigned[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#000000] [/COLOR][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]char
[/B][/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE][/COLOR][/SIZE]
0 Kudos
Reply

714 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jappelino on Tue Feb 02 00:16:05 MST 2010
the ub_16 is declared as an int, the UARTHBuffer is taken from the example project delivered with the IDE.

I will give you the exact declaration in about 10 hours (I'm not at the place where I have the code rigth now).
0 Kudos
Reply

714 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_USA on Mon Feb 01 12:27:41 MST 2010

Quote: jappelino
I tried the printf but I guess I need to include some kind of stdio.h to get it to work?

If I make a copy like:
[SIZE=2]
[LEFT][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]for[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2](m=0 ; m< 100 ; m++)
ub_16[m] = ([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]) UARTBuffer[m];[/SIZE]
[SIZE=2][/SIZE]
[SIZE=2]ub_16 is correct but not UARTHBuffer, so my guess there is something strange with the way the watchwindow displays variables.[/LEFT]
[/SIZE]



Would you please post the variable declaration for ub_16 and UARTHBuffer?

Thank you,
-NXP
0 Kudos
Reply

714 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jappelino on Sun Jan 31 00:59:54 MST 2010
I tried the printf but I guess I need to include some kind of stdio.h to get it to work?

If I make a copy like:
[SIZE=2]
[LEFT][/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]for[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2](m=0 ; m< 100 ; m++)
ub_16[m] = ([/SIZE][B][SIZE=2][COLOR=#7f0055][SIZE=2][COLOR=#7f0055]int[/B][/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]) UARTBuffer[m];[/SIZE]
[SIZE=2][/SIZE]
[SIZE=2]ub_16 is correct but not UARTHBuffer, so my guess there is something strange with the way the watchwindow displays variables.[/LEFT]
[/SIZE]
0 Kudos
Reply

714 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_USA on Sat Jan 30 17:40:10 MST 2010

Quote: jappelino
Here is some additional information: when the cursor is held on top of the array of received bytes it seems correct but when displaying the array in a watch window I get these incorrect values.



Hi jappelino,

That is unusual. Is the data correct from your code's point-of-view? You can use LPCXpresso semihosted printf to send the data into the debugger's console window so you can see it without sending it over serial again. I suppose another way to check this would be to just echo the data back that you receive and see if it looks correct in Hyperterm.

Thanks,
-NXP
0 Kudos
Reply

714 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jappelino on Sat Jan 30 00:52:20 MST 2010
Here is some additional information: when the cursor is held on top of the array of received bytes it seems correct but when displaying the array in a watch window I get these incorrect values.
0 Kudos
Reply