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

lp2378 use all four uarts - extending nxp uart code

Using a keil mcb2300 with lpc2378.

Used the NXP example bundle uart code as the base and attempting to modify it to use all four uarts via interrupts. Couldn't find any examples that use all four uarts on lpc2300.

zip of base project www.alexthegeek.com/.../testUsarti.zip
code www.alexthegeek.com/.../

The uart init routines run and print out their message on uart0.
uart0 and uart1 work and echo back characters when initalised in order 0,1,2,3
but not uart2 and 3.

Most likely I'm doing something dumb or missing something simple.
Any hints or pointers appreciated.

Not sure on the pinsel settings as its been a while since I've used lpc2000's (mostly xilinx , avr and st32f lately)

Thank you

Alex

pinsel

/* PinSelect and Pinmode settings */
  /* UART0 = COM1 DB9 P4 on mcb2300 */
  /* UART1 = COM1 DB9 P3 on mcb2300 */
  /* UART2 = COM 2 is on IDC (TXD2=P2.8 (93), RXD2=P2.9 (92), GND=GND (103)   */
  /* UART3 = COM3 is on IDC (TXD3 = P0.0 (66), RXD3 = P0.1 (67), GND=GND (42) */


  PINSEL0 = 0x4000005A;      /* binary: 01000000_00000000_00000000_01011010 */
  PINMODE0 = 0x800000AA;     /* binary: 10000000_00000000_00000000_10101010 */
  //   IO0DIR = 0x00000000;       /* binary: 00000000_00000000_00000000_00000000 */

  PINSEL1 = 0x00000001;      /* binary: 00000000_00000000_00000000_00000001 */
  PINMODE1 = 0x0000000A;     /* binary: 00000000_00000000_00000000_00001010 */

  PINSEL2 = 0x00000000;      /* binary: 00000000_00000000_00000000_00000000 */
  PINMODE2 = 0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
  //    IO1DIR = 0x00000000;       /* binary: 00000000_00000000_00000000_00000000 */

  PINSEL3 = 0x00000000;      /* binary: 00000000_00000000_00000000_00000000 */
  PINMODE3 = 0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */

  PINSEL4 = 0x000A0000;      /* binary: 00000000_00001010_00000000_00000000 */
  PINMODE4 = 0x000A0000;     /* binary: 00000000_00001010_00000000_00000000 */

  //  PINSEL4 = 0x000A000A;     // binary: 00000000_00001010_00000000_00001010

  FIO2DIR = 0x00000000;      /* binary: 00000000_00000000_00000000_00000000 */
  PINSEL6 = 0x00000000;      /* binary: 00000000_00000000_00000000_00000000 */
  PINMODE6 = 0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */

  FIO3DIR = 0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
  PINSEL7 = 0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
  PINMODE7 = 0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */

  PINSEL8 = 0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
  PINMODE8 = 0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */

  FIO4DIR = 0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
  PINSEL9 = 0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */
  PINMODE9 = 0x00000000;     /* binary: 00000000_00000000_00000000_00000000 */

Parents
  • Thank you

    The binary comments are in so I could work out/see what each register is at.

    I have PCONP selected and PCLKSEL 0 and 1 (PCLK = CLk/4) for uarts 0 ,1,2 and 3 in the configuration wizard (for lpc2300.s)

    Do I need to set it in my code or will the setting in lpc2300.s do it ?

    in lpc2300.s PCONP_Val EQU 0x0300039E

    I'm not familiar with keil , been doing a lot of reading (docs and examples) but still trying to get my head around things.

Reply
  • Thank you

    The binary comments are in so I could work out/see what each register is at.

    I have PCONP selected and PCLKSEL 0 and 1 (PCLK = CLk/4) for uarts 0 ,1,2 and 3 in the configuration wizard (for lpc2300.s)

    Do I need to set it in my code or will the setting in lpc2300.s do it ?

    in lpc2300.s PCONP_Val EQU 0x0300039E

    I'm not familiar with keil , been doing a lot of reading (docs and examples) but still trying to get my head around things.

Children