The UART example does not work

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

The UART example does not work

1,479 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Mike45 on Mon Nov 01 02:42:04 MST 2010
I've been fighting this thing for 2 days now.  As i understand it, the main program is supposed to wait for data after a data received intterupt is triggered, which allows the main program to echo back the received data.

Using printfs for debugging, most of my inputted characters from terminal (windows version & brays) mostly get flagged as error interrupts.

Has anyone got this to work on their machine?  Could you please tell me a little more about your setup etc?  really need some help.

thanks,
0 Kudos
Reply
7 Replies

1,454 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Mike45 on Mon Nov 01 07:11:05 MST 2010
Thank you guys both for the help.  I just tried it on my pc and it works fine. 


Quote:
If you have an LPCXpresso base board (http://www.embeddedartists.com/produ...o/xpr_base.php) with your LPCXpresso1343 MCU board mounted on it - why are you soldering a serial connector onto it? I imagine that if you are soldering, then you actually just have an LPCXpresso1343 MCU board?

As Zero suggests, one possibility is that your soldered hardware is not working.

Another possibility is the connection out to the serial port under Parallels on your Mac.

Does your Mac have a real serial port, or are you using a USB-serial convertor? I would suggest that checking the Parallels help for using such a device would probably be a good move, if you haven't done so already. Certainly googling for "parallels usb serial converter" gives a quite a few hits



Yes you're right, i have the MCU board, sorry for the confusion.  I am using a USB serial convertor and didn't really suspect it because i had no problems with it using it for AVR stuff, i guess i'll have to do some research now.

I've had so many problems usb/link problems with the IDE and i've got to get down to the bottom of it, either change VM's or build a linux machine.  I briefly read another thread about a user using VMware fusion and having good results after he made some configuration changes.  I'll have a search for that.

How frustrating!  i decoded nonsensical data for hours:o
0 Kudos
Reply

1,454 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Mon Nov 01 06:55:19 MST 2010
If you have an LPCXpresso base board (http://www.embeddedartists.com/products/lpcxpresso/xpr_base.php) with your LPCXpresso1343 MCU board mounted on it - why are you soldering a serial connector onto it? I imagine that if you are soldering, then you actually just have an LPCXpresso1343 MCU board?

As Zero suggests, one possibility is that your soldered hardware is not working.

Another possibility is the connection out to the serial port under Parallels on your Mac.

Does your Mac have a real serial port, or are you using a USB-serial convertor? I would suggest that checking the Parallels help for using such a device would probably be a good move, if you haven't done so already. Certainly googling for "parallels usb serial converter" gives a quite a few hits

[I'm sorry I can't confirm if the actual uart example code runs here, as I don't currently have access to all required kit.]

Regards,
CodeRedSupport
0 Kudos
Reply

1,454 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Mon Nov 01 06:51:48 MST 2010
Not sure if we are talking about the same sample (uarttest.c?):
int main (void) {
   /* Basic chip initialization is taken care of in SystemInit() called
    * from the startup code. SystemInit() and chip settings are defined
    * in the CMSIS system_<part family>.c file.
    */
  /* NVIC is installed inside UARTInit file. */
  UARTInit(115200);
  while (1) 
  {    /* Loop forever */
 if ( UARTCount != 0 )
 {
   LPC_UART->IER = IER_THRE | IER_RLS;   /* Disable RBR */
   UARTSend( (uint8_t *)UARTBuffer, UARTCount );
   UARTCount = 0;
   LPC_UART->IER = IER_THRE | IER_RLS | IER_RBR; /* Re-enable RBR */
  }
}
}

should retransmit every received chararcter.

You can also use
UARTSend( (uint8_t *)UARTBuffer, UARTCount );
to send your own chars. I'm not familiar with EA Base Board and so I don't know if it has a complete UART<->RS232, but it's always a good idea to keep this things as simple as possible. If you can use an old PC with serial port you could exclude a lot of problems with Adapters.
0 Kudos
Reply

1,454 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Mike45 on Mon Nov 01 06:30:17 MST 2010

Quote: Zero
You are not providing a lot of information :o, so the only question i can answer is:



Yes. Via RS232<->USB Adapter and TeraTerm, HyperTerminal...

Without further details i can't understand what you are doing.



Do you mean 'LPCXpresso Base Board' or 'LPCXpresso 1343 Board'



?



?

Obviously your hardware is not working. Did you scope Rxd / Txd and RS232?

The simplest way to find the problem is to use a timer (or a counter) to transmit one character (like 0x30 = '0') every 1/10 sec and follow this signal with a scope and try to receive it via terminal program.



I have the base board.  i don't have a scope yet so i can't look at any lines.  my next idea is to try it on my xp pc(buried in my closet :() without a rs232 cable.  do you think that;s a good idea?


Can you please tell me if what i wrote is what i should expect from the program?
[B]"As i understand it, the main program is supposed to wait for data after a data received intterupt is triggered, which allows the main program to echo back the received data."
[/B]
0 Kudos
Reply

1,454 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Mon Nov 01 05:55:19 MST 2010
You are not providing a lot of information :o, so the only question i can answer is:


Quote:
Has anyone got this to work on their machine?



Yes. Via UART<->USB Adapter and TeraTerm, HyperTerminal...

Without further details i can't understand what you are doing.


Quote:
1343 embedded artists board



Do you mean 'LPCXpresso Base Board' or 'LPCXpresso 1343 Board'


Quote:
breakout rs232 connector that i soldered



?


Quote:
through parallels



?

Obviously your hardware is not working. Did you scope Rxd / Txd and RS232?

The simplest way to find the problem is to use a timer (or a counter) to transmit one character (like 0x30 = '0') every 1/10 sec and follow this signal with a scope and try to receive it via terminal program.
0 Kudos
Reply

1,454 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Mike45 on Mon Nov 01 04:54:06 MST 2010
I am using a 1343 embedded artists board with a breakout rs232 connector that i soldered.  I am using the UART example that comes in the examples folder for the 1343.

When i posted this message i was using both linux and xp simultaneously on my mac through parallels.  With this setup i got no echo back from my terminal program.  I tried running the rs232 separately on another mac with parallels and now it echos back data, but in an unpredictable way. 


The strangest thing is that the 1343 is running and reporting interrupt cases through IIR_THRE, which was not enabled in my .h file.  More wackiness -

If i were to type 205(dec) into the terminal, i receive 0x26 0x2A.  Using printfs in my program tell me that the 1343 processed two RDA interrupts, followed by two RLS interrupts, and a THRE interrupt.
0 Kudos
Reply

1,454 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Mon Nov 01 03:35:46 MST 2010
Including more details of your setup might increase the chances of somebody being able/willing to help you :)

[LIST]
[*]Which  MCU are you using?
[*]What is your target hardware? For example are you using a "bare" LPCXpresso upon which you have soldered a serial connector, or do you have an LPCXpresso mounted on an Embedded Artists baseboard?
[*]Exactly which UART example you are trying to use?
[/LIST]
0 Kudos
Reply