Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

LPC1114 Serial Init translated from c to forth issue

83 views
Skip to first unread message

Clyde W. Phillips Jr.

unread,
May 16, 2013, 10:37:38 AM5/16/13
to
Sorry, many don't translate c to forth and many don't do arm and even if you did both this particular ARM chip is unlikely but I have a FORTH that needs to talk!

The LPC1114 is from NXP and they have a usb stick eval board and a eclipse development ide supporting c/c++.

Their example serial code works, using interrupts. My FORTH needs to talk polled i/o. The serial init routine is what I translated, without the interrupt part, and I added send a char at the end. This doesn't work.

If anyone has created code you can share to init this serial port for polling i/o I'd appreciate using it.

Less likely if you would review my translation I would be most grateful as I have no friends who code at all.

Hope to here from a few of you in the forum

Clyde

Elizabeth D. Rather

unread,
May 16, 2013, 5:30:19 PM5/16/13
to
Download an evaluation version of SwiftX from www.forth.com. There are
serial port drivers for most targets.

Cheers,
Elizabeth

--
==================================================
Elizabeth D. Rather (US & Canada) 800-55-FORTH
FORTH Inc. +1 310.999.6784
5959 West Century Blvd. Suite 700
Los Angeles, CA 90045
http://www.forth.com

"Forth-based products and Services for real-time
applications since 1973."
==================================================

David Schultz

unread,
May 16, 2013, 7:12:42 PM5/16/13
to
On 05/16/2013 09:37 AM, Clyde W. Phillips Jr. wrote:
> Their example serial code works, using interrupts. My FORTH needs to
> talk polled i/o. The serial init routine is what I translated,
> without the interrupt part, and I added send a char at the end. This
> doesn't work.
>

You haven't included your code so it is impossible to help you.

I have no experience with that particular chip but I have written code
for a couple of other ARMs. (LPC2138 and STM32F4) Looking at the manual
(which I hope was the first thing you checked) for this one it has the
usual complicated initialization requirements so it is possible, even
likely, that you missed something.


--
David W. Schultz
http://home.earthlink.net/~david.schultz
Returned for Regrooving


Stephen Pelc

unread,
May 17, 2013, 6:05:59 AM5/17/13
to
On Thu, 16 May 2013 07:37:38 -0700 (PDT), "Clyde W. Phillips Jr."
<cwp...@gmail.com> wrote:

>The LPC1114 is from NXP and they have a usb stick eval board
>and a eclipse development ide supporting c/c++.
...
>If anyone has created code you can share to init this serial port
>for polling i/o I'd appreciate using it.

See the MPE Arm/Cortex cross compiler Stamp edition. It includes
polled and two serial drivers for the LPC11xx CPUs.

The problems are nearly always in the pin set up and clock selection
routines.

: initUART \ divisor base --
\ *G Initialise the UART with the given baud rate divisor.
swap >r
0 over UnACR + ! \ turn off autobaud
$10 over UnFDR + ! \ turn off fractional baud rate
1 over UnFCR + ! \ enable FIFOs
$83 over UnLCR + ! \ 8 data, 1 stop, no parity, enable DLAB
r@ 8 rshift $FF and over UnDLM + ! \ set divisor
r> $FF and over UnDLL + !
$03 over UnLCR + ! \ clear DLAB
drop
;

: init-ser0 \ --
\ *G Initialise serial port 0
$1:0040 _SYSCON SYSAHBCLKCTRL + or! \ Enable IOCON and GPIO clocks
_IOCONFIG IOCON_PIO1_6 + dup @ \ RXD input, no pull up/down
$03 invert and
$01 or
swap !
_IOCONFIG IOCON_PIO1_7 + dup @ \ TXD output, no pull up/down
$03 invert and
$01 or
swap !

bit12 _SYSCON SYSAHBCLKCTRL + or! \ Enable UART clock
pcdU0 _SYSCON UARTCLKDIV + ! \ set clock divider

u0-divisor _UART0 initUART
;

Stephen



--
Stephen Pelc, steph...@mpeforth.com
MicroProcessor Engineering Ltd - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel: +44 (0)23 8063 1441, fax: +44 (0)23 8033 9691
web: http://www.mpeforth.com - free VFX Forth downloads

Clyde W. Phillips Jr.

unread,
May 17, 2013, 8:57:19 PM5/17/13
to
Thanks for the support y'all!
0 new messages