EmbeddedRelated.com
Forums

LPC-2378-STK board LCD Screen using Crossworks.

Started by jasuk1970 February 8, 2008
> I use some slightly different code.
>
> void WriteSpiCommand(volatile unsigned int command) {
>
> // wait for the previous transfer to complete
> while((SSP0SR & (1<<0)) == 0);
> wait_uS(10);
>
> // clear bit 8 - indicates a "command"
> command = (command & ~0x0100);
>
> // send the command
> SSP0DR = command;
> }
> void WriteSpiData(volatile unsigned int data) {
>
> // wait for the transfer to complete
> while((SSP0SR & (1<<0)) == 0);
> wait_uS(10);
>
> // set bit 8, indicates "data"
> data = (data | 0x0100);
>
> // send the data
> SSP0DR = data;
> }
>

Thanks Michael,
I've dropped all my code and started with yours and referencing the
James Lynch tutorial and have now got the screen working with the
Crossworks compiler. (To a degree :) )

I need to look into a few things to iron out speed issues etc. And how
to do the reset (FIO commands seem to compile but not work, though IO
ones do, but there is no IO3 which means the reset cannot be done for
the moment (So I run the clear screen routine to make sure everything
is OK.

Cheers,

Jas

An Engineer's Guide to the LPC2100 Series

jasuk1970 wrote:

> I've dropped all my code and started with yours and referencing the
> James Lynch tutorial and have now got the screen working with the
> Crossworks compiler. (To a degree :) )
>
> I need to look into a few things to iron out speed issues etc. And how
> to do the reset (FIO commands seem to compile but not work, though IO
> ones do, but there is no IO3 which means the reset cannot be done for
> the moment (So I run the clear screen routine to make sure everything
> is OK.

I was disappointed with how slow I have to clock the SPI interface to make
it work (4MHz IIRC). It should be able to run much faster according to the
datasheets, but for some reason it won't work at higher speeds on my board.
It has been a couple of months since I played with this stuff, so I'm kinda
fuzzy on the details. I do believe that I have a bunch of unnecessary
delays in places where I tried to get the SPI clocking faster.

Do you have one of these:
SCS |= (1UL<<0); // set GPIOM in SCS for fast IO on PORT0 and PORT1

PORT2 and PORT3 are always accessed via the "fast" i/o methods; that's why
there is no IO3.
A quick follow-up.

Taking out any sleeps and changing SSP0CPSR = 18 to = 4 does make a
difference in the speed.

But a clear screen to a colour does still seem to update visibly.

Jas

--- In l..., "jasuk1970" wrote:
>
> --- In l..., "michael brown" wrote:
> >
> > jasuk1970 wrote:
> >
> > > I've dropped all my code and started with yours and referencing the
> > > James Lynch tutorial and have now got the screen working with the
> > > Crossworks compiler. (To a degree :) )
> > >
> > > I need to look into a few things to iron out speed issues etc.
And how
> > > to do the reset (FIO commands seem to compile but not work,
though IO
> > > ones do, but there is no IO3 which means the reset cannot be
done for
> > > the moment (So I run the clear screen routine to make sure
everything
> > > is OK.
> >
> > I was disappointed with how slow I have to clock the SPI interface
> to make
> > it work (4MHz IIRC). It should be able to run much faster according
> to the
> > datasheets, but for some reason it won't work at higher speeds on my
> board.
> > It has been a couple of months since I played with this stuff, so
> I'm kinda
> > fuzzy on the details. I do believe that I have a bunch of
unnecessary
> > delays in places where I tried to get the SPI clocking faster.
> >
> > Do you have one of these:
> > SCS |= (1UL<<0); // set GPIOM in SCS for fast IO on PORT0 and PORT1
> >
> > PORT2 and PORT3 are always accessed via the "fast" i/o methods;
> that's why
> > there is no IO3.
> > Hi,
> I had actually not yet found the UM10211 document, Paul from Rowley
> mentioned some stuff in it which has now caused me to finally start
> understanding how everything works :).
>
> I've use:
>
> SCS |= SCS_GPIO0M;
>
> to enable the FIO on port 0 and 1.
>
> I've removed the delays that you had in the program and to run the CLS
> takes around 1/4 of a second, its just visible to the naked eye.
>
> Now that I've found this document I may go through the port
> configuration and find out why changing the clock rate doesn't seem to
> make any difference. I'll let you know how I get on.
>
> Thanks again for the help.
>
> Jas
>
--- In l..., "michael brown" wrote:
>
> jasuk1970 wrote:
>
> > I've dropped all my code and started with yours and referencing the
> > James Lynch tutorial and have now got the screen working with the
> > Crossworks compiler. (To a degree :) )
> >
> > I need to look into a few things to iron out speed issues etc. And how
> > to do the reset (FIO commands seem to compile but not work, though IO
> > ones do, but there is no IO3 which means the reset cannot be done for
> > the moment (So I run the clear screen routine to make sure everything
> > is OK.
>
> I was disappointed with how slow I have to clock the SPI interface
to make
> it work (4MHz IIRC). It should be able to run much faster according
to the
> datasheets, but for some reason it won't work at higher speeds on my
board.
> It has been a couple of months since I played with this stuff, so
I'm kinda
> fuzzy on the details. I do believe that I have a bunch of unnecessary
> delays in places where I tried to get the SPI clocking faster.
>
> Do you have one of these:
> SCS |= (1UL<<0); // set GPIOM in SCS for fast IO on PORT0 and PORT1
>
> PORT2 and PORT3 are always accessed via the "fast" i/o methods;
that's why
> there is no IO3.
>

Hi,
I had actually not yet found the UM10211 document, Paul from Rowley
mentioned some stuff in it which has now caused me to finally start
understanding how everything works :).

I've use:

SCS |= SCS_GPIO0M;

to enable the FIO on port 0 and 1.

I've removed the delays that you had in the program and to run the CLS
takes around 1/4 of a second, its just visible to the naked eye.

Now that I've found this document I may go through the port
configuration and find out why changing the clock rate doesn't seem to
make any difference. I'll let you know how I get on.

Thanks again for the help.

Jas