nrf24l01 only returns status-register

Hi @all,

I´ve got a problem with my nrf-module.

When I try to read out a register I only get back the status register and then nothing.

I´ve not init the nrf module jet cause I first wanna test the communication via SPI. So I try to write to one register and after that i try to read it out but I only get back the status register in the first Byte and then nothing:

// write(0x01,0x3F) to read out the EN_AA

write(nrf24l01_R_REGISTER|nrf24l01_EN_AA,nrf24l01_EN_AA_DEFAULT_VAL,2);

Read-Operation:

CSN: ----_____________________________________________-------

Clk:–_____––_____________

MOSI:------_______________----------------------------------------

MISO:------------______________________

The polarity and the phase should be ok and my SPI runs with 1MHz.

Controller:AT91SAM7S64

Did anyone have an idea to solve the probleme?

Thanks

void write(u_int8 addr, u_int8 dat, u_int8 anz)
{
	u_int8 i=0;
	i=(anz);
	unsigned char x[i];
	x[0]=addr;
	x[1]=dat;
	SPI_send(x,i);
}

void SPI_send(u_int8 *daten, u_int8 anz)	// Send data (DMA)
{

 	while(!(pSPI->SPI_SR&0x00000020));				
	while(!(pSPI->SPI_SR&0x00000002));				Empty
	u_int8 x[65],i;
	while(!(pSPI->SPI_SR&0x00000200));		//SPIENS - SPI 
	for(i=0;i<anz;i++)
	{
		x[i]=daten[i];
	}
	pSPI->SPI_TPR=(u_int16)x;
	pSPI->SPI_TCR=anz;
	pSPI->SPI_TNCR=0;
	pSPI->SPI_PTCR=0x0100;
}

I’m not familiar with the ARM processors, but the declaration of x in write() is wrong. The compiler doesn’t know what i is at compile time (or at best uses the initialized value of 0). Either declare x as a fixed-size buffer - in this case unsigned char x[2] would work - or allocate space for it on the fly with malloc.

Thanks for this hint… now i make a global array.:idea:

But i still have the same problem :cry:

I found the problem.

After a few tests i found out, that i have to configure my spi with falling edges. I don´t know why cause in Brennen´s tut he writes that the SCK should normally aktive by rising edges.

It’s interesting that you found that out. In the nRF24L01 datasheet, you can see that SPI should be set up for mode 0,0, which is clock normally low and data is clocked in on rising edges. But if it works, it works.

SCK going low to high works for me, as well.

Leon