Content originally posted in LPCWare by ppx on Fri May 04 09:17:00 MST 2012
I need 2 UARTs so I have tried to use the software UART example on a LPCXpresso board, that little board you can break in 2. The example is using PIO1-5 for RX and PIO0-11 for TX. Transmit works OK if I turn down the speed to 2400 baud, otherwise my Windows terminal program can't handle the speed.
When using receiver I get a string of random character during about 10 seconds . Looking at the scope I can see that the RX pin is pulled down after executing the following code:
/* Some of the I/O pins need to be clearfully planned if you use below module because JTAG and TIMER CAP/MAT pins are muxed. */
LPC_SYSCON->SYSAHBCLKCTRL |= (1 << 9);
LPC_IOCON->PIO1_5 &= ~0x07; /* Timer0_32 I/O config */
LPC_IOCON->PIO1_5 |= 0x02; /* Timer0_32 CAP0 */
LPC_IOCON->R_PIO0_11 &= ~0x07;
LPC_IOCON->R_PIO0_11 |= 0x03; /* Timer0_32 MAT3 */
But this pin should be configured as an input to the timer? After this I can see some random waveform at around half the baudrate for about 10 seconds and the RX pin is than pulled low again. The random waveform is seen as two repeating characters in my terminal window so the reception sort of works. I debug with LPCXpresso, V4.2.0 and via USB.
Any ideas? Collision with the JTAG pins? Should I disable the JTAG somehow?
ref. Id:: lpc_swu.c 4785 2010-09-03 22:39:27Z nxp21346