lpcware

problem on initialize xbee on LPC1769

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Sep 9, 2016 by lucas fontan
Content originally posted in LPCWare by terenceng on Thu Sep 15 07:03:36 MST 2011
here is the init code for xbee:-
#include "LPC17xx.h"

void Xbee_PIN_init(void)
{
    //Set P0.17 (DTR) to GPIO,
    LPC_PINCON->PINSEL1    |= (0 << 2);
    //Set P0.18 (CTS) to GPIO
    LPC_PINCON->PINSEL1    |= (0 << 4);
    //Set P0.20 (RTS) to GPIO
    LPC_PINCON->PINSEL1    |= (0 << 8);
    //Set P0.0 to TX
    LPC_PINCON->PINSEL0    |= (2 << 0);
    //Set P0.1 to RX
    LPC_PINCON->PINSEL0    |= (2 << 2);
    //Set P0.0 and P0.1 to 10 - Pin has neither pull-up nor pull-down resistor enabled.
    LPC_PINCON->PINMODE0 |= (2 << 0);
    LPC_PINCON->PINMODE0 |= (0 << 2);// should not have pull down enable
}

    void Xbee_init(void)
    {
        //Turn on Power for UART1 Interface
        LPC_SC->PCONP |= (1 << 4);
        //Set PCLK_UART1 to CCLK/4 - 25MHz
        LPC_SC->PCLKSEL0 &= (~(3 << 8)) ;
        //Set Data Format: 8 bit Data, 1 Stop Bit,
        LPC_UART1->LCR |= (3 << 0);
        LPC_UART1->LCR &= (~(1 << 2));
        // Set BaudRate to 9600bps
        LPC_UART1->LCR |= (1 << 7);
        LPC_UART1->DLM = 0;
        LPC_UART1->DLL = 163;
        LPC_UART1->FDR = 0x10;
        LPC_UART1->LCR &= (~(1 << 7));
        //Enable FIFO
        LPC_UART1->FCR |= (1 << 0);
        //Enable Interrupts
        LPC_UART1->IER |= (3 << 0);
        // Enable Transmission
        LPC_UART1->TER |= (1 << 7);
    }

with above code...xbee still fail to communicate:(
Any others init. code needed??

Outcomes