Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: LPC2131 SPI problem

2005-10-01 by Jan Szymanski

--- In lpc2000@yahoogroups.com, "drb5599" <dbutler@c...> wrote:
> Hello All,
> I have been using the SPI interface on a LPC2131 with good success 
so 
> far.  Now, I am trying to interface an LCD controller (HT1621) and 
> found a strange issue.  The LCD must have it's data written 12 bits
> at 
> a time.  So I configured the SPI control register to operate in 
this 
> mode.
> 
> S0SPCR      =   0x0C24;
> 
> which sets 
> bit#2: The SPI controller sends and receives the number of bis 
> selected by bits 11:8
> bit#5: Yes, I am using the LPC as a master
> bits#11:10: Selects 12 bits per transfer
> 
> However, when I step thru my code, and look at the S0SPCR register,
> it 
> is written with a 0x0424!!!!!!!!!!!!!
> For some reason bit 11 does not get written?  Consequently, this is
> an 
> undefined state for the register and it goes off into the wild 
blue 
> yonder and never stops sending out clock pulses.
> 
> I am able to stop the program and manually change the register 
> contents and I get the expected 12-bits shifted out.
> 
> Anybody ever experience this??  Is there a work around?
> 
> Also I am new to LCD's never programmed one before, the format of 
the 
> data looks really strange.  If anybody knows some good tricks for 
> interfacing an LCD with a serial interface, I would be grateful. 
> But, 
> for now I am really stuck with the problem at hand.
> 
> Thanks,
> Dave B.

Hi,

Use 8 bit plus 8 bit with one nibble NA, just keep CS active for two 
8-bit writes.
You have to control CS line for LCD from port pin anyhow.
Another way is to do bit banging (plenty of examples for that around)

good luck

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.