Forums

SPI Communication between 56807

Started by stefan_schaeufele February 26, 2003
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



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 <>
[mailto:]
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/



Hi

Tentatively answering one of my own questions:

I'm trying to learn how to attach my SPI Rx and Tx ISRs to the IRQs using
the 56803 SDK.

Should I use archInstallISR() right after I call open() ... or right before?

archInstallISR( &(pArchInterrupts->SpiTransmitterEmpty) ,
MySPI_ISR_Function );

I see that the ISR must have the prototype:
unsigned short (*)(unsigned short)

Does anyone have an example of IRQ-based SPI setup?

Thanks in advance.

Rick Corey -----Original Message-----
From: Corey, Rick [mailto:]
Sent: Wednesday, February 26, 2003 9:53 AM
To: 'stefan_schaeufele <>'
Cc: '
Subject: RE: [motoroladsp] SPI Communication between 56807 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 <>
[mailto:]
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/


Wrong! I meant to say:

I see that the ISR must have the prototype:
void(*)()

Duhh.

Rick Corey
-----Original Message-----
From: Corey, Rick
Sent: Wednesday, February 26, 2003 11:13 AM
To: '
Subject: RE: [motoroladsp] SPI Communication between 56807 Hi

Tentatively answering one of my own questions:

I'm trying to learn how to attach my SPI Rx and Tx ISRs to the IRQs using
the 56803 SDK.

Should I use archInstallISR() right after I call open() ... or right before?

archInstallISR( &(pArchInterrupts->SpiTransmitterEmpty) ,
MySPI_ISR_Function );

I see that the ISR must have the prototype:
unsigned short (*)(unsigned short)

Does anyone have an example of IRQ-based SPI setup?

Thanks in advance.

Rick Corey -----Original Message-----
From: Corey, Rick [mailto:]
Sent: Wednesday, February 26, 2003 9:53 AM
To: 'stefan_schaeufele <>'
Cc: '
Subject: RE: [motoroladsp] SPI Communication between 56807 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 <>
[mailto:]
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/


Hi Rick,

Here is how to install the static NORMAL_ISR_XX interrupt vectors in the SDK,
the following examples are for the MSCAN module, but the procedure is the same
for any of the interrupts.

You have to do the following in the file "appconfig.h":

1) add the following function prototypes:
void ISR_CAN_Transmit(void);
void ISR_CAN_Receive(void);

2) add the following defines:
// Definitions for the J1939 (CANbus) interrupts
//
#define GPR_INT_PRIORITY_14 3
#define NORMAL_ISR_14 ISR_CAN_Transmit
#define GPR_INT_PRIORITY_15 3
#define NORMAL_ISR_15 ISR_CAN_Receive

The above is an example of what we do here, you can change the priority
values to be anywhere from 1 to 7 as required by your system.

The reason you must do this is that the interrupt vector file "vector.c" has
only the following includes:
#include "port.h"
#include "arch.h"
#include "config.h"

The file "config.h" includes the file "configdefines.h", which in turn
includes your file "appconfig.h". So, the interrupt vector file "vector.c"
only "knows" about the function prototypes that are explicitly inside your
file "appconfig.h".

This should solve your problem, but if it doesn't please let me know.

Regards,

Art Johnson
Senior Systems Analyst
PMC Prime Mover Controls Inc.
3600 Gilmore Way
Burnaby, B.C., Canada
V5G 4R8
Phone: 604 433-4644
FAX: 604 433-5570
Email:
http://www.pmc-controls.com
-----Original Message-----
From: Corey, Rick [mailto:]
Sent: Wednesday, February 26, 2003 8:18 AM
To: '
Subject: RE: [motoroladsp] SPI Communication between 56807 Wrong! I meant to say:

I see that the ISR must have the prototype:
void(*)()

Duhh.

Rick Corey
-----Original Message-----
From: Corey, Rick
Sent: Wednesday, February 26, 2003 11:13 AM
To: '
Subject: RE: [motoroladsp] SPI Communication between 56807 Hi

Tentatively answering one of my own questions:

I'm trying to learn how to attach my SPI Rx and Tx ISRs to the IRQs using
the 56803 SDK.

Should I use archInstallISR() right after I call open() ... or right before?

archInstallISR( &(pArchInterrupts->SpiTransmitterEmpty) ,
MySPI_ISR_Function );

I see that the ISR must have the prototype:
unsigned short (*)(unsigned short)

Does anyone have an example of IRQ-based SPI setup?

Thanks in advance.

Rick Corey -----Original Message-----
From: Corey, Rick [mailto:]
Sent: Wednesday, February 26, 2003 9:53 AM
To: 'stefan_schaeufele <>'
Cc: '
Subject: RE: [motoroladsp] SPI Communication between 56807 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 <>
[mailto:]
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/ _____________________________________
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/


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/


Hi Stefan

>> Changing of Baudrate and IPBUS_FREQUENCY will not help a lot. If
somebody have experience about that, i will be glad to here about. <<

You're right. Whatever baud rate the Master decides on will control the
Slave's baud rate. It looks like you are dividing your clock by 16 (SCR
bits 7&6 are 10). You can't go very much slower!

I see that you are toggling /SS between words (SPI_SS_DEACTIVATE), but
CPHA==1. I thought that CPHA==1 was used when the /SS line did NOT toggle
between words. You might want to try CPHA==0 and keep toggling /SS.

I could be wrong, or 13.8.2.4 and .5 might have some typos, or Figure 13.4 &
13.5 & 13.6 might contradict the text ... or I might be confused. The
very last line on my page 13-12 is approximately: "/SS can remain low
between transmissions. This may be preferable if you have only one Master
and only one Slave."

If I were you, I would distrust what I read in the docs and try all four
combinations of CPHA =0 or =1, and toggling or not toggling /SS between
words. Good luck getting CPOL right. I haven't gotten that far yet!

Maybe you need to use CPHA=0, toggling the /SS line between words so that Rx
starts with the /SS transition, not the first clock transition. But why?

I don't understand the clock polarity settings, but maybe a problem there
could make you go off-one-bit every so often. I still don't understand why
you would keep slipping.

Thanks for the information. I'm using an 803 eval board now, but will be
working with 807s one of these months.

The way you have avoided the SDK completely inspires me to consider doing
the same. I keep getting a compiler error when I "turn on" the SDK SPI
component. I have no idea what "spidrvIOInterfaceVT " is for or whether
there is any way to do without INCLUDE_IO_SPI. It might be easier to poke
every bit in every control register than to figure out the @#$% SDK
includes.

Error : cannot convert
'unsigned int (*)(int, unsigned short *, unsigned int)' to
'unsigned int (*)(int, const void *, unsigned int)'
const.c line 2335 spiWrite,

/***************************************************************************
**/
#ifdef INCLUDE_SPI

#ifdef INCLUDE_IO_SPI
#include "spi.h"

extern sSpi spidrvDevice;

const io_sInterface spidrvIOInterfaceVT = {
spiClose,
spiRead,
spiWrite, // <------ error was here
NULL
};

const io_sDriver spidrvIODevice = {
(io_sInterface *)&spidrvIOInterfaceVT,
(int)&spidrvDevice};
#endif

#endif
/***************************************************************************
*****/ -----Original Message-----
From: "Schfele, Stefan" [mailto:]
Sent: Thursday, March 06, 2003 10:18 AM
To: Corey, Rick
Cc:
Subject: AW: [motoroladsp] Re: SPI Communication between 56807 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.
____________________________________________________________________



Hi Stefan

Glad I could help! I set up the DDR (direction bit) only because I am
suspicious and paranoid. It might not be needed. The Moto manual says it
is not needed.

you said:
>> 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. <<

I had that problem for weeks. Using these DSPs as SPI slaves seems flaky
sometimes, but maybe I just don't know all the quirks yet.

I had to use the /SS signal (CPHA==0) to avoid having that problem all the
time. Also, since my SPI Master is a ColdFire QSPI, I was able to insert
many long delays, for instance between "assert SS" and "start SCLK". You
might consider trying different CPOL, but probably not. I never really knew
what cured that problem, or if I have fully cured it yet. My theory is that
the DSP SPI peripheral does not work very well as a slave. One request to
Digital DNA yielded a total reply of "check the errata sheet" (which you
absolutely must do).

Good luck!

Rick Corey

-----Original Message-----
From: "Schfele, Stefan" [mailto:]
Sent: Thursday, March 06, 2003 10:18 AM
To: Corey, Rick
Cc:
Subject: AW: [motoroladsp] Re: SPI Communication between 56807 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.
____________________________________________________________________


Hi Stefan

All I can suggest is trying different Modes - I wound up using the one where
/SS toggles up and down for each word sent.

Someone suggested that SPI is very sensitive to any tiny glitches in the
SCLK - make sure that wire is short and well shielded.

I finally got mine working OK with long intercharacter gaps (the speed of
the ISR is critical, naturally). Beware thinking everything is fine because
the Overrun flag doesn't get set - try again with more delays between
characters. The sender also has to reload the register early enough, or you
get an "under-run" where the same word is sent twice because it was not
reloaded in plenty of time.

It took me so long that the project was given to a consultant and I was put
on Termination Warning.

Good luck!

Rick Corey -----Original Message-----
From: "Schfele, Stefan" [mailto:]
Sent: Thursday, March 06, 2003 10:18 AM
To: Corey, Rick
Cc:
Subject: AW: [motoroladsp] Re: SPI Communication between 56807 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.
____________________________________________________________________