problem on initialize xbee on LPC1769

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

problem on initialize xbee on LPC1769

803件の閲覧回数
lpcware
NXP Employee
NXP Employee
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??
0 件の賞賛
返信
1 返信

721件の閲覧回数
lucasfontan
Contributor I

Hi, have succeed in communicating  XBee with LPC1769?. I´m trying it but I have no good results, maybe we could share some code.

Lucas.

0 件の賞賛
返信