Using NRF24L01+ with pure assembler programing

Dear people

I have connected NRF24!01+ with PIC16F1826 for use as PRX and have also another similar for PRX

For an initial test I tryed to trasmit a closed / open switch state to a LED and as ussually hapens it does not work

Also I have a Tx packets each 200ms with one Data byte incremented in each Tx
I get SPI write an read ok but at PRX have not getting any received packet

There is the same program for PTX an PRX with  #define    PRX  o rnot at compiling so most of defined values are the same

What I get reading with SPI : in PRX , Reg 0x17 FIFO_STATUS  bit4 TX_EMPTY:
 is 1 before loading data
0 after loading payload   (4 bytes)
1 after CE goes H

At PRX side  not IRQ arises , not changes in Reg 07 bit RX_DR

I only use assembler programming and I didn´t found in the web any complete and working assembler example.

--> I am asking please the simplest example with a detailed list of commands to send for configuring and useing TPX
and PRX, similar at Appendix B, pag 77 in NRF24L01+ data sheet.

*** But please include the waiting delays and other instructions that may be  needed ***

For some address, default values may be used in a first test ? ( only 1 Pipe )

Is it posible not  using CRC ?

I need to have something working before going to a complete use of full NRF24L01+ capabilities

Finally I will insert well tested software in bigger assembler programs

I like to  replace a RS485 conexion with this RF link

I will1452.Control_NRF.rar send the assembler that I am testing if somebody like to see it, but RF part is not working

Waiting some help, Best Regards, Osvaldo Hojvat

Parents
  • Hi Osvaldo

    Approximately how often do you expect an order to come in from each PTX? 

    I think the best approach is the one you detail in 1). Send a small ping packet from the PTX first, so that the PRX can prepare the ACK payload. Then you send a second packet from the PTX some milliseconds later to pick up the ACK payload.  

    Like you say it is much easier to achieve low average current on the PTX side, since each transmit only takes some hundreds of microseconds. 
    In order to also achieve low average current on the PRX side you need to keep the PTX's and PRX closely synchronized in time, so that the PRX knows when the PTX's will transmit and can enable the receiver just before the PTX starts the transmission. 

    o.hojvat said:
    Please answer if there are posible interference for 2  PTX trasmiting at the same time but diferent frequency.

    If one signal is much stronger than the other it can still cause interference despite being on another channel, but if the distance between the 2 PTX's and the PRX is comparable it shouldn't be an issue. 

    As an example if the PTX on the wrong channel is laying next to the PRX, and the PTX on the right channel is far away, then you might get interference from the one on the wrong channel. 

    Best regards
    Torbjørn

  • Hi

    I guess that the usual star of 1 PRX and 6 PTX can be synconized as following:

    At PRX,  the procesor  has a counter from 0 to 5 to 0 ...  , repeating permanently with fixed 10ms (by expamle)  in each step

    PRX will  upload actualized value in ack payload

    Each PTX has asigned a pipe number 0 to 5 and has a similar counter 0 tofive

    At power-on  each PTX (with some diferent delay or at any moment) , may send a short packet and with the ack payload information can adjust his counter to sincronize it wuh the PRX

    Fore more precision  a precounter for the 10ms time  can by used in all devices, andthis value upload also with the 0 to 5 information.

    --- After a initial test packet ,  each PTX will tx only when PRX expect this pipe will do it.

    PRX can pre-load the regarding information for each pipe

    Any collision is avoided

    ------------------------ another aproach ------------

    I guess If there will be only 3 pipes in use ,  each of the 3 available W_ACK_PAYLOAD can store the needed information and only the regarding one will be send with the ack

    ---------------------------------------------------------------------

    I fully working in other matter , but my mind not

    Best Regrds, Osvaldo

     

  • Hi Osvaldo

    o.hojvat said:

    My actual question is that some types of packets will be send to every PTX.

    I need to copy the same packet information to the 6 buffers

    --> Are some property of PIPE 6 the can be used for simplify this matter ?

    There is no simpler way to do this, no. You need to upload a unique payload for each PTX, since you don't know when each PTX will transmit, and there is no mechanism in the ESB protocol for sharing one payload with multiple pipes. 

    o.hojvat said:
    I have an idea for sincronizing the PTX trasmitions in order to avoid colitions.

    There are many ways to synchronize devices, which way to do choose depends on the application requirements. 

    One trick is to use a dedicated frequency for each PTX, and have the PRX cycle through each frequency in turn. The advantage of this method is that the PRX's won't be able to interfere with each other since they are not on the same frequency, but it does make things a bit more complicated on the PRX side. 

    If you manage to synchronize all the PTX's in time this is also possible, then there is no need to change frequency, but it makes things a bit more complex on the PTX side. 

    Best regards
    Torbjørn

  • Thank you for your reply

    I had similar ideas and If my timed sync works I will use only 1 frec. channel

    There are a max. of 3 ack payload that may be for same of diferen PIPES

    I will load the information for PIPES 1 - 1 - 2 at first

    Where is the information of TX FIFO full and empty available in the PRX?

    Is the same as the TX FIFO in PRT?  I did not found it clearly stated in the data sheet.

    By the moment I will try useing 3 PTX, later I will do the PTX sinr. and add more channels

    I guess the PRX program is complete (partially tested) butI I will need to have also one PRT working for testing all.

    Best Regards, Osvaldo

  • amistake, sorry:  I wanted to said:

    I will load the information for PIPES 0- 1 - 2 at first

  • Hi Osvaldo

    I also made a mistake earlier. I forgot you were using the nRF24L01+, and in this case you can't upload a packet for all FIFO's at once. This device only has 3 slots in the FIFO, so you would have to upload only 3 packets at first, and then upload the remaining packets as the ACK payloads are being picked up. 

    o.hojvat said:
    Where is the information of TX FIFO full and empty available in the PRX?

    You can find information about this in the FIFO_STATUS register (register 0x17). Please refer to the product specification for more information. 

    o.hojvat said:
    Is the same as the TX FIFO in PRT?  I did not found it clearly stated in the data sheet.

    What do you mean by PRT? I see you mention this several times in your post. There are only two modes in the device, PTX and PRX. 

    Also, I would appreciate it if you create a new ticket if you have more questions where you summarize the latest status of your project and what questions are remaining. This ticket is getting big and messy, with a mix of old and new questions, and the devzone is not really designed to handle long running tickets very well. 

    Best regards
    Torbjørn

  • I had confused in my mind about names (my memory errors)

    PRT- -> I wanted to say PTX  

    Now I noted that are RX and TX modes with a P letter at the begining.  I guess I will remember well it.

    What is the P letter  meaning?

         And the last question is if the Tx FIFOs used in PTX mode are the same Tx FIFOs used for ACK_PAYLOAD in a PRX mode device,  so the the informations about Tx FIFO full or empty are in register 0x17 for both cases.

         In data sheet page 62 there are mention of  ACK_PLD  TX_PLD  RX_PLD  as not numbered registers or FIFOs.

    After several days I may have RFcomunication  working  in the proyect and more information and questions.

    I will send it in a new ticket, as you sugested.

    Best Regards, Osvaldo

Reply
  • I had confused in my mind about names (my memory errors)

    PRT- -> I wanted to say PTX  

    Now I noted that are RX and TX modes with a P letter at the begining.  I guess I will remember well it.

    What is the P letter  meaning?

         And the last question is if the Tx FIFOs used in PTX mode are the same Tx FIFOs used for ACK_PAYLOAD in a PRX mode device,  so the the informations about Tx FIFO full or empty are in register 0x17 for both cases.

         In data sheet page 62 there are mention of  ACK_PLD  TX_PLD  RX_PLD  as not numbered registers or FIFOs.

    After several days I may have RFcomunication  working  in the proyect and more information and questions.

    I will send it in a new ticket, as you sugested.

    Best Regards, Osvaldo

Children
  • Hi 

    P means Primary. Since both devices will transmit and receive you can't just call them TX and RX. PTX is the device that transmits first, and receives the ACK second (primary transmit). 

    PRX is the device that receives first, and then transmits an ACK (primary receive). 

    o.hojvat said:
         And the last question is if the Tx FIFOs used in PTX mode are the same Tx FIFOs used for ACK_PAYLOAD in a PRX mode device,  so the the informations about Tx FIFO full or empty are in register 0x17 for both cases

    Yes. In PRX mode the TX FIFO is used to hold the ACK payloads, so the bits are the same. 

    Best regards
    Torbjørn

Related