AnsweredAssumed Answered

spi interrupt problem for lsm330dl

Question asked by sophia.ge on Jul 9, 2012
Latest reply on Jul 16, 2012 by fm
i try to use the spi interrupt , but the whole program just hanged at case 101 which is in the void GYRO_Task(void),  it shows me "+++". anything wrong?

here is some part of my code.

 #ifdef GYRO_SPI_USE_INTERRUPT
    NVIC_InitStructure.NVIC_IRQChannel = SPI2_IRQn;
    NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
    NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
    NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
    NVIC_Init(&NVIC_InitStructure);
 #endif 





void GYRO_Trigger_Read(uint16_t HalfWord, unsigned char *rxdataptr)
{
 HalfWord = HalfWord << 8;
 HalfWord |= 0x8000;

 GYRO_TxData = HalfWord;
 GYRO_RxDataPtr = rxdataptr; 

#ifdef GYRO_SPI_USE_INTERRUPT
 SPI_I2S_ITConfig(GYRO_SPI, SPI_I2S_IT_TXE, ENABLE);
 SPI_I2S_ITConfig(GYRO_SPI, SPI_I2S_IT_RXNE, ENABLE);
#endif

 GYRO_CS_LOW();   
}

void GYRO_Interrupt_SetRxData(unsigned char tempchar)
{
 *GYRO_RxDataPtr = tempchar;
 GYRO_Operation_State = 0;
}

char GYRO_Interrupt_GetTxData(void)
{
 return GYRO_TxData;
}

Attachments

Outcomes