SSP0 set interrupt

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SSP0 set interrupt

1,091 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by aamir ali on Thu Nov 08 01:14:33 MST 2012
1. Can I change SSP)-> IMSC register while SPI controller is on like , if

LPC_SSP0->CR1 = 0x02;                  //SPI controller enabled

Or it should be changed only when SPI if off i.e CR1 = 0;

Edit: Have to make SD card interface interrupt based. Any example code to make it interrupt based.

2. What is loopback mode in SPI
0 Kudos
Reply
5 Replies

1,070 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by researchinnovation on Sun Dec 02 21:56:58 MST 2012

Quote: Aamir Ali
HI,

I have used loopback mode as I don't need what's coming on MISO line.
& set like, & code stuck at line I mentioed. I have left MISO line float. What is the error

LPC_IOCON->PIO1_15 = 0x00000083;                 /* ssp0 clk config */                                     \
LPC_IOCON->PIO0_21 = 0x00000082;               /* ssp0 miso config */                \
          LPC_IOCON->PIO1_21 = 0x00000082;    

LPC_SSP1->CR1 = 0x01;                  //diabled SPI controller, master mode,
 LPC_SSP1->CPSR = 0x02;     /* decimal 2 */   // freq divide by 2 , now frq is 72/2=36Mhz
        
        LPC_SSP0->IMSC = 0x00;     /* binary: 00000000 */
 LPC_SSP1->CR0 = 0x0207; 
        LPC_SSP0->CR1 = 0x02 | 0x01;   /* Enable SSP */                 //SPI controller enabled
        

.......some code

    while( (LPC_SSP1->SR & 0x01) !=0x01 );
    while( (LPC_SSP1->SR & 0x10) !=0 ); 
    LPC_SSP1->DR = ThisByte; 
    
        // [COLOR=Red]code stucks here at busy line[/COLOR]
    while( (LPC_SSP1->SR & 0x10) !=0 ); 
    return( LPC_SSP1->DR ); 



Are you trying to see the output on OSCILLOSCOPE  in LoopBack Mode?
Check the content of send and receive buffers in add watch or expressions.
By the way which board are you using?
What do you want to do with SPI ?
And what are you trying to do with following codes:
LPC_IOCON->PIO1_15 = 0x00000083;                 /* ssp0 clk config */                                     \
LPC_IOCON->PIO0_21 = 0x00000082;               /* ssp0 miso config */                \
          LPC_IOCON->PIO1_21 = 0x00000082;    

LPC_SSP1->CR1 = 0x01;                  //diabled SPI controller, master mode,
 LPC_SSP1->CPSR = 0x02;     /* decimal 2 */   // freq divide by 2 , now frq is 72/2=36Mhz
        
        LPC_SSP0->IMSC = 0x00;     /* binary: 00000000 */
 LPC_SSP1->CR0 = 0x0207; 
        LPC_SSP0->CR1 = 0x02 | 0x01;   /* Enable SSP */                 //SPI controller enabled
        

.......some code

    while( (LPC_SSP1->SR & 0x01) !=0x01 );
    while( (LPC_SSP1->SR & 0x10) !=0 ); 
    LPC_SSP1->DR = ThisByte; 
    
        // [COLOR=Red]code stucks here at busy line[/COLOR]
    while( (LPC_SSP1->SR & 0x10) !=0 ); 
    return( LPC_SSP1->DR ); 
0 Kudos
Reply

1,070 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Sat Dec 01 05:21:43 MST 2012

Quote: Aamir Ali
any help.......



:confused:

To get help it could be useful to:

#1 Describe which MCU we are talking about :)

#2 Describe what you are trying to do :confused:

#3 Post your complete project ;)

#4 Describe why you don't start with a standard LPCXpresso sample.
0 Kudos
Reply

1,070 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by aamir ali on Sat Dec 01 03:43:31 MST 2012
any help.......
0 Kudos
Reply

1,070 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by aamir ali on Fri Nov 30 05:27:03 MST 2012
HI,

I have used loopback mode as I don't need what's coming on MISO line.
& set like, & code stuck at line I mentioed. I have left MISO line float. What is the error

LPC_IOCON->PIO1_15 = 0x00000083;                 /* ssp0 clk config */                                     \
LPC_IOCON->PIO0_21 = 0x00000082;               /* ssp0 miso config */                \
          LPC_IOCON->PIO1_21 = 0x00000082;    

LPC_SSP1->CR1 = 0x01;                  //diabled SPI controller, master mode,
 LPC_SSP1->CPSR = 0x02;     /* decimal 2 */   // freq divide by 2 , now frq is 72/2=36Mhz
        
        LPC_SSP0->IMSC = 0x00;     /* binary: 00000000 */
 LPC_SSP1->CR0 = 0x0207; 
LPC_SSP0->CR1 = 0x02 | 0x01;   /* Enable SSP */                 //SPI controller enabled


.......some code

while( (LPC_SSP1->SR & 0x01) !=0x01 );
while( (LPC_SSP1->SR & 0x10) !=0 ); 
LPC_SSP1->DR = ThisByte; 
    
        // [COLOR=Red]code stucks here at busy line[/COLOR]
    while( (LPC_SSP1->SR & 0x10) !=0 ); 
return( LPC_SSP1->DR ); 
0 Kudos
Reply

1,070 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by daniel.widyanto on Tue Nov 13 22:08:53 MST 2012
Can I change SSP->IMSC register while SPI controller is on ?

Yes you can


Quote:
What is loopback mode in SPI ?


Serial input is taken from the serial output. The MISO is connected to MOSI pin internally
0 Kudos
Reply