Forums

AW: Re: SPI Communication between 56807

Started by Unknown March 6, 2003
Hello Rick,

Thanks for your help. I have found the error. The /SS-signal have to assigned as
Peripherials (not as GPIO port).
Here the corrected slave setup:
void spi_setup(void) {

io.gpioe.per|=0x00F0; /* assign SCLK, MOSI & MISO, SS (GPIOE4-7) to SPI
peripheral */
io.spi.scr=0x00A5; /* MSB first, Slave mode, CPOL=0, CPHA=1, Rx Int*/
io.spi.dsr=0x000B; /* 12 bits */

io.spi.scr|=0x0002; /* enable slave*/
}
And the master setup:
void spi_setup(void) {

io.gpioe.per|=0x0070; /* assign SCLK, MOSI & MISO (GPIOE4-6) to SPI peripheral
*/
io.gpioe.per&=~0x0080; /* GPIOE7 will serve as /SS */
io.gpioe.ddr|=0x0080; /* it is output*/

SPI_SS_DEACTIVATE; // SS must activate before write to SPDTR
// and deactive after for synchronisation !
io.spi.scr=0x00B6; /* MSB first, Master mode, CPOL=0, CPHA=1, SPI enable */
io.spi.dsr=0x000B; /* 12 bits */
}

Note /* 805 EVM + 807 EVM HAS TO BE MODIFIED !! */
/* a resistor or jumper must be added between DSP MISO and MAX5251 MISO to
prevent the MAX5251 to drive the MISO line */
/* no modifications are needed on 803 EVM */

At the moment i've got problems with incorrect data reading. The slave reads
data from the master 25 times good but then he reads 20 times wrong data ( data
is shifted by 1 bit or more). After the wrong data sequence he reads again good
data and so on. The data from the master looks very good; not time critical. And
the SS-signal will cleared before writing and after getting return from slave.
Changing of Baudrate and IPBUS_FREQUENCY will not help a lot. If somebody have
experience about that, i will be glad to here about.

Regards
Stefan
-----Ursprgliche Nachricht-----
Von: Corey, Rick [mailto:]
Gesendet: Donnerstag, 6. Mz 2003 15:01
An: Schfele, Stefan
Betreff: RE: [motoroladsp] Re: SPI Communication between 56807 Hi Stefan

I found the name of the variable that controls IPBus clock speed, which
would affect the SPI baud rate, which might affect your SPI peripherals'
ability to communicate. It is PLL_MUL.

Have you found the problem? I think it helps everyone to learn about
mistakes that are easy to make.

Rick Corey -----Original Message-----
From: stefan_schaeufele <>
[mailto:]
Sent: Thursday, February 27, 2003 9:12 AM
To:
Subject: [motoroladsp] Re: SPI Communication between 56807 Hi Rick,
thanks for your tips, but i get no spi communication started.

The master spi seems to work correct. He toggles the SCLK-signal 16
times and move correct bits over the MOSI line. But the slave will
not jump in his ISR and i don't know why. Because the SPIRIE and the
SPE are enabled. The /SS-signal will be controlled by the spi modul
(CPHA=0), but i cannot measure any signal toggling.

If somebody have an idea what's going wrong i will be very happy.

--- In , "Corey, Rick" <rcorey@d...> wrote:
> Hi Stefan
>
> I'm not sure what you should change. I just started working with
SPI
> myself, and I will be using the SDK to set up the 56803 SPI
peripheral.
> However, I need to use IRQs, so I will be writing my own ISRs,
probably
> making use of "SendBits()".
> Three questions to narrow down what may be going wrong for you:
> Do your ISR functions get called at all?
> Does anything get clocked out of MOSI?
> Does your SCLK signal toggle up and down? > I also have two SPI questions. > I'm trying to learn how to attach my SPI Rx and Tx ISRs to the IRQs
using
> the 56803 SDK.
> I can see an ioctl command for the SCI RS232 serial peripheral, but
not for
> the SPI peripheral:
> ioctl( SciHandle, SCI_CALLBACK_RX, SerialRxISR );
> ioctl( SciHandle, SCI_CALLBACK_TX, SerialTxISR );
>
> I see the SPI ioctl command "SPI_RX_INTERRUPT_ENABLE", but my SDK
doc says
> "no parameters" for that command, and spi_sParms has no place for a
function
> pointer.
>
> Can I just "attach" these ISRs at the bottom of my appconfig.h?
> I haven't tried that yet because I got errors when I tried to do
that with
> timer ISRs, where some timers had been set up using the SDK (not my
timers).
>
> I would imitate these lines if this is the "right way", but of
course use
> IRQ numbers 16 & 17:
> #define GPR_INT_PRIORITY_14 1 //
> MSCAN Tx Ready TXEIE
> void ISR_CAN_Transmit( void );
> #define NORMAL_ISR_14 ISR_CAN_Transmit > My second question: when I #defined INCLUDE_SPI in appconfig.h, I
got a
> compile error right away. (I'm using 5.0.3).
> (I already had #defined INCLUDE_IO, which apparently drags in
> INCLUDE_IO_SPI. )
> I get the following error from the following lines of code. I
haven't
> written any SPI code yet, just #defined INCLUDE_IO. Can anyone
suggest
> where I should look to untangle this? It seems to be a prototype
mismatch
> between spiRead and spiRead (?)
>
> Error : cannot convert
> 'unsigned int (*)(int, unsigned short *, unsigned int)'
to
> 'unsigned int (*)(int, const void *, unsigned
int)'
> const.c line 2335 spiWrite,
>
> ------
>
> const io_sInterface spidrvIOInterfaceVT = {
> spiClose,
> spiRead,
> --> spiWrite,
> NULL
> }; >
> -----Original Message-----
> From: stefan_schaeufele <stefan.schaeufele@b...>
> [mailto:stefan.schaeufele@b...]
> Sent: Wednesday, February 26, 2003 8:17 AM
> To:
> Subject: [motoroladsp] SPI Communication between 56807 > Hi,
> i would like to use the spi-module to communicate between DSP's.
> Normally there is one master and at least one slave DSP. The master
> will send two 32 bit values out of his spi-module (MOSI-pin) in 8-
bit
> bundles. The slave who is interested in the master data, has to
pull
> down the SS-pin and listen to the master.
>
> I have connected all pins 1:1 between master and slave (MISO -
> MISO,MOSI-MOSI,SCLK-SCLK,/SS-/SS).
>
> The setup for the master:
> #define SPI_SS_DEACTIVATE io.gpioe.dr|=0x0080;
> #define SPI_SS_ACTIVATE io.gpioe.dr&=~0x0080;
>
> void spi_setup(void) {
> io.gpioe.per|=0x0070; /* assign SCLK, MOSI & MISO
> (GPIOE4-6) to SPI peripheral */
> io.gpioe.per&=~0x0080; /* GPIOE7 will serve as /SS */
> io.gpioe.ddr|=0x0080; /* it is output */
> SPI_SS_DEACTIVATE;
> io.spi.scr=0x0067; /* MSB first,
> 5Mbit/s, Master mode, CPOL=0, CPHA=0, Rx Int, SPI enable */
> io.spi.dsr=0x000B; /* 12 bits */
> }
>
> The setup for the slave:
> void spi_setup(void) {
> io.gpioe.per|=0x0070; /* assign SCLK, MOSI & MISO
> (GPIOE4-6) to SPI peripheral */
> io.gpioe.per&=~0x0080; /* GPIOE7 will serve as /SS */
> io.gpioe.ddr&=~0x0080; /* it is input */
> SPI_SS_ACTIVATE; /* make it inactive */
> io.spi.scr=0x0066; /* MSB first,
> 5Mbit/s, Master mode, CPOL=0, CPHA=0, Rx Int, SPI enable */
> io.spi.dsr=0x000B; /* 12 bits */
> } > The problem is that it not work. Maybe there is an Hardware Bug,
but
> i'm not sure. Has anyone experience with this and can help me.
>
> Additional questions : Why can i not see what will be send out with
> the Debugger (in the memory view)?
>
> Regards >
> _____________________________________
> Note: If you do a simple "reply" with your email client, only the
author of
> this message will receive your answer. You need to do a "reply
all" if you
> want your answer to be distributed to the entire group.
>
> _____________________________________
> About this discussion group:
>
> To Join:
>
> To Post:
>
> To Leave:
>
> Archives: http://www.yahoogroups.com/group/motoroladsp
>
> More Groups: http://www.dsprelated.com/groups.php3 > ">http://docs.yahoo.com/info/terms/ _____________________________________
Note: If you do a simple "reply" with your email client, only the author of
this message will receive your answer. You need to do a "reply all" if you
want your answer to be distributed to the entire group.

_____________________________________
About this discussion group:

To Join:

To Post:

To Leave:

Archives: http://www.yahoogroups.com/group/motoroladsp

More Groups: http://www.dsprelated.com/groups.php3 ">http://docs.yahoo.com/info/terms/ ____________________________________________________________________
This email and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed and
may contain confidential and/ or privileged material. Any review,
retransmission, dissemination or other use of, or taking of any action in
reliance upon, this information by persons or entities other than the intended
recipient is prohibited. If you have received this email in error, please
contact the sender and delete the material from any computer.
____________________________________________________________________



Hello Stefan

// At the moment i've got problems with incorrect data reading. The slave
reads data from the master 25 times good but then // he reads 20 times wrong
data ( data is shifted by 1 bit or more).

I have the same problem(data shifted 1 bit or more). Make sure you are
acomplishing whit rise and fall times in SCLK. Also the SCLK must be noise
free for a proper operation.

Regards

Marcos Di Fazio


Attachment (not stored)
winmail.dat
Type: application/ms-tnef