This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

USB INTERFACE WITH LPC2148

HELLO,

I Want to interface USB & ps2 keyboard with lpc2148. so,can anyone give me idea how to initialize & configure it? & from where to start my program?

Can lpc2148 work as master in i2c communication?

thank you.

  • "Can lpc2148 work as master in i2c communication?"

    How much time have _you_ spent reading the user manual for the processor?

    To implement I2C, you have to read the documentation. But if you read the documentation, you would then also know the answer to your question.

  • I worked with fingerprint module & gsm.
    now I want to interface USB keyboard.so i don't know from which point i have start.
    can you send example code for it.

    thank you

  • "can you send example code for it."

    Who is "you" in that sentence?

    This is a end-user forum.

    When you have a task you want to do, the natural thing would be for _you_ to spend time locating available samples instead of asking other end users to do it for you. Or contact a consultant and buy the service.

  • "now I want to interface USB keyboard. so i don't know from which point i have start."

    Start from exactly the same point that you started for the fingerprint module & GSM!

    In fact, having done it once (twice?) already for the fingerprint module & GSM, that should give you a head start for this new project!

    Or did you just rely on others to do the previous projects for you...?

  • I used serial communication with the help of UART & DB9 connector.
    & I am new to this field so I don't know about USB interfacing.

    here is my code for finger-print access system project.

    #include<lpc214x.h>
    #include "lcd.h" //LCD INIT.,DATA & CMD
    #include "lcd_print.h" //WEL-COME SCREEN & MAIN MENU
    #include "baudrate.h" //FOR BAUDRATE SETTING
    #include "enroll.h" //ENROLL FUNCTION
    #include "diag.h" //DIAGNOSE FUNCTION
    #include "add_user.h"
    #include "identify.h"
    #include "deletealluser.h"
    #include "rtc.h"
    #include "sms_send.h"
    #include "gsm.h"

    void serial_init()
    { U0LCR = 0x80; //UART0 CONFIG. U0DLL = 0x61; U0DLM = 0x00; U0LCR = 0x03;

    U1LCR = 0x80; //UART1 CONFIG. U1DLL = 0x61; U1DLM = 0x00; U1LCR = 0x03;
    }

    void DIAGNOSE_ISR()
    { lcd_clr(); diagnose();
    }

    void ENROLL_ISR()
    { lcd_clr(); enrollfunc(); //CALL FOR ENROLL FUNCTION
    }

    void IDENTIFY_ISR()
    { lcd_clr(); identify();
    }

    void DELETE_ISR()
    { lcd_clr(); delete();
    }

    int main()
    { unsigned int a,b,c,d,e;

    PINSEL0 = 0x00050005; // UART0 , UART1 PINSEL1 = 0x00000000; IO1DIR = 0x0BFF0000; // 0 0 0 0 1 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 .... VPBDIV = 0x00;

    lcd_print();

    serial_init();

    RTC_Init (); RTC_SetTime (23,59,45); RTC_SetDate (31,12,2011);

    // baudrate();

    lcd_print();

    /* EXTMODE = 0x00; EXTPOLAR = 0x00; VICIntSelect = 0x0000; VICIntEnable = 0x03C000; VICVectCntl0 = 0x2E; VICVectAddr0 = (unsigned long) DIAGNOSE_ISR; //DIAGNOSE INTRRUPT ROUTINE VICVectCntl1 = 0x2F; VICVectAddr1 = (unsigned long) ENROLL_ISR; //ENROLL INTERRUPTS ROUTINE VICVectCntl2 = 0x30; VICVectAddr2 = (unsigned long) IDENTIFY_ISR; //IDENTIFY INTERRUPTS ROUTINE

    while(1);
    */

    while(1) { e = IO1PIN & 0x08000000; //admin mode if(e == 0x0000000) { lcd_data4(); delay_ms(5000); adminpass(); if(flag1 == 0x01) break;

    while(1) { lcd_data3();
    //========== Diagnose section ================== a = IO0PIN & 0x00010000; if(a == 0x0000000) { DIAGNOSE_ISR(); while((IO0PIN & 0x00010000) == 0x00000000); }
    //========== Enroll Section ==================== b = IO0PIN & 0x00000008; if(b == 0x00000000) { ENROLL_ISR(); while((IO0PIN & 0x00000008) == 0x00000000); }
    //========== Identify Section ================= c = IO0PIN & 0x00000080; if(c == 0x0000000) { IDENTIFY_ISR(); while((IO0PIN & 0x00000080) == 0x00000000); }
    //========== Delete section ===================== d = IO0PIN & 0x00100000; if(d == 0x0000000) { DELETE_ISR(); while((IO0PIN & 0x00100000) == 0x00000000); } } }

    e = IO1PIN & 0x08000000; if(e == 0x08000000) //user mode { lcd_data5(); delay_ms(5000); lcd_clr(); delay_ms(1000);

    while(1) { lcd_data6();
    //========== Diagnose section ================== a = IO0PIN & 0x00010000; if(a == 0x0000000) { DIAGNOSE_ISR(); while((IO0PIN & 0x00010000) == 0x00000000); }
    //========== Identify Section ================= c = IO0PIN & 0x00000008; if(c == 0x0000000) { IDENTIFY_ISR(); while((IO0PIN & 0x00000008) == 0x00000000); } } } }
    }

  • I used serial communication with the help of UART & DB9 connector.

    I am new to this field. so, I don't know about USB interfacing.

    Here is my code for "FINGERPRINT ACCESS SYSTEM".How can it help me for USB.

    I want to display keyboard character on LCD.

    #include<lpc214x.h>
    #include "lcd.h" //LCD INIT.,DATA & CMD
    #include "lcd_print.h" //WEL-COME SCREEN & MAIN MENU
    #include "baudrate.h" //FOR BAUDRATE SETTING
    #include "enroll.h" //ENROLL FUNCTION
    #include "diag.h" //DIAGNOSE FUNCTION
    #include "add_user.h"
    #include "identify.h"
    #include "deletealluser.h"
    #include "rtc.h"
    #include "sms_send.h"
    #include "gsm.h"

    void serial_init()
    { U0LCR = 0x80; //UART0 CONFIG. U0DLL = 0x61; U0DLM = 0x00; U0LCR = 0x03;

    U1LCR = 0x80; //UART1 CONFIG. U1DLL = 0x61; U1DLM = 0x00; U1LCR = 0x03;
    }

    void DIAGNOSE_ISR()
    { lcd_clr(); diagnose();
    }

    void ENROLL_ISR()
    { lcd_clr(); enrollfunc(); //CALL FOR ENROLL FUNCTION
    }

    void IDENTIFY_ISR()
    { lcd_clr(); identify();
    }

    void DELETE_ISR()
    { lcd_clr(); delete();
    }

    int main()
    { unsigned int a,b,c,d,e;

    PINSEL0 = 0x00050005; // UART0 , UART1 PINSEL1 = 0x00000000; IO1DIR = 0x0BFF0000; // 0 0 0 0 1 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 .... VPBDIV = 0x00;

    lcd_print();

    serial_init();

    RTC_Init (); RTC_SetTime (23,59,45); RTC_SetDate (31,12,2011);

    // baudrate();

    /* EXTMODE = 0x00; EXTPOLAR = 0x00; VICIntSelect = 0x0000; VICIntEnable = 0x03C000; VICVectCntl0 = 0x2E; VICVectAddr0 = (unsigned long) DIAGNOSE_ISR; //DIAGNOSE INTRRUPT ROUTINE VICVectCntl1 = 0x2F; VICVectAddr1 = (unsigned long) ENROLL_ISR; //ENROLL INTERRUPTS ROUTINE VICVectCntl2 = 0x30; VICVectAddr2 = (unsigned long) IDENTIFY_ISR; //IDENTIFY INTERRUPTS ROUTINE

    while(1);
    */ while(1) { e = IO1PIN & 0x08000000; //admin mode if(e == 0x0000000) { lcd_data4(); delay_ms(5000); adminpass(); if(flag1 == 0x01) break;

    while(1) { lcd_data3();
    //========== Diagnose section ================== a = IO0PIN & 0x00010000; if(a == 0x0000000) { DIAGNOSE_ISR(); while((IO0PIN & 0x00010000) == 0x00000000); }
    //========== Enroll Section ==================== b = IO0PIN & 0x00000008; if(b == 0x00000000) { ENROLL_ISR(); while((IO0PIN & 0x00000008) == 0x00000000); }
    //========== Identify Section ================= c = IO0PIN & 0x00000080; if(c == 0x0000000) { IDENTIFY_ISR(); while((IO0PIN & 0x00000080) == 0x00000000); }
    //========== Delete section ===================== d = IO0PIN & 0x00100000; if(d == 0x0000000) { DELETE_ISR(); while((IO0PIN & 0x00100000) == 0x00000000); } } }

    e = IO1PIN & 0x08000000; if(e == 0x08000000) //user mode { lcd_data5(); delay_ms(5000); lcd_clr(); delay_ms(1000);

    while(1) { lcd_data6();
    //========== Diagnose section ================== a = IO0PIN & 0x00010000; if(a == 0x0000000) { DIAGNOSE_ISR(); while((IO0PIN & 0x00010000) == 0x00000000); }
    //========== Identify Section ================= c = IO0PIN & 0x00000008; if(c == 0x0000000) { IDENTIFY_ISR(); while((IO0PIN & 0x00000008) == 0x00000000); } } } }
    }

  • I used serial communication with the help of UART & DB9 connector.

    I am new to this field. so, I don't know about USB interfacing.

    Here is my code for "FINGERPRINT ACCESS SYSTEM".How can it help me for USB.

    I want to display keyboard character on LCD.

    #include<lpc214x.h>
    #include "lcd.h" //LCD INIT.,DATA & CMD
    #include "lcd_print.h" //WEL-COME SCREEN & MAIN MENU
    #include "baudrate.h" //FOR BAUDRATE SETTING
    #include "enroll.h" //ENROLL FUNCTION
    #include "diag.h" //DIAGNOSE FUNCTION
    #include "add_user.h"
    #include "identify.h"
    #include "deletealluser.h"
    #include "rtc.h"
    #include "sms_send.h"
    #include "gsm.h"

    void serial_init()
    { U0LCR = 0x80; //UART0 CONFIG. U0DLL = 0x61; U0DLM = 0x00; U0LCR = 0x03;

    U1LCR = 0x80; //UART1 CONFIG. U1DLL = 0x61; U1DLM = 0x00; U1LCR = 0x03;
    }

    void DIAGNOSE_ISR()
    { lcd_clr(); diagnose();
    }

    void ENROLL_ISR()
    { lcd_clr(); enrollfunc(); //CALL FOR ENROLL FUNCTION
    }

    void IDENTIFY_ISR()
    { lcd_clr(); identify();
    }

    void DELETE_ISR()
    { lcd_clr(); delete();
    }

    int main()
    { unsigned int a,b,c,d,e;

    PINSEL0 = 0x00050005; // UART0 , UART1 PINSEL1 = 0x00000000; IO1DIR = 0x0BFF0000; // 0 0 0 0 1 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 .... VPBDIV = 0x00;

    lcd_print();

    serial_init();

    RTC_Init (); RTC_SetTime (23,59,45); RTC_SetDate (31,12,2011);

    // baudrate();

    /* EXTMODE = 0x00; EXTPOLAR = 0x00; VICIntSelect = 0x0000; VICIntEnable = 0x03C000; VICVectCntl0 = 0x2E; VICVectAddr0 = (unsigned long) DIAGNOSE_ISR; //DIAGNOSE INTRRUPT ROUTINE VICVectCntl1 = 0x2F; VICVectAddr1 = (unsigned long) ENROLL_ISR; //ENROLL INTERRUPTS ROUTINE VICVectCntl2 = 0x30; VICVectAddr2 = (unsigned long) IDENTIFY_ISR; //IDENTIFY INTERRUPTS ROUTINE

    while(1);
    */ while(1) { e = IO1PIN & 0x08000000; //admin mode if(e == 0x0000000) { lcd_data4(); delay_ms(5000); adminpass(); if(flag1 == 0x01) break;

    while(1) { lcd_data3();
    //========== Diagnose section ================== a = IO0PIN & 0x00010000; if(a == 0x0000000) { DIAGNOSE_ISR(); while((IO0PIN & 0x00010000) == 0x00000000); }
    //========== Enroll Section ==================== b = IO0PIN & 0x00000008; if(b == 0x00000000) { ENROLL_ISR(); while((IO0PIN & 0x00000008) == 0x00000000); }
    //========== Identify Section ================= c = IO0PIN & 0x00000080; if(c == 0x0000000) { IDENTIFY_ISR(); while((IO0PIN & 0x00000080) == 0x00000000); }
    //========== Delete section ===================== d = IO0PIN & 0x00100000; if(d == 0x0000000) { DELETE_ISR(); while((IO0PIN & 0x00100000) == 0x00000000); } } }

    e = IO1PIN & 0x08000000; if(e == 0x08000000) //user mode { lcd_data5(); delay_ms(5000); lcd_clr(); delay_ms(1000);

    while(1) { lcd_data6();
    //========== Diagnose section ================== a = IO0PIN & 0x00010000; if(a == 0x0000000) { DIAGNOSE_ISR(); while((IO0PIN & 0x00010000) == 0x00000000); }
    //========== Identify Section ================= c = IO0PIN & 0x00000008; if(c == 0x0000000) { IDENTIFY_ISR(); while((IO0PIN & 0x00000008) == 0x00000000); } } } }
    }

  • I used serial communication with the help of UART & DB9 connector.

    I am new to this field. so, I don't know about USB interfacing.

    Here is my code for "FINGERPRINT ACCESS SYSTEM".How can it help me for USB.

    I want to display keyboard character on LCD.

    #include<lpc214x.h>
    #include "lcd.h" //LCD INIT.,DATA & CMD
    #include "lcd_print.h" //WEL-COME SCREEN & MAIN MENU
    #include "baudrate.h" //FOR BAUDRATE SETTING
    #include "enroll.h" //ENROLL FUNCTION
    #include "diag.h" //DIAGNOSE FUNCTION
    #include "add_user.h"
    #include "identify.h"
    #include "deletealluser.h"
    #include "rtc.h"
    #include "sms_send.h"
    #include "gsm.h"

    void serial_init()
    { U0LCR = 0x80; //UART0 CONFIG. U0DLL = 0x61; U0DLM = 0x00; U0LCR = 0x03;

    U1LCR = 0x80; //UART1 CONFIG. U1DLL = 0x61; U1DLM = 0x00; U1LCR = 0x03;
    }

    void DIAGNOSE_ISR()
    { lcd_clr(); diagnose();
    }

    void ENROLL_ISR()
    { lcd_clr(); enrollfunc(); //CALL FOR ENROLL FUNCTION
    }

    void IDENTIFY_ISR()
    { lcd_clr(); identify();
    }

    void DELETE_ISR()
    { lcd_clr(); delete();
    }

    int main()
    { unsigned int a,b,c,d,e;

    PINSEL0 = 0x00050005; // UART0 , UART1 PINSEL1 = 0x00000000; IO1DIR = 0x0BFF0000; // 0 0 0 0 1 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 .... VPBDIV = 0x00;

    lcd_print();

    serial_init();

    RTC_Init (); RTC_SetTime (23,59,45); RTC_SetDate (31,12,2011);

    // baudrate();

    /* EXTMODE = 0x00; EXTPOLAR = 0x00; VICIntSelect = 0x0000; VICIntEnable = 0x03C000; VICVectCntl0 = 0x2E; VICVectAddr0 = (unsigned long) DIAGNOSE_ISR; //DIAGNOSE INTRRUPT ROUTINE VICVectCntl1 = 0x2F; VICVectAddr1 = (unsigned long) ENROLL_ISR; //ENROLL INTERRUPTS ROUTINE VICVectCntl2 = 0x30; VICVectAddr2 = (unsigned long) IDENTIFY_ISR; //IDENTIFY INTERRUPTS ROUTINE

    while(1);
    */ while(1) { e = IO1PIN & 0x08000000; //admin mode if(e == 0x0000000) { lcd_data4(); delay_ms(5000); adminpass(); if(flag1 == 0x01) break;

    while(1) { lcd_data3();
    //========== Diagnose section ================== a = IO0PIN & 0x00010000; if(a == 0x0000000) { DIAGNOSE_ISR(); while((IO0PIN & 0x00010000) == 0x00000000); }
    //========== Enroll Section ==================== b = IO0PIN & 0x00000008; if(b == 0x00000000) { ENROLL_ISR(); while((IO0PIN & 0x00000008) == 0x00000000); }
    //========== Identify Section ================= c = IO0PIN & 0x00000080; if(c == 0x0000000) { IDENTIFY_ISR(); while((IO0PIN & 0x00000080) == 0x00000000); }
    //========== Delete section ===================== d = IO0PIN & 0x00100000; if(d == 0x0000000) { DELETE_ISR(); while((IO0PIN & 0x00100000) == 0x00000000); } } }

    e = IO1PIN & 0x08000000; if(e == 0x08000000) //user mode { lcd_data5(); delay_ms(5000); lcd_clr(); delay_ms(1000);

    while(1) { lcd_data6();
    //========== Diagnose section ================== a = IO0PIN & 0x00010000; if(a == 0x0000000) { DIAGNOSE_ISR(); while((IO0PIN & 0x00010000) == 0x00000000); }
    //========== Identify Section ================= c = IO0PIN & 0x00000008; if(c == 0x0000000) { IDENTIFY_ISR(); while((IO0PIN & 0x00000008) == 0x00000000); } } } }
    }

  • I used serial communication with the help of UART & DB9 connector.

    I am new to this field. so, I don't know about USB interfacing.

    Here is my code for "FINGERPRINT ACCESS SYSTEM".How can it help me for USB.

    I want to display keyboard character on LCD.

    #include<lpc214x.h>
    #include "lcd.h" //LCD INIT.,DATA & CMD
    #include "lcd_print.h" //WEL-COME SCREEN & MAIN MENU
    #include "baudrate.h" //FOR BAUDRATE SETTING
    #include "enroll.h" //ENROLL FUNCTION
    #include "diag.h" //DIAGNOSE FUNCTION
    #include "add_user.h"
    #include "identify.h"
    #include "deletealluser.h"
    #include "rtc.h"
    #include "sms_send.h"
    #include "gsm.h"

    void serial_init()
    { U0LCR = 0x80; //UART0 CONFIG. U0DLL = 0x61; U0DLM = 0x00; U0LCR = 0x03;

    U1LCR = 0x80; //UART1 CONFIG. U1DLL = 0x61; U1DLM = 0x00; U1LCR = 0x03;
    }

    void DIAGNOSE_ISR()
    { lcd_clr(); diagnose();
    }

    void ENROLL_ISR()
    { lcd_clr(); enrollfunc(); //CALL FOR ENROLL FUNCTION
    }

    void IDENTIFY_ISR()
    { lcd_clr(); identify();
    }

    void DELETE_ISR()
    { lcd_clr(); delete();
    }

    int main()
    { unsigned int a,b,c,d,e;

    PINSEL0 = 0x00050005; // UART0 , UART1 PINSEL1 = 0x00000000; IO1DIR = 0x0BFF0000; // 0 0 0 0 1 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 .... VPBDIV = 0x00;

    lcd_print();

    serial_init();

    RTC_Init (); RTC_SetTime (23,59,45); RTC_SetDate (31,12,2011);

    // baudrate();

    /* EXTMODE = 0x00; EXTPOLAR = 0x00; VICIntSelect = 0x0000; VICIntEnable = 0x03C000; VICVectCntl0 = 0x2E; VICVectAddr0 = (unsigned long) DIAGNOSE_ISR; //DIAGNOSE INTRRUPT ROUTINE VICVectCntl1 = 0x2F; VICVectAddr1 = (unsigned long) ENROLL_ISR; //ENROLL INTERRUPTS ROUTINE VICVectCntl2 = 0x30; VICVectAddr2 = (unsigned long) IDENTIFY_ISR; //IDENTIFY INTERRUPTS ROUTINE

    while(1);
    */ while(1) { e = IO1PIN & 0x08000000; //admin mode if(e == 0x0000000) { lcd_data4(); delay_ms(5000); adminpass(); if(flag1 == 0x01) break;

    while(1) { lcd_data3();
    //========== Diagnose section ================== a = IO0PIN & 0x00010000; if(a == 0x0000000) { DIAGNOSE_ISR(); while((IO0PIN & 0x00010000) == 0x00000000); }
    //========== Enroll Section ==================== b = IO0PIN & 0x00000008; if(b == 0x00000000) { ENROLL_ISR(); while((IO0PIN & 0x00000008) == 0x00000000); }
    //========== Identify Section ================= c = IO0PIN & 0x00000080; if(c == 0x0000000) { IDENTIFY_ISR(); while((IO0PIN & 0x00000080) == 0x00000000); }
    //========== Delete section ===================== d = IO0PIN & 0x00100000; if(d == 0x0000000) { DELETE_ISR(); while((IO0PIN & 0x00100000) == 0x00000000); } } }

    e = IO1PIN & 0x08000000; if(e == 0x08000000) //user mode { lcd_data5(); delay_ms(5000); lcd_clr(); delay_ms(1000);

    while(1) { lcd_data6();
    //========== Diagnose section ================== a = IO0PIN & 0x00010000; if(a == 0x0000000) { DIAGNOSE_ISR(); while((IO0PIN & 0x00010000) == 0x00000000); }
    //========== Identify Section ================= c = IO0PIN & 0x00000008; if(c == 0x0000000) { IDENTIFY_ISR(); while((IO0PIN & 0x00000008) == 0x00000000); } } } }
    }

  • So, clearly, you first step needs to be to find out about USB interfacing!

    There are 2 aspects to this:

    1. Find out about USB in general
    There are many good books and sites to help you with this; eg,
    http://www.keil.com/books/usbbooks.asp
    http://www.lvr.com/usb.htm

    2. Find out about the specific USB features on the lpc2148
    For this, you will need to study the User Manual and other support materials from NXP.
    There are probably also 3rd-party materials available...