Problems with UART recive perhaps caused by bad pinmatrix

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Problems with UART recive perhaps caused by bad pinmatrix

2,177 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ppx on Mon Mar 03 09:57:31 MST 2014
There are three UART examples in the LPCopen examples. Polling, Interrupt and ring buffers. I can trnsmit from mya LPCxpresso board but in all three cases I can't recieve anything, no echo back of the string I send from the terminal window. When I meassure on the RX pin the high level is at 1.4V and the low level very clseo to 0V. If disconect the FTDI Rx cable from the Rx pin I see 0V on the pin and 3.4V on the cable's from the FTDI. I tried with two different cables, same result. I suspect that the RX pin is se as output and low meaning that pinmatrix was not correctly set up.

I generated new pinmatrix code with a tool at http://www.lpcware.com/content/tools/lpc-initializer because the offline tool can't generate code for LPCopen. It compiled but when running the code the debugger complains about: Target error at register access. So this code is probably also faulty.

Can anyone see the problem? Here is my code
<code>
static void Init_UART_PinMux(void)
{
#if 1
// Original code
//#if (defined(BOARD_NXP_XPRESSO_812) || defined(BOARD_LPC812MAX))
/* Enable the clock to the Switch Matrix */
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM);

Chip_Clock_SetUARTClockDiv(1);/* divided by 1 */

/* Connect the U0_TXD_O and U0_RXD_I signals to port pins(P0.4, P0.0) */
Chip_SWM_DisableFixedPin(SWM_FIXED_ACMP_I1);
Chip_SWM_MovablePinAssign(SWM_U0_TXD_O, 4);
Chip_SWM_MovablePinAssign(SWM_U0_RXD_I, 0);

/* Disable the clock to the Switch Matrix to save power */
Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_SWM);
#else

// This code is generated by a tool at tool at http://www.lpcware.com/content/tools/lpc-initializer
// This because the offline tool can't generate code for lpcopen.
// But if I enable it I get a debugger error: Target error from register access.
/* Enable the clock to the Switch Matrix */
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM);

Chip_Clock_SetUARTClockDiv(1);/* divided by 1 */

/* Pin Assign 8 bit Configuration */
    /* U0_TXD */
    /* U0_RXD */
    LPC_SWM->PINASSIGN[0] = 0xffff0004UL;

    /* U1_TXD */
    /* U1_RXD */
    LPC_SWM->PINASSIGN[1] = 0xff0d0cffUL;

    /* Pin Assign 1 bit Configuration */
    /* SWCLK */
    /* SWDIO */
    /* RESET */
    /* CLKIN */
    LPC_SWM->PINENABLE0 = 0xffffff33UL;

/* Disable the clock to the Switch Matrix to save power */
Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_SWM);

/* Configure your own UART pin muxing here if needed */
//#warning "No UART pin muxing defined"
#endif
}
</code>
0 项奖励
回复
7 回复数

2,118 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ppx on Mon Mar 10 09:40:17 MST 2014
It works now. It looks like turning off the clock when running, permanently destroys the RX0 pin and if connected longer, I loose the possibilty to communicate with them, no LPC link. Even the voltage levels are right now. BTW, I got my 7th board today!
0 项奖励
回复

2,118 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ppx on Tue Mar 04 10:18:12 MST 2014
OOOPS!  You are completely right. The other probelm I made was to generate code for a 16pin LPC811, the chip I will use, but the LPCXpresso board has an LPC812. But strangely I can not see where the crystal is enabled. There is a function in board_sysinit.c for setting up the SYSOSC  but that is called before the pinmatrix setup is called. There must be another pinmatrix setup somewhere.

I changed the PINENABLE0 to 0x03 and now I don't get the error message So I guess it is working better. But I still have 1.4V on PIO-0-0, the RX pin, and recieving does not work
0 项奖励
回复

2,118 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by JoeHale on Tue Mar 04 08:59:00 MST 2014
I'm afraid that you might be counting the bits from the wrong end.

0x33 is b0011_0011

00110011 // 0x33
76543210 // bit indicies

the right most bit is bit zero. So we have bit's 0,1, 4 and 5 set to be 1 which disables the pins I mentioned earlier.
0 项奖励
回复

2,118 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by JoeHale on Tue Mar 04 08:49:55 MST 2014
Hi,

Could you clarify which board are you having this problem on? Does enabling the XTALIN and XTALOUT help?

With regard to the reliability of the online tool: When you start the tool it is initially configured for the reset state of the chip - this includes the XTALIN and XTALOUT being disabled. The user is currently required to configure all of the pins that they would like to use. The different board libraries configure the pinmuxing to match the setup of the board.

We are working on providing board specific starting points which should make it easier to modify the pin configuration for the dev board without the user needing to figure out the initial setup.
0 项奖励
回复

2,118 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ppx on Tue Mar 04 08:44:10 MST 2014
In PINNENABLE0 bit bit 4 is XTALIN and bit 5 is XTALOUT. with 0x33 they are both set to 0 which is enabled. Bit 9 is reserved and should perhaps not be set therefore we should use 0x13. Or should you write 1 to all reserved bits?

What other problems can there be?
0 项奖励
回复

2,118 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ppx on Tue Mar 04 08:06:36 MST 2014
I did not ask the online tool to disable the XTALIN and XTALOUT. Neither do the comments from the automatically generated code show that. What I did was to enable CLOCKIN so I can later on "steal" a 12MHZ clok from another chips CLOCKOUT. This is not an NXP chip. I also enabled two pins for a secondary UART. Will take a look at these bits.

So the online tool is not reliable?

Thanks!
0 项奖励
回复

2,118 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by JoeHale on Tue Mar 04 07:45:35 MST 2014
Hi,

Assuming that you are using the LPCXpresso 812 board with the standard start-up the problem could be that you are disconnecting the external oscillator.
LPC_SWM->PINENABLE0 = 0xffffff33UL;


Disables the following fixed pin I/O:
[list]
  [*]ACMP_I1
  [*]ACMP_I2
  [*]XTALIN
  [*]XTALOUT
[/list]

The default settings in the LPCXpresso 812 board library configures the part to use the external crystal - which requires the XTALIN and XTALOUT pins.

0 项奖励
回复