I have C8051F340 with the nrf24L01.
Now the transmitter can give the TX_DS interrupt but the reciever can’t gets the RX_DR interrupt and can’t get any data in the RX FIFO. After trans TX FIFO is also empty.So i think the trans is working well.
I am able to communicate through SPI to the nrf24L01.I read Internal regs that i used and they are set right but the reciever wont recieve any bytes.
These are part of code.
trans:
void main(void)
{
......
while(1)
{
// sta=SPI_Read(READ_REG+STATUS);
if(en_send)
{
en_send=0;
TX_Mode();
}
if(IRQ==0)
{
sta=SPI_RW_Reg(WRITE_REG+STATUS,0x70); /
SPI_Read(READ_REG+FIFO_STATUS);
if(RX_DR)
{
CE=0;
SPI_Read_Buf(RD_RX_PLOAD,rx_buf,TX_PLOAD_WIDTH);
flag=1;
}
// sta=SPI_Read(READ_REG+STATUS);
}
}
}
receive:
void main(void)
{
......
RX_Mode();
while(1)
{
// sta=SPI_Read(READ_REG+STATUS);
if(en_send)
{
en_send=0;
TX_Mode();
}
if(IRQ==0)
{
sta=SPI_RW_Reg(WRITE_REG+STATUS,0x70); /
SPI_Read(READ_REG+FIFO_STATUS);
if(RX_DR)
{
CE=0;
SPI_Read_Buf(RD_RX_PLOAD,rx_buf,TX_PLOAD_WIDTH);
flag=1;
}
// sta=SPI_Read(READ_REG+STATUS);
}
}
}
initialize:
void RX_Mode(void)
{
CE=0;
SPI_RW_Reg(WRITE_REG + SETUP_AW, 0x03);
SPI_Write_Buf(WRITE_REG + RX_ADDR_P0, TX_ADDRESS, TX_ADR_WIDTH);
SPI_RW_Reg(WRITE_REG + EN_AA, 0x00);
SPI_RW_Reg(WRITE_REG + EN_RXADDR, 0x01);
SPI_RW_Reg(WRITE_REG + RF_CH, 92);
SPI_RW_Reg(WRITE_REG + RX_PW_P0, TX_PLOAD_WIDTH);
SPI_RW_Reg(WRITE_REG + RF_SETUP, 0x07);
SPI_RW_Reg(WRITE_REG + CONFIG, 0x0f);
CE = 1;
}
void TX_Mode(void)
{
CE=0;
SPI_RW_Reg(WRITE_REG + SETUP_AW, 0x03);
SPI_Write_Buf(WRITE_REG + TX_ADDR, TX_ADDRESS, TX_ADR_WIDTH);
// SPI_Write_Buf(WRITE_REG + RX_ADDR_P0, TX_ADDRESS, TX_ADR_WIDTH);
SPI_Write_Buf(WR_TX_PLOAD, tx_buf, TX_PLOAD_WIDTH);
SPI_Read(READ_REG+FIFO_STATUS);
SPI_RW_Reg(WRITE_REG + EN_AA, 0x00);
SPI_RW_Reg(WRITE_REG + EN_RXADDR, 0x01);
SPI_RW_Reg(WRITE_REG + SETUP_RETR, 0x00);
SPI_RW_Reg(WRITE_REG + RF_CH, 92);
SPI_RW_Reg(WRITE_REG + RF_SETUP, 0x07);
SPI_RW_Reg(WRITE_REG + CONFIG, 0x0e);
CE=1;
delay(9600);
CE=0;
}