Hi
I'm using nrf24l01 with ATmega8. i can't set the registers of module... here is my code...I want to set RF_CH register to 0x06(default value is 0x02) and when i read the register it DIDN'T CHANGE! out put of this code is like: 11 22 0E 02
0E is for status and 02 is RF_CH... please help me here :~
PORTB.0=1;//used for CE
PORTB.1=1;//used for CSN
putchar(0x11);
delay_ms(1000);
PORTB.1=0;
delay_ms(10);
spi(0x25);// write channel register
delay_ms(10);
spi(0x06);
delay_ms(10);
putchar(0x22);
PORTB.1=1;
delay_ms(10);
PORTB.1=0;
p=spi(0x05);
delay_ms(10);
putchar(p);
p=spi(0xFF);
delay_ms(10);
putchar(p);
PORTB.1=1;
ok... i found the problem apparently it was the crystal... i changed it and it got worked....
i then used MIRF library with a bit of change...
now problem is that when calling mirf_send() no interrupt is coming when it finishs. i set INT0 to falling edge. so what might be the problem??
my code (for ATmega16) is like:
unsigned char p;
unsigned char m[4]={0x01,0x02,0x03,0x04};
// Global enable interrupts
#asm("sei")
mirf_init();
mirf_set_RADDR((unsigned char *)"clie1");
mirf_config();
PORTC.1=0;
spi(0x05);
p=spi(0xFF);
PORTC.1=1;
putchar(p);// which it prints the true value of RF_CH i set
mirf_set_TADDR((unsigned char *)"serv1");
while (1)
{
delay_ms(1000);
mirf_send(m,4);
}
I've read that you shouldn't use the delay function with the RF24L01 radio, not sure why, I just remember reading that on Maniacbug's blog about these radios. It could just pertain to his library as well.