linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* MPC 8xx as SPI slave...
@ 2003-03-26  2:50 Young-Han, Kim
  2003-03-26  7:03 ` Wolfgang Denk
  0 siblings, 1 reply; 4+ messages in thread
From: Young-Han, Kim @ 2003-03-26  2:50 UTC (permalink / raw)
  To: linuxppc-embedded


  Hi!
  If you have any experience for SPI slave on MPC 8xx,
please advice to me.

  I will use the MPC 8xx as SPI slave, the SPI master is not MPC 8xx.
  Currently, using the SPI interrupt for RX/TX on MPC 8xx.
  The SPI write operation on SPI master is run very well.
  But, SPI read operation on SPI master is not so good.
  When SPI read operation on SPI master, the CPM of MPC 8xx
report the SPI TX interrupt as TX done.
  But, the MPC 8xx SPI not transmit that data on SPI bus,
just transmit old TX data.
  In second SPI read operation on SPI master, the MPC 8xx SPI
transmit previous data of TX BD.
  It means that the MPC 8xx SPI not transmit the data on time.
  I was checked with oscilloscope.
  If you know the reason of this problem, please answer to me.

from
Young-Han, Kim


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: MPC 8xx as SPI slave...
  2003-03-26  2:50 MPC 8xx as SPI slave Young-Han, Kim
@ 2003-03-26  7:03 ` Wolfgang Denk
  2003-03-26  9:44   ` Young-Han, Kim
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfgang Denk @ 2003-03-26  7:03 UTC (permalink / raw)
  To: Young-Han, Kim; +Cc: linuxppc-embedded


In message <000b01c2f342$8347d830$337ceccb@dasan.com> you wrote:
>
>   I will use the MPC 8xx as SPI slave, the SPI master is not MPC 8xx.
>   Currently, using the SPI interrupt for RX/TX on MPC 8xx.
>   The SPI write operation on SPI master is run very well.
>   But, SPI read operation on SPI master is not so good.
>   When SPI read operation on SPI master, the CPM of MPC 8xx
> report the SPI TX interrupt as TX done.
>   But, the MPC 8xx SPI not transmit that data on SPI bus,
> just transmit old TX data.
>   In second SPI read operation on SPI master, the MPC 8xx SPI
> transmit previous data of TX BD.

This could be a cache issue. Which source is your SPI driver based on?

>   It means that the MPC 8xx SPI not transmit the data on time.
>   I was checked with oscilloscope.

Does the 8xx transfer data at all? You know, SPI has a very, very low
priority onthe CPM, so it will be starved  by  any  other  I/O  (like
ethernet and especially USB).

Motorola writes:

        Note that the SPI is of lower priority internally than the
        SCCs, thus, the SPI will be the first device to be "starved".
        Snce it has no FIFO, it is especially sensitive to underruns.
        The best way to prevent this is to use a buffer size of 1
        "character" (of size programmed in the mode register).
...
        The physical clocking speed of the SPI can be up to 12 MHz.
        However, it only has a 16-bit holding register. Thus, the 12
        Mbit/sec rate can only be sustained for 16 bits. If you need
        to transmit more than 2-bytes of data at that clocking rate,
        you must put the data into separate BDs and set the data
        length to 2 and set the L bit in each BD. If you are using a
        character length of 16-bits, the maximum clocking rate is 3.1
        Mbit/sec. If you are using a character length of 8 bits, the
        maximum is 500 Kbits/sec. Note that 500 Kbits/sec is the
        maximum throughput when no other peripherals (SCCs, SMCs) are
        being used. Load on those peripherals will further reduce the
        maximum data rate through the SPI.

[This calculation is based on a 25 MHz clock.]



Best regards,

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
People seldom know what they want until you give them what  they  ask
for.

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: MPC 8xx as SPI slave...
  2003-03-26  7:03 ` Wolfgang Denk
@ 2003-03-26  9:44   ` Young-Han, Kim
  2003-03-26 11:02     ` Wolfgang Denk
  0 siblings, 1 reply; 4+ messages in thread
From: Young-Han, Kim @ 2003-03-26  9:44 UTC (permalink / raw)
  To: Wolfgang Denk; +Cc: linuxppc-embedded


Dear Wolfgang Denk,

  Thanks for your reply...

> This could be a cache issue. Which source is your SPI driver based on?

  Also, I was doubt the cache problem.
  I'll  check again...
  My code is based on your lwmon_spi.c just basic function.


> Does the 8xx transfer data at all? You know, SPI has a very, very low
> priority onthe CPM, so it will be starved  by  any  other  I/O  (like
> ethernet and especially USB).

  Just transmit the previous data of TX BD not on time.
  I'll check the priority...


  Thanks!

Best Regards
Young-Han, Kim

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: MPC 8xx as SPI slave...
  2003-03-26  9:44   ` Young-Han, Kim
@ 2003-03-26 11:02     ` Wolfgang Denk
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Denk @ 2003-03-26 11:02 UTC (permalink / raw)
  To: Young-Han, Kim; +Cc: linuxppc-embedded


Dear Kim,

in message <000901c2f37c$44a2a800$337ceccb@dasan.com> you wrote:
>
>   Also, I was doubt the cache problem.
>   I'll  check again...
>   My code is based on your lwmon_spi.c just basic function.

Note that there is also a simple (and more  generic)  SPI  driver  in
cpm_spi.c

> > Does the 8xx transfer data at all? You know, SPI has a very, very low
> > priority onthe CPM, so it will be starved  by  any  other  I/O  (like
> > ethernet and especially USB).
>
>   Just transmit the previous data of TX BD not on time.
>   I'll check the priority...

Try reducing the SPI clock. You cannot change the priority of SPI  in
the  CPM  - it is implemented in software (microcode), and running at
the lowest priority. It is not useful for any  taks  which  needs  to
transfer large amounts of data quickly.


Best regards,

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
Those who do not  understand  Unix  are  condemned  to  reinvent  it,
poorly.              - Henry Spencer, University of Toronto Unix hack

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-03-26 11:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-26  2:50 MPC 8xx as SPI slave Young-Han, Kim
2003-03-26  7:03 ` Wolfgang Denk
2003-03-26  9:44   ` Young-Han, Kim
2003-03-26 11:02     ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).