LPC2368 - GPIO and UART Application

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC2368 - GPIO and UART Application

2,254 Views
avinashneethi
Contributor I

Dear All,

              I am New to ARM7 Controller. We have made a customized Board with LPC2368. We can able to read device signature ID using UART and FLASH Magic tool. we are using keil4 IDE tool for application cross compilation.

              In our board LPC2368 we are using Internal RC oscillator only. we had an UART and GPIO example project from keil website. we had cross compiled and ported. But both are not working properly.  

Question:

1. For UART application the controller is receiving the input from the keyboard but not replicating the came on the serial console ?

2. For GPIO application, we configured Port 2(0 to 7) as output and set as high. measure the output voltage. we are getting only 2.3v. Is it correct ?(output should be only 3.3v ?)  

3.For GPIO application, we configured Port 2(0 to 7) as output and set as low. measure the output voltage. we are getting 2.3v ?

4. In Application compilation process IROM1 start address is 0x0 and IRAM1 start address is 0x40000000. Whether start address is correct ?

5. In Application compilation process Xtal is 12MHz(default). But we are using Internal RC Oscillator only. Then XTAL has to be configured as 4MHz ? 

 

Labels (4)
0 Kudos
4 Replies

1,481 Views
smal
Contributor I

Hello

I would like to do some programming work on lpc2368 ucontroller and I have downloaded the examples on proposed link:

https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mc....

The samples compile well and the code also works as expected but the problem here is because everything is set to execute the code from RAM instead of downloading it into flash. Can someone help me to configure the projects in Keil C to download into flash or pass me a reference project where I can add my c stuff?

Best regards

Simon Mali

0 Kudos

2,238 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Avinash,

1. For UART application the controller is receiving the input from the keyboard but not replicating the came on the serial console ?

>>Pls check if you configure the uart, uart clock, uart pins. BTW, which uart module you are using?

2. For GPIO application, we configured Port 2(0 to 7) as output and set as high. measure the output voltage. we are getting only 2.3v. Is it correct ?(output should be only 3.3v ?)

>>>>You can follow up the procedure to set the GPIO pin in output mode:

1)set up the GPIOM bit so that you can select the legacy mode or high speed mode.

xiangjun_rong_0-1603095178446.png

SCS&=~(0x01); //flor example useing legacy mode, clear the GPIOM bit

2)set the corresponding bit in IODIR

IO0DIR|=0xff; //the the GPIO0_0~GPIO0_7 are in output mode

3)set the GPIO0_0~7

IO0_SET=0xFF

4)clear GPIO0_0~7

IO0_CLR=0xFF;

Pls have a try

 

3.For GPIO application, we configured Port 2(0 to 7) as output and set as low. measure the output voltage. we are getting 2.3v ?

>>>see above description

4. In Application compilation process IROM1 start address is 0x0 and IRAM1 start address is 0x40000000. Whether start address is correct ?

>>>>>After Reset, the bootloader code is executed firstly(from 0x7FFF E000), It is dependent on the P2.10 pin voltage after Reset, if the pin is low after Reset, the ISP mode is entered. If the P0_10 is high after reset, the bootloader look for valid image in address 0x00000000, if a valid application image is available, the application code from 0x0000 will be executed.

Pls refer to Chapter 29: LPC23XX Flash memory programming firmware in UM10211.

 

5. In Application compilation process Xtal is 12MHz(default). But we are using Internal RC Oscillator only. Then XTAL has to be configured as 4MHz ?

>>>>>>Following Reset, the LPC2300 will operate from the Internal RC Oscillator until switched
by software. This allows systems to operate without any external crystal, and allows the
Boot Loader code to operate at a known frequency. If the external cryscal is not used, you are not required to configure the XTAL pin and block.

There is sample code for LPC23xx, pls refer to it.

https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mc...

 

Because the LPC23xx is very very old, we have not the board to have a test, I am sorry.

 

Hope it can help you

BR

XiangJun Rong

0 Kudos

2,211 Views
avinashneethi
Contributor I

Hi XiangJun Rong,

Sorry for the Delay reply. Using the steps in your above reply i can able to configure GPIO pin and toggle it. 

Currently we are trying to configure the UART0 for 115200 baudrate with internal RC OSC(4 MHz). As per the formula provided bellow,

Fdiv = ( Fpclk / 16 ) / baudrate ; /*baud rate */
U0DLM = Fdiv / 256;
U0DLL = Fdiv % 256;

Question:

1. But we cant able to get any output in terminal ? How to configure the U0DLM &  U0DLL by using Internal OSC ?

2. How to receive user input?

3. can we get any sample code is available to test both TX and RX using Internal RC OSC for LPC23XX ?

 

Regards,

Avinash N

0 Kudos

2,194 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Avinash,

Pls try to download the example code from the code-bundle link:

https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mc...

 

Hope it can help you

BR

XiangJun Rong

0 Kudos