Hello
I am working with the nRF24L01 and my goal is to send out 10 packets, with unique addresses, as quickly as possible.
The nRF24L01 is connected to a PIC (clocked at 32MHz) via hardware SPI (clocked at DIV4 (8MHz)).
ACK is disabled.
The following transmit sequence takes about 3ms.
void Transmit_Data() {
for (0, forvar = 1; forvar < 11; forvar++) {
CSN = 0;
Spi_Write(0x30); //Command : 'W_Register' : Write to register 0x0A (RX_ADDR_P0)
Spi_Write(0xCC); //set address E7E7E7E7xx
Spi_Write(0xBB);
Spi_Write(0xEE);
Spi_Write(0xDD);
Spi_Write(forvar);
CSN = 1;
CSN = 0;
Spi_Write(0x27); //Command : 'W_Register' : Write to register 0x07 (STATUS)
Spi_Write(0b01110000); //Clear previous interrupts
CSN = 1;
CSN = 0;
Spi_Write(0b10100000); //Command : 'W_TX_PAYLOAD' : Write TX Payload
for (0, forvar2 = 1; forvar2 < 11; forvar2++) { //Clock out data to TX Payload
for (0, forvar3 = 1; forvar3 < 4; forvar3++) {
Spi_Write(RGB_Values[forvar3][forvar2][forvar]); //[0,R,G,B][Channel 1-10][Solar System 1-10]
}
}
CSN = 1;
CE = 1; //Start transmission
while (IRQ == 1) {} //Hold until packet is sent / TX_DS interrupt is set
}
CE = 0;
} //end Transmit_Data()
Is there a way the packets can be transmitted quicker than 3ms?
Thanks.
BTW: Here is the config routine…
void Configure_Transmitter() {
CE = 0; //When in TX mode : sets "No ongoing packet transmission"
CSN = 0;
Spi_Write(0x20); //Command : 'W_Register' : Write to register 0x00 (CONFIG)
Spi_Write(0b01011010); //PTX, CRC enabled, mask a couple of ints (TX_DS and MAX_RT)
CSN = 1;
CSN = 0;
Spi_Write(0x21); //Command : 'W_Register' : Write to register 0x01 (EN_AA)
Spi_Write(0x00); //disable auto-ack
CSN = 1;
CSN = 0;
Spi_Write(0x23); //Command : 'W_Register' : Write to register 0x03 (SETUP_AW)
Spi_Write(0x03); //Address width = 5
CSN = 1;
CSN = 0;
Spi_Write(0x24); //Command : 'W_Register' : Write to register 0x04 (SETUP_RETR)
Spi_Write(0x00); //Auto retransmit off
CSN = 1;
CSN = 0;
Spi_Write(0x25); //Command : 'W_Register' : Write to register 0x05 (RF_CH)
Spi_Write(0x02); //Set Channel to '2'
CSN = 1;
CSN = 0;
Spi_Write(0x26); //Command : 'W_Register' : Write to register 0x06 (RF_SETUP)
Spi_Write(0x07); //Data rate = 1Mbps , RF output = 0dBm
CSN = 1;
CSN = 0;
Spi_Write(0x2A); //Command : 'W_Register' : Write to register 0x0A (RX_ADDR_P0)
Spi_Write(0xE7); //Set address to E7E7E7E7E7
Spi_Write(0xE7);
Spi_Write(0xE7);
Spi_Write(0xE7);
Spi_Write(0xE7);
CSN = 1;
CSN = 0;
Spi_Write(0x30); //Command : 'W_Register' : Write to register 0x10 (TX_ADDR)
Spi_Write(0xE7); //set address E7E7E7E7E7
Spi_Write(0xE7);
Spi_Write(0xE7);
Spi_Write(0xE7);
Spi_Write(0xE7);
CSN = 1;
//dont raise CE... CE = 1 = ongoing packet transmission
} //end Configure_Transmitter()