cancel
Showing results for 
Search instead for 
Did you mean: 

SPI and Interrups

soundso
Associate II
Posted on November 29, 2007 at 05:47

SPI and Interrups

2 REPLIES 2
soundso
Associate II
Posted on May 17, 2011 at 09:48

Solved! Just a question of the spi-protocol. Its master-controlled and bidirectional. Of course i read something if i write data, with every clock, a bit is written on mosi and a bit read from miso. Deductive the interrupt is occured.

[ This message was edited by: soundso on 29-11-2007 10:18 ]

soundso
Associate II
Posted on May 17, 2011 at 09:48

Help! I trying to use the spi with interrupts but it doesn't work in the right way. First i had the problem that the interrupt handler was continuous called and after some tests it seems like that it happen because the RxBuffer is never empty (RxFifoNotEmpty-Flag is always set). In the following code, the inside of the while is always executed and return a 0xFF in normal mode and the sended value in loopback-mode. Anybody knows the problem and how to fix? What is wrong?

My main loop after initialisation:

while(1){

SSP_SendData(SSP0, 0xAA);

while(SSP_GetFlagStatus(SSP0, SSP_FLAG_RxFifoNotEmpty)==SET){

// Always executed!

data = SSP_ReceiveData(SSP0);

SSP_ClearFlag(SSP0, SSP_FLAG_RxFifoNotEmpty); //Necessary???

};

};

I use a str9-dongle with str912fa and the related software lib.

[ This message was edited by: soundso on 28-11-2007 17:49 ]