UART3 settings in LPC1788

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

UART3 settings in LPC1788

1,812 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ybacem on Fri Feb 06 07:36:43 MST 2015
Hi All,

I have a little problem with my configuration of UART3.
I have 2 functions UART0 and UART1 works with no problems.

But in my UART3 initialisation i can't write in register . At the moment of the program write in register of UART3 , the LPC1788 don't works.
someone there already you had this problem?

thanks

my code of uart3_init :

       //P0.00 = TX
Init_fonction_pin(0,0,2,0); //page 120 
//P0.01 = RX
Init_fonction_pin(0,1,2,0); //page 120 
//P4.31 = IO = sense 485
Init_fonction_pin(4,31,0,2); //page 123 



LPC_UART3->LCR = 0x0083 ; //DLAB = 1,sans parité,1 stop,1 start,8 bits data
 
        LPC_UART3->DLM = 0;
LPC_UART3->DLL = 52;
LPC_UART3->FDR = 0x10;

        //fifo
LPC_UART3->FCR = 0xC7 ; //page 484 ,raz fifos , RX fifo = 14

LPC_UART3->LCR = 0x03 ; //DLAB = 0,sans parité,1 stop,1 start,8 bits data


  
//pas d'interruptions
LPC_UART3->IER = 0x00; //page 480
Labels (1)
0 Kudos
Reply
8 Replies

1,416 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MikeSimmonds on Wed Feb 11 14:07:53 MST 2015
Checklist.

Before doing anything with the UART(s)

1: Set up the Crystal/PLL/IRC etc. [What is your clock speed?]
2: Set the periheral clock divider

Setting up UART 3

3: Set bit 25 in PCONP [Double check in debugger?] This is for UART3
4: Set IOCON for port 0 bit 0 and bit 1 for TX RX.  (function 2)
    and Port1 bit 30 (function 5) if you want RS485 steering.
5: UART3->IER = 0 to disable any interrupts whilst setting up [NB DLAB must be 0]
6: Continue setting up

If steps 1 to 4 done correctly, then should not get memory fault (promoted to hard fault?)
when accessing the UART registers.

I do not use LPCOpen, but I suspect that these steps are visible in the 1778 examples.

Mike




0 Kudos
Reply

1,416 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by starblue on Wed Feb 11 06:26:51 MST 2015
If it completely locks up (not even a hard fault) that points to a missing clock.  Can you show the code for enabling it?
0 Kudos
Reply

1,416 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ybacem on Wed Feb 11 05:46:52 MST 2015
Hi thefallguy,
thanks for your reply
yes, i enabled them in the syscon .
0 Kudos
Reply

1,416 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Wed Feb 11 05:10:28 MST 2015
Have you enabled them in the SYSCON?
0 Kudos
Reply

1,416 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ybacem on Wed Feb 11 02:36:20 MST 2015
Hi NXP support,

My code is good. I can used uart 1, 0 and 4 but I can't used UART 3 or 2 . I can't write in registers of these functions without HardFault_Handler.

regards,
ybacem
0 Kudos
Reply

1,416 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ybacem on Wed Feb 11 00:50:04 MST 2015
Hi Mike, thank you for your reply.

I have enabled the UART3 CLOCK via the PCONP register. My error is The LPC1788 is lockup when writing to a register of UART3.
exemple : LPC_UART3->LCR = 0x0083 ; //DLAB = 1,sans parité,1 stop,1 start,8 bits data with adress of LPC_UART3->LCR -> 0x4009C00C.

I feel I have no right to write in the registers of this function,but  there are R / W. Is he could have a blockage of functions lying in the APB1?Because until I have only used the function belonging to APB0.

I know it works, I just want to find my mistake and I understand  that you do not show your code, which any way will not help me .

ybacem
0 Kudos
Reply

1,416 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nerd herd on Fri Feb 06 12:39:19 MST 2015
Hi ybacem,

Please take a look at our LPCOpen software platform. It provides the software infrastructure to initialize peripherals such as UART with APIs. At the very least it can be used as a reference to your own code.

http://www.lpcware.com/content/nxpfile/lpcopen-software-development-platform-lpc17xx-packages
0 Kudos
Reply

1,416 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MikeSimmonds on Fri Feb 06 10:57:27 MST 2015
Your pins are wrong.

P4.31 function 0 is GPIO, you need Pin 1.30 (and the function is 5)

Your error description is vague -- WHICH register is written (with what value)?
What does "the LPC1788 don't works" mean? Lockup? Reboot? Debugger Fails? What?

Have you enabled the UART3 clocks via the PCONP register?

For the record, my U3 setup works as expected (in RS232 mode).
I can't share code as (a) it is for a company, and (b) is in assembler anyway.
So don't ask.

Mike
0 Kudos
Reply