2007-12-20 05:09 AM
2011-05-17 02:32 AM
Hi Everybody,
I am quite new to STR912 and please allow me to ask the simple questions. I am using MTBSTR9 eval board and Keil MDK to implement SPI communications. SSP0 sends data out as the master device and SSP1 receives data as the slave. Enable SSP1_IT_RxFifo interrupt in order to receive data from SSP0. The issue is that I get only one time SSP1_IT_RxFifo interrupt and then cannot get in the interrupt any more. Could you please take a look at my code and give me a clue what I may miss? Many many thanks. The following is my code for SSP0 and SSP1 configuration. /* SCU configuration */ SCU_Configuration(); /* GPIO pins configuration */ GPIO_Configuration(); SSP_DeInit(SSP0); SSP_InitStructure.SSP_FrameFormat = SSP_FrameFormat_Motorola; SSP_InitStructure.SSP_Mode = SSP_Mode_Master; SSP_InitStructure.SSP_CPOL = SSP_CPOL_High; SSP_InitStructure.SSP_CPHA = SSP_CPHA_2Edge; SSP_InitStructure.SSP_DataSize = SSP_DataSize_8b; SSP_InitStructure.SSP_ClockRate = 5; SSP_InitStructure.SSP_ClockPrescaler = 2; SSP_Init(SSP0, &SSP_InitStructure); /* SSP1 configuration */ SSP_DeInit(SSP1); SSP_InitStructure.SSP_Mode = SSP_Mode_Slave; SSP_InitStructure.SSP_SlaveOutput = SSP_SlaveOutput_Enable; SSP_Init(SSP1, &SSP_InitStructure); /* Enable SSP1 receive interrupt */ SSP_ITConfig(SSP1, SSP_IT_RxFifo|SSP_IT_RxTimeOut, ENABLE); // SSP1 interrupt configuration // VIC0 configuration VIC_DeInit(); VIC_Config(SSP1_ITLine, VIC_IRQ, 1); VIC_ITCmd(SSP1_ITLine, ENABLE); /* SSP0 enable */ SSP_Cmd(SSP0, ENABLE); /* SSP1 enable */ SSP_Cmd(SSP1, ENABLE); while(Tx_Idx { SSP_SendData(SSP0, SSP0_Buffer_Tx[Tx_Idx++]); } ******************* SSP1 receive inerrupt route: void SSP1_IRQHandler(void) { while(SSP_GetFlagStatus(SSP1, SSP_FLAG_RxFifoNotEmpty)==SET) { SSP1_Buffer_Rx[Rx_Idx++] = SSP_ReceiveData(SSP1); } SSP_ClearFlag(SSP1, SSP_FLAG_RxFifoNotEmpty); VIC0 ->VAR = 0; VIC1 ->VAR = 0; }