LabVIEW Embedded

cancel
Showing results for 
Search instead for 
Did you mean: 

Enable UART 2/3 on LPC2378

Hi,

I'm trying to use UART port 2 and 3 on the LPC2378 MCU.  Labview gives me an error everytime I try to open these ports with the Serial Init VI.  I checked ARM_Serial.c in the compiled C code and saw that the init code for port 2 and 3 isn't even written.  I added the correct PCONP and PINSEL code, but it still gives me the same error.

 

Any help is appreciated,

DZ 

0 Kudos
Message 1 of 16
(12,344 Views)

Hi DZ,

 

LabVIEW Embedded for ARM only supports the MCB2300 evaluation board. The evaluation board allows you to access UART ports 0 and 1. The underlying code for access to ports 2 and 3 needs to be user implemented. You will need to do some development, probably using the inline C node. Please let me know if I can be of anymore help.

 

Regards,

 

Meghan M.

Applications Engineer

National Instruments

0 Kudos
Message 2 of 16
(12,330 Views)

Thank you for your reply,

 After initializing the serial port with PCONP and PINSEL, what other code would I need?  From the looks of the ARM_Serial.c file that Labview generated, the code for port 2 and 3 is there, the only thing missing is powering on port 2 and 3 and selecting the right pin functions.

 

DZ 

0 Kudos
Message 3 of 16
(12,325 Views)

hello,

 

Try changing SER_MAXPORT to 3 (in ARM_Serial.c).  That should get rid of the error that you are seeing. 

 

If you are still seeing issues, it may be related to the jumper configuration on your board, so I suggest checking the manual for your board.

 

I also suggest referring to the lpc23xx manual to verify your changes in ARM_Serial_OpenPort and ARM_Serial_ClosePort :  lpc23xx manual

Message 4 of 16
(12,317 Views)
Thanks for the help, I can open port 2 and 3 fine now.  But now I have another problem, the data I'm reading from port 2 and 3 seems to be corrupted, is there some other code missing in ARM_Serial.c for port 2 and 3?
0 Kudos
Message 5 of 16
(12,292 Views)

hello

 

Well if you are able to connect, then I'm guessing something is wrong with the configuration..

 

I would suggest using the "Show microvision" option while you are running and bring up the "Peripheral" menu.  You can check the values that are set on the UART2/3 peripherals and compare them to what you think they ought to be.  You should also check:

 

-  pin select: verify pins are set properly

 

-  power control: verify UART is powered on (this should already be true, but you can change the value of PCONP_Val in LPC2300.s)

 

-  clock dividers: I noticed that UART0/1 are configured to be CCLK/2.  Perhaps UART2/3 should be set the same.  This can be done in LPC2300.s by setting PCLKSEL1_Val    EQU     0x0000A000 

 

Once you are sure that the registers are configured properly and you are still reading corrupt values, there could be an issue with the signal itself (i.e. jitter, bad ground) or the hardware configuration (i.e. jumpers)

 

Message Edited by Gmg on 04-14-2009 10:46 AM
0 Kudos
Message 6 of 16
(12,272 Views)

 

-  clock dividers: I noticed that UART0/1 are configured to be CCLK/2.  Perhaps UART2/3 should be set the same.  This can be done in LPC2300.s by setting PCLKSEL1_Val    EQU     0x0000A000 

Message Edited by Gmg on 04-14-2009 10:46 AM

 

Actually on second thought PCLKSEL1_Val would be 0x000A0000.  (You can find where I got this in the lpc23xx manual)

0 Kudos
Message 7 of 16
(12,258 Views)

Hi,

 

Firstly, in response to Gmg's reply, there is a better and easier way to change the peripheral clock rates.  Open the LPC2300.s in uVision3, and use the Configuration Wizard instead of the Text Editor.  This means that you can change clock details, change your powered peripherals without needing to see the datasheet.  This also means that you won't accidentally change a setting for another peripheral by just typing in  "PCLKSEL1_Val    EQU     0x0000A000".

 

Secondly, not sure if you've done this already, but you will need to program Labview's C-Code generator to use all 4 UARTs, not just 2.  You can do this by editting     "\\LabVIEW 8.x\CCodeGen\include\comms\PlatSerial.h"

 

Change:

#define NUM_SERIAL_DEVICES 2

to

#define NUM_SERIAL_DEVICES 4

 

Lastly, if you're having problems with transmitting the correct data on UART ports, one(or more) of the following settings may need to be changed:

 - UART_CLK

 - Baudrate

 - Fractional Divider

 - Line Control

 - etc.

 

You'll need to carefully check the datasheet.

 

You have have huge problems with these values if you change the dev kit's crystal value from 12MHz to something else.

 

Good Luck with it all.

 

BLang

0 Kudos
Message 8 of 16
(12,182 Views)

I too am trying to use UARTs 2 and 3 on the LPC2378.  I've read through the previous posts on this thread but, no luck so far.  Attached are the changed I've made to the ARM_Serial.c and the PlatSerial.h files.  When running my application I still get an error when initializing the serial port to 2.  I'm ignoring the last 3 posts for now, as I'm trying to eliminate the error I get when initializing the serial port.  After looking through the LPC23XX user manual and the MCB2300 User's Guide, I cannot find how the PCONP or the jumpers are related to the UARTs.  There must be something that I am missing or not understanding. 

 

Any help would be great,

 

Jeff

0 Kudos
Message 9 of 16
(11,926 Views)

Hi Jeff,

 

Can you please describe the error that you are seeing, or attach a screenshot of the error message? All of the changes that you made to your files seem to be correct.

 

Thanks,

0 Kudos
Message 10 of 16
(11,866 Views)