MPC 8xx as SPI slave...
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/
Quoted 11 lines · In message <[email protected]> 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?
Quoted 2 lines
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: [email protected] 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/
Dear Wolfgang Denk,
Thanks for your reply...
Quoted 1 line
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.
Quoted 3 lines
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/
Dear Kim,
Quoted 4 lines · in message <[email protected]> you wrote:
Also, I was doubt the cache problem.
I'll check again...
My code is based on yourlwmon_spi.cjust basic function.
Note that there is also a simple (and more generic) SPI driver in cpm_spi.c
Quoted 6 lines
Quoted 3 lines
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: [email protected] 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/