i m trying to do a tree topology using this module. please help me find the unique i.d of the device.
Hi NISHIL
The nRF24L01 devices do not have a unique id, I am currently working in a similar project. You will have to come up with another scheme to uniquely identify a node/device using an nrf24l01 module.
A few options:
I use the generation mechanism, basically I sample the ADC as the source of the seed values.
uint16_t rng16(uint16_t seed)
{
// Call four times with non-zero args to seed.
// Period is greater than one quintillion.
static uint32_t k=1148543851;
static uint32_t i=1234567891;
if(seed)
{
i=(i<<16)+((k<<16)>>16);
k=(k<<16)+seed;
return(0);
}
k=30903*(k&65535)+(k>>16);
i=31083*(i&65535)+(i>>16);
return(k+i);
}
uint16_t system_generate_id()
{
uint16_t voltage = 0;
for (uint8_t i = 0; i < 4; i++)
{
system_read_battery_voltage(&voltage);
rng16(voltage);
}
return rng16(0);
}
The above rng16 function is based on work by George Marsaglia. The method of seeding would not be useful for cryptographic uses but it was random enough for what I needed, which was a unique device ID.
Hi NISHIL
The nRF24L01 devices do not have a unique id, I am currently working in a similar project. You will have to come up with another scheme to uniquely identify a node/device using an nrf24l01 module.
A few options:
I use the generation mechanism, basically I sample the ADC as the source of the seed values.
uint16_t rng16(uint16_t seed)
{
// Call four times with non-zero args to seed.
// Period is greater than one quintillion.
static uint32_t k=1148543851;
static uint32_t i=1234567891;
if(seed)
{
i=(i<<16)+((k<<16)>>16);
k=(k<<16)+seed;
return(0);
}
k=30903*(k&65535)+(k>>16);
i=31083*(i&65535)+(i>>16);
return(k+i);
}
uint16_t system_generate_id()
{
uint16_t voltage = 0;
for (uint8_t i = 0; i < 4; i++)
{
system_read_battery_voltage(&voltage);
rng16(voltage);
}
return rng16(0);
}
The above rng16 function is based on work by George Marsaglia. The method of seeding would not be useful for cryptographic uses but it was random enough for what I needed, which was a unique device ID.