Reply by shwouchk February 26, 20082008-02-26
Lilo,
You don't need to execute my code twice - twice is if you set the
register in one go...

Can you post the relevant portions of code (how you setup the SPI and
how you send data) as well as an exact description of what happens?

In addition, if you didn't do this already, I suggest you disable any
and all ISRs during testing.

Kosta.

--- In l..., "lilov.lilo" wrote:
>
> Shwouchk,
>
> no success!
> I tried your suggestion, but there is no effect of that. I execute
> your code twice, may be I misunderstand your advice.
> regards,
> Lilo
>
> --- In l..., "shwouchk" wrote:
> >
> > Hi,
> > I don't know what register definitions you use, but I do this:
> >
> > S0SPCR_bit.BITENABLE = 1; // >8 bit transfer.
> > S0SPCR_bit.BITS = 0; // 16 bit transfer.
> >
> > if you set the whole register at once, try setting it twice.
> >
> > Good luck,
> > Shwouchk
> >
> >
> > --- In l..., "lilov.lilo" wrote:
> > >
> > > Thank you for your answers!
> > >
> > > Shwouchk,
> > > I don't how I could set the BITS after BitEnable, as they both
are in
> > > the same register.
> > >
> > > regards,
> > > Lilo
> > >
> > > --- In l..., "shwouchk" wrote:
> > > >
> > > > I have discovered through many hours of testing that if you set
> > > > 'BITENABLE', you must set the BITS *AFTERWARDS*. (I assumed you
> > > > understood what settings/registers I was talking about - if
not, let
> > > > me know)
> > > >
> > > > Hopefully it will solve your problem!
> > > >
> > > > Waiting to hear whether it did,
> > > > Shwouchk.
> > > >
> > > > --- In l..., "lilov.lilo" wrote:
> > > > >
> > > > > Dear all,
> > > > >
> > > > > I have the following problem: I use a LPC2138 MCU, the chip
> > > > > communicates with a SPI based chip (slave), I use the SPI0 of
> > the MCU
> > > > > for that communication. LPC2138 is master. The problem is
that the
> > > > > chip requires 16 bit data transfers, when I set the S0SPCR of
> > the MCU
> > > > > with appropriate data to send 16-bit data per transfer, and
start
> > > > > writing data to the S0SPDR, the SPI transfer ready flag in the
> > S0SPSR
> > > > > registers,never gets set. And my program starts cycling. Here
> > is the
> > > > > code for sending data through the SPI, I use:
> > > > >
> > > > > S0SPDR = u16Data;
> > > > > while(!(S0SPSR & BIT7));
> > > > >
> > > > > My code goes in endless loop, something else the clock line is
> > > > > generating clock endlessly.
> > > > >
> > > > > I tried the same code with setting 8-bit data per transfer
> (S0SPCR,
> > > > > BitEnable = 0), it works!
> > > > >
> > > > > regards,
> > > > > Lilo
> > > > >
> > > >
> > >
>

An Engineer's Guide to the LPC2100 Series

Reply by "lilov.lilo" February 26, 20082008-02-26
Shwouchk,

no success!
I tried your suggestion, but there is no effect of that. I execute
your code twice, may be I misunderstand your advice.
regards,
Lilo

--- In l..., "shwouchk" wrote:
>
> Hi,
> I don't know what register definitions you use, but I do this:
>
> S0SPCR_bit.BITENABLE = 1; // >8 bit transfer.
> S0SPCR_bit.BITS = 0; // 16 bit transfer.
>
> if you set the whole register at once, try setting it twice.
>
> Good luck,
> Shwouchk
> --- In l..., "lilov.lilo" wrote:
> >
> > Thank you for your answers!
> >
> > Shwouchk,
> > I don't how I could set the BITS after BitEnable, as they both are in
> > the same register.
> >
> > regards,
> > Lilo
> >
> > --- In l..., "shwouchk" wrote:
> > >
> > > I have discovered through many hours of testing that if you set
> > > 'BITENABLE', you must set the BITS *AFTERWARDS*. (I assumed you
> > > understood what settings/registers I was talking about - if not, let
> > > me know)
> > >
> > > Hopefully it will solve your problem!
> > >
> > > Waiting to hear whether it did,
> > > Shwouchk.
> > >
> > > --- In l..., "lilov.lilo" wrote:
> > > >
> > > > Dear all,
> > > >
> > > > I have the following problem: I use a LPC2138 MCU, the chip
> > > > communicates with a SPI based chip (slave), I use the SPI0 of
> the MCU
> > > > for that communication. LPC2138 is master. The problem is that the
> > > > chip requires 16 bit data transfers, when I set the S0SPCR of
> the MCU
> > > > with appropriate data to send 16-bit data per transfer, and start
> > > > writing data to the S0SPDR, the SPI transfer ready flag in the
> S0SPSR
> > > > registers,never gets set. And my program starts cycling. Here
> is the
> > > > code for sending data through the SPI, I use:
> > > >
> > > > S0SPDR = u16Data;
> > > > while(!(S0SPSR & BIT7));
> > > >
> > > > My code goes in endless loop, something else the clock line is
> > > > generating clock endlessly.
> > > >
> > > > I tried the same code with setting 8-bit data per transfer
(S0SPCR,
> > > > BitEnable = 0), it works!
> > > >
> > > > regards,
> > > > Lilo
> > > >
> > >
>
Reply by shwouchk February 26, 20082008-02-26
Hi,
I don't know what register definitions you use, but I do this:

S0SPCR_bit.BITENABLE = 1; // >8 bit transfer.
S0SPCR_bit.BITS = 0; // 16 bit transfer.

if you set the whole register at once, try setting it twice.

Good luck,
Shwouchk
--- In l..., "lilov.lilo" wrote:
>
> Thank you for your answers!
>
> Shwouchk,
> I don't how I could set the BITS after BitEnable, as they both are in
> the same register.
>
> regards,
> Lilo
>
> --- In l..., "shwouchk" wrote:
> >
> > I have discovered through many hours of testing that if you set
> > 'BITENABLE', you must set the BITS *AFTERWARDS*. (I assumed you
> > understood what settings/registers I was talking about - if not, let
> > me know)
> >
> > Hopefully it will solve your problem!
> >
> > Waiting to hear whether it did,
> > Shwouchk.
> >
> > --- In l..., "lilov.lilo" wrote:
> > >
> > > Dear all,
> > >
> > > I have the following problem: I use a LPC2138 MCU, the chip
> > > communicates with a SPI based chip (slave), I use the SPI0 of
the MCU
> > > for that communication. LPC2138 is master. The problem is that the
> > > chip requires 16 bit data transfers, when I set the S0SPCR of
the MCU
> > > with appropriate data to send 16-bit data per transfer, and start
> > > writing data to the S0SPDR, the SPI transfer ready flag in the
S0SPSR
> > > registers,never gets set. And my program starts cycling. Here
is the
> > > code for sending data through the SPI, I use:
> > >
> > > S0SPDR = u16Data;
> > > while(!(S0SPSR & BIT7));
> > >
> > > My code goes in endless loop, something else the clock line is
> > > generating clock endlessly.
> > >
> > > I tried the same code with setting 8-bit data per transfer (S0SPCR,
> > > BitEnable = 0), it works!
> > >
> > > regards,
> > > Lilo
> > >
>
Reply by "lilov.lilo" February 26, 20082008-02-26
Thank you for your answers!

Shwouchk,
I don't how I could set the BITS after BitEnable, as they both are in
the same register.

regards,
Lilo

--- In l..., "shwouchk" wrote:
>
> I have discovered through many hours of testing that if you set
> 'BITENABLE', you must set the BITS *AFTERWARDS*. (I assumed you
> understood what settings/registers I was talking about - if not, let
> me know)
>
> Hopefully it will solve your problem!
>
> Waiting to hear whether it did,
> Shwouchk.
>
> --- In l..., "lilov.lilo" wrote:
> >
> > Dear all,
> >
> > I have the following problem: I use a LPC2138 MCU, the chip
> > communicates with a SPI based chip (slave), I use the SPI0 of the MCU
> > for that communication. LPC2138 is master. The problem is that the
> > chip requires 16 bit data transfers, when I set the S0SPCR of the MCU
> > with appropriate data to send 16-bit data per transfer, and start
> > writing data to the S0SPDR, the SPI transfer ready flag in the S0SPSR
> > registers,never gets set. And my program starts cycling. Here is the
> > code for sending data through the SPI, I use:
> >
> > S0SPDR = u16Data;
> > while(!(S0SPSR & BIT7));
> >
> > My code goes in endless loop, something else the clock line is
> > generating clock endlessly.
> >
> > I tried the same code with setting 8-bit data per transfer (S0SPCR,
> > BitEnable = 0), it works!
> >
> > regards,
> > Lilo
>
Reply by geeseelam February 25, 20082008-02-25
Hi Lilo,

I'm using the SPI0 port to transfer 16 bits of information. I
actually have an LPC2132 as the master communicating with an LPC2138
as the slave.

I setup the LPC2132 just as you mentioned and I don't have a problem
with it continuously generating a clock. I didn't see anyting
mentioned in the LPC2138 errata that would indicate that the LPC2138
should behave differently than the LPC2132.

Chris

--- In l..., "lilov.lilo" wrote:
>
> Dear all,
>
> I have the following problem: I use a LPC2138 MCU, the chip
> communicates with a SPI based chip (slave), I use the SPI0 of the
MCU
> for that communication. LPC2138 is master. The problem is that the
> chip requires 16 bit data transfers, when I set the S0SPCR of the
MCU
> with appropriate data to send 16-bit data per transfer, and start
> writing data to the S0SPDR, the SPI transfer ready flag in the
S0SPSR
> registers,never gets set. And my program starts cycling. Here is
the
> code for sending data through the SPI, I use:
>
> S0SPDR = u16Data;
> while(!(S0SPSR & BIT7));
>
> My code goes in endless loop, something else the clock line is
> generating clock endlessly.
>
> I tried the same code with setting 8-bit data per transfer (S0SPCR,
> BitEnable = 0), it works!
>
> regards,
> Lilo
>
Reply by shwouchk February 25, 20082008-02-25
I have discovered through many hours of testing that if you set
'BITENABLE', you must set the BITS *AFTERWARDS*. (I assumed you
understood what settings/registers I was talking about - if not, let
me know)

Hopefully it will solve your problem!

Waiting to hear whether it did,
Shwouchk.

--- In l..., "lilov.lilo" wrote:
>
> Dear all,
>
> I have the following problem: I use a LPC2138 MCU, the chip
> communicates with a SPI based chip (slave), I use the SPI0 of the MCU
> for that communication. LPC2138 is master. The problem is that the
> chip requires 16 bit data transfers, when I set the S0SPCR of the MCU
> with appropriate data to send 16-bit data per transfer, and start
> writing data to the S0SPDR, the SPI transfer ready flag in the S0SPSR
> registers,never gets set. And my program starts cycling. Here is the
> code for sending data through the SPI, I use:
>
> S0SPDR = u16Data;
> while(!(S0SPSR & BIT7));
>
> My code goes in endless loop, something else the clock line is
> generating clock endlessly.
>
> I tried the same code with setting 8-bit data per transfer (S0SPCR,
> BitEnable = 0), it works!
>
> regards,
> Lilo
>
Reply by shwouchk February 25, 20082008-02-25
The SPI module works fine in 16 bit mode - please don't misdirect
people regarding solutions.

--- In l..., Petrescu wrote:
>
> Hi,
> Use SSP interface for 16-bit data transfers.
> Ioan
>
> lilov.lilo wrote:
> >
> > Dear all,
> >
> > I have the following problem: I use a LPC2138 MCU, the chip
> > communicates with a SPI based chip (slave), I use the SPI0 of the MCU
> > for that communication. LPC2138 is master. The problem is that the
> > chip requires 16 bit data transfers, when I set the S0SPCR of the MCU
> > with appropriate data to send 16-bit data per transfer, and start
> > writing data to the S0SPDR, the SPI transfer ready flag in the S0SPSR
> > registers,never gets set. And my program starts cycling. Here is the
> > code for sending data through the SPI, I use:
> >
> > S0SPDR = u16Data;
> > while(!(S0SPSR & BIT7));
> >
> > My code goes in endless loop, something else the clock line is
> > generating clock endlessly.
> >
> > I tried the same code with setting 8-bit data per transfer (S0SPCR,
> > BitEnable = 0), it works!
> >
> > regards,
> > Lilo
> >
>
Reply by "lilov.lilo" February 25, 20082008-02-25
Hi, Ioan,

does it mean there is a bug, which has no fix/workaround with SPI0
module in more than 8-bit transfer mode?

regards,
Lilo
Reply by Petrescu February 25, 20082008-02-25
Hi,
Use SSP interface for 16-bit data transfers.
Ioan

lilov.lilo wrote:
>
> Dear all,
>
> I have the following problem: I use a LPC2138 MCU, the chip
> communicates with a SPI based chip (slave), I use the SPI0 of the MCU
> for that communication. LPC2138 is master. The problem is that the
> chip requires 16 bit data transfers, when I set the S0SPCR of the MCU
> with appropriate data to send 16-bit data per transfer, and start
> writing data to the S0SPDR, the SPI transfer ready flag in the S0SPSR
> registers,never gets set. And my program starts cycling. Here is the
> code for sending data through the SPI, I use:
>
> S0SPDR = u16Data;
> while(!(S0SPSR & BIT7));
>
> My code goes in endless loop, something else the clock line is
> generating clock endlessly.
>
> I tried the same code with setting 8-bit data per transfer (S0SPCR,
> BitEnable = 0), it works!
>
> regards,
> Lilo
>
>
Reply by "lilov.lilo" February 25, 20082008-02-25
Dear all,

I have the following problem: I use a LPC2138 MCU, the chip
communicates with a SPI based chip (slave), I use the SPI0 of the MCU
for that communication. LPC2138 is master. The problem is that the
chip requires 16 bit data transfers, when I set the S0SPCR of the MCU
with appropriate data to send 16-bit data per transfer, and start
writing data to the S0SPDR, the SPI transfer ready flag in the S0SPSR
registers,never gets set. And my program starts cycling. Here is the
code for sending data through the SPI, I use:

S0SPDR = u16Data;
while(!(S0SPSR & BIT7));

My code goes in endless loop, something else the clock line is
generating clock endlessly.

I tried the same code with setting 8-bit data per transfer (S0SPCR,
BitEnable = 0), it works!

regards,
Lilo