This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AFE4960: Problem with MCU reading data from FIFO of AFE4960

Part Number: AFE4960

Hi there,

I have some questions for you.

In the dual-chip serial mode, after receiving the FIFO_RDY interrupt signal sent by the AFE4960, the MCU begins to read samples from the FIFO of the AFE4960 through SPI communication.
The specific process is:
①Read bits 0-7 of the 6D address register to obtain the number of samples in the FIFO.
②According to the number of samples, read the samples individually by writing FFh through the while loop.
As a result, the FIFO overflows.

void capture(void)
{
//				Flag=0x01;
	      volatile uint16_t numWordsToRead[2]={0,0};
				txBuffPointer = 0;
        TX_BUFF[txBuffPointer++]=0;
        TX_BUFF[txBuffPointer++]=0;
        TX_BUFF[txBuffPointer++]=0;
        TX_BUFF[txBuffPointer++]=2;//心电数据

        /*Read pointer difference from AFE1*/
        SPI_READ_MODE=READ_AFE1;
        readSPI(0x6D,(uint8_t *)&afeRegData);//写入和读取指针之间的指针差异 AFE4960 6D
        copyRegDataInTxBuf1(3);
        numWordsToRead[0]=(afeRegData+1)&0xFF;

//        /*Read pointer difference from AFE2*/
        SPI_READ_MODE=READ_AFE2;
        readSPI(0x6D,(uint8_t *)&afeRegData);
        copyRegDataInTxBuf1(4);
        numWordsToRead[1]=(afeRegData+1)&0xFF;//循环队列


        SPI_READ_MODE=READ_AFE1;
        while(numWordsToRead[0]!=0)
        {
            readSPI(0xFF,(uint8_t *)&afeRegData);//从fifo中读取数据
            copyRegDataInTxBuf1(5);
            numWordsToRead[0]--;
        }

        SPI_READ_MODE=READ_AFE2;
        while(numWordsToRead[1]!=0)
        {
            readSPI(0xFF,(uint8_t *)&afeRegData);
            copyRegDataInTxBuf1(6);
            numWordsToRead[1]--;
        }
				captureStatus=0x01;

        
    
}

How should we get samples from FIFO?