lpcware

Problems with UART recive perhaps caused by bad pinmatrix

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
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>

Outcomes