Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

SPI slave Interrupt 97J60 C18

Status
Not open for further replies.

eng.hasan.power

Member level 1
Joined
Mar 30, 2006
Messages
39
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,597
hi everyone,
im facing a problem, im tryin to connect DSP with the 97j60, ethernet, by SPI,

the controller is slave, in Interrupt mode, im using the functions of C18 compiler

OpenSPI1(SLV_SSOFF, MODE_00, SMPEND);

the problem is,,,,,,the DSP sending the data, i check it by signal analyzer,
but the j60 dont receive it correctly,,,,,and even dont go for the interrupt routine in the first place,,,,,

the j60 sees the signal at the Clk pin,,,,but it doesnt go to the interrupt routine,

here is the configuration, its the standard from C18 compiler, but i added some lines,

OpenSPI1(SLV_SSOFF, MODE_00, SMPEND); //hasan

void OpenSPI1( unsigned char sync_mode, unsigned char bus_mode, unsigned char smp_phase)
{
SSP1STAT &= 0x3F; // power on state
SSP1CON1 = 0x00; // power on state
SSP1CON1 |= sync_mode; // select serial mode
SSP1STAT |= smp_phase; // select data input sample phase

switch( bus_mode )
{
case 0: // SPI1 bus mode 0,0
SSP1STATbits.CKE = 1; // data transmitted on rising edge
break;
case 2: // SPI1 bus mode 1,0
SSP1STATbits.CKE = 1; // data transmitted on falling edge
SSP1CON1bits.CKP = 1; // clock idle state high
break;
case 3: // SPI1 bus mode 1,1
SSP1CON1bits.CKP = 1; // clock idle state high
break;
default: // default SPI1 bus mode 0,1
break;
}
switch( sync_mode )
{
case 4: // slave mode w /SS enable
// #if defined SPI_IO_V1
// TRISCbits.TRISC3 = 1; // define clock pin as input
// TRISAbits.TRISA5 = 1; // define /SS1 pin as input
// #elif defined SPI_IO_V2
TRISFbits.TRISF7 = 0; // define /SS1 pin as Output //hasan 97j60
PORTFbits.SS1 = 1;
TRISCbits.TRISC3 = 1; // define clock pin as input
// #endif
break;

case 5: // slave mode w/o /SS enable
TRISCbits.TRISC3 = 1; // define clock pin as input
break;

default: // master mode, define clock pin as output
TRISCbits.TRISC3 = 0; // define clock pin as input
break;
}
TRISCbits.TRISC4 = 1; // define SDI pin as input
TRISCbits.TRISC5 = 0; // define SDO pin as output

SSP1CON1 |= SSPENB; // enable synchronous serial port


INTCONbits.GIE = 0 ;
INTCONbits.GIE = 1 ;
RCONbits.IPEN = 1; // Enable Interrupts
INTCONbits.GIEH = 1;
INTCONbits.GIEL = 1;
PIE1bits.SSP1IE = 0 ;
PIE1bits.SSP1IE = 1 ; //Hasan

}
#endif

#################################
the Hardware connection is directly,,,, I/p SDI<->O/p SDO,,,, ,,, Clk<->Clk,,,,

thank you in advance,,,,,,
 

comin guys, its simple,

anyone used SPI slave before,,,,, what is the normal setting, while im not expert in SPI.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top