This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem with the SSP1 - LPC1768

Please allow me to ask the simple questions.
I want to implement SPI communications between LPC1768 and M25PE16 (Serial Paged Flash Memory).

When I send 0x9F (ask for chip ID) to the M25PE16, I get only one time interrupt. I expected 8 bytes response.
When I send 0x9F again I receive next byte response. Could you please take a look at my code and give me a clue what I may miss?
Sorry for my English.

Best Regards.

void spi_init (void) {

   /* Initialize and enable the SSP Interface module. */

  LPC_SC->PCONP        |= (1 << 10);              /* Enable power to SSPI1 block  */

  LPC_SC->PCLKSEL0 &= ~(3<<20);
  LPC_SC->PCLKSEL0 |=  (1<<20);

  LPC_SSP1->CPSR = 4;

  LPC_SSP1->IMSC = 0x0006;

  LPC_SSP1->CR0  = 0x0007;                        /* 8Bit, CPOL=0, CPHA=0         */
  LPC_SSP1->CR1  = 0x0002;                        /* SSP0 enable, master          */

  NVIC_EnableIRQ(SSP1_IRQn);

}

void SSP1_IRQHandler (void)      //odbior danych z pamieci
{
        wskSSP1RIS = LPC_SSP1->RIS;


if((wskSSP1RIS==0x02)||(wskSSP1RIS==0x08)||(wskSSP1RIS==0x0A)) //rcv znak { while(LPC_SSP1->SR & 0x04) memData[countMem++] = LPC_SSP1->DR; } if(countMem == 8) { countMem = 0; spi_ss(1); //cs high } LPC_SSP1->ICR = 3; }