This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

about SPI data transfer function : nrf_drv_spi_transfer

Hi

  My English is not very good, but I encountered a problem that could not be solved. Please forgive me if there is any improper expression in grammar.

  am use SPIM . I want to read N bytes of data, but the actual signal has N+1 data. Why is there an extra byte.  

  SDK_16.0.0.

void spi_nor_read_exec(uint8 *data,uint32 len)
{
	uint32 readLen=0;
	uint8* readData=NULL;
	readData=data;
	nor_tx_buf[0]=0;
	memset(nor_tx_buf,0,len);
	do{
		 if(len>255)
		{
		readLen=255;
		}
    else
		{
		readLen=len;
		 len=0;	
		}	
    while (spi_xfer_done==false)
    {
        ;
    }
			 spi_xfer_done=false;
		//(void)sd_clock_hfclk_request();
		 nrf_drv_spi_transfer(&spi_522, NULL, 0, readData,readLen);
		    while (spi_xfer_done==false)
    {
        ;
    }
		if(len>255)
		{
		len-=255;
		readData+=255;	
		}
		
	}while(len>0);

}

 when the len=1  

Related