Help with advice on selecting RF transceiver.

Thread Starter

hexluthor

Joined Feb 25, 2019
27
This is the code that is being uploaded to my ATmega328p later today. This is being setup as a transmitter. I can post a schematic of the circuit that the microcontroller and the NRF24L01 are getting set in. I am writing code that is using the microcontrollers master spi mode (SPI USART hybrid) to configure and control the NRF24L01.

here is the code
 

Attachments

Thread Starter

hexluthor

Joined Feb 25, 2019
27
If I am handling the process of accessing the registers correctly and it is just a matter of having the RX and the TX devices set on the same data pipe then I think I should be in good shape. some tweaking of the code for timing or efficiency maybe in order.

Thanks
 

pmd34

Joined Feb 22, 2014
527
Hi hex, Im afraid I only get as far as cli() sei() sbi() and cbi() when it comes to assembly language!

It sounds ok though.. you also have to make sure the CE line is 0 when you start writing to the RF chip

Not sure why you need the: call Tx_Read_Poll after the sts UDR0, r16 ;
in C at least all I have to do is write the data to the SPI buffer, and wait until the "end of transmission flag" on the Atmega is set. Then I can just load the next byte of data.

The RF chip will send out all its data after you set the CE pin high (i just do this momentarily for 20us).

The initialization as you say are the same, and does not need changing once done, however the "RX_ADDR_P0" and "TX_ADDR" are different / swapped over for the 2 units.

The data pipe stuff is rather confusing and not easy to follow. I think the idea is that one receiving unit can have several addresses rather than all received data being put into the same data buffer.
 

Thread Starter

hexluthor

Joined Feb 25, 2019
27
I don't know why but I couldn't load it up as a .inc file. I needed to save it as a txt file first. so you may need to set it back to .inc in order to use it.
 

Attachments

Thread Starter

hexluthor

Joined Feb 25, 2019
27
hi hex,
Assembles with only one error.
If I REM it out it assembles OK.
E
yeah, I can deal with that. I know the syntax outside of that 1 instruction is okay. What I am not sure of is if this the correct way of interacting with the NRf24 hardware specifically. I will have a pcb to stick the chip onto later today provided DHL delivers on time and then I can start testing it out and tinkering around with it to really find out if I have any issues. My biggest concern was that when I go to load data into the NRFs TX_Payload am I supposed to pass an address to it first or just the instruction. I was and still am slightly confused by the term "Pipe" that the NRF uses. I need to reread the data sheet and just play around with it I think. I get that the NRF24 chips can communicate with different chips at the same time and I am assuming that is what the Pipes are being used for like what PMD34 was trying to explain to me. It seems like up to 5 different devices could communicate and 1 device could read those 5 different data streams but keep them sorta via a unique "pipe". I will know what I don't know that I don't know in a few hours hopefully. Thanks for all the help though.
 
Top