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;
}