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

  • Hi Osvaldo

    I share some instructions here how to configure the nRF24L01+ in PTX and PRX mode in the easiest way possible to enable dynamic payload length and send some data. All other settings such as address, RF channel and CRC is kept at the default in order to minimize the room for error. 

    Please try to follow that description and see if you can get some communication going. 

    If you start with the PTX you should see the IRQ line go low some time after you pulse CE, if everything is working as expected. 

    If you still are having issues I would recommend connecting a scope to the SPI, CE and IRQ lines so that you can verify what is sent over the bus, and make sure the communication looks OK. If you share the scope traces with me I can also take a look at them. 

    And as a general comment I would urge you to move to C rather than assembly as soon as possible, but possibly this is not your call to make Wink

    Best regards
    Torbjørn

  • Test program status

    Dear Mr. Torbjørn

    I was working on the matter and got some comunication between PTX and PRX

    Level compatibility of signals has no problem in the current  hardware
     -> PIC16F26 has two SPI; data sheet may have an error: it states SPI input CMOS level for SPI1  but  TTL for SPI2
    For the other procesor I will use , data sheet stated TTL, 2V or more for high level

    I have tested PIC SPI and it seems to have TTL levels:
    I placed a  potenciometer at MISO and verifyed:  for SPI1 that I am using at the moment:
     Readed CONFIG (0) register value is ok with 2,5V high level and fails with 2,3V or less
    So with 3,2V measured MISO signal I have confidence for readed SPI information.
     Later I will do the same with SPI2 input for confirm or not data sheet information
    There are others pics than can select TTL or CMOS input level
    External INT input is TTL level

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

    Program description

    My asm has the initializing for procesor and a well defined main part for PTX case, and if PORTA,4 is tied to GND
    there is a jump to the main for PRX.

    ;Short test program for Tx / Rx following Torbjørn instructions (from Nordic Forum)
    ;I have selected the procesor pins in order to keep posible USART pins free for next proyect step
    ;Procesor PIC16F1826    ( = PIC)
    ;Transceiver NRF24L01+ ( = NRF)         PTX = RF tx mode     PRX = RF rx mode
    ;Using default values at most NRF registers for low instructions count 
    ; RA4 pin open -> PTR mode   no interruptions
    ; RA4 to GND  ->  PRX mode   - IRQ used     ( the same program forboth modes )
    
    ; PIC definitions 
    ; INTERNAL OSCILLATOR 16MHZ
    ; SERIAL DATA OUT (MOSI): RA6      ; 
    ; SERIAL DATA IN (MISO):  RB1     ;
    ; SERIAL SPI CLOCK:  RB4 - 4MHz
    ; SPI  MASTERMODE for procesor  
    ; RB0 USED AS INPUT TO ENABLE INTERRUPT ON CHANGE (HIGH TO LOW) AND CONNECTED TO TRASCEIVER IRQ for use as TRP
    ; CSN - NRF SPI enable: RA7 
    ; CE  NRF24L01+ RF enable (data sheeet states: less than 4ms ON in Tx mode)
    
    ; Subrutines used for SPI
    ; sendSPI  - send WREG value to NRF - iniciate and wait 8 SPI CLK - return with banco0
    ; receiveSPI  - iniciate and wait 8 SPI CLK - return with banco0 and SPI received value in WREG (fron NRF)
    ; delay10u  - 10us
    ; delay1m   - 1ms
    ; delay200m - 200ms
    
    
    #define 	banco0	movlb	0     ; 
    #define 	banco1	movlb	1     ; OSCON - OPTION
    #define 	banco2	movlb	2     ; APFCON   (some inputs/outputs can be moved between default pin to other one )
    #define 	banco3	movlb	3     ; usart
    #define 	banco4	movlb	4     ; SPI
    
    #define		CSN		PORTA,7	
    #define     CE		PORTA,0
    #define     PTXsel	PORTA,4     ; 0 = PRX  mode ;  1 = PTX  mode
    #define	    LED 	PORTA,2   ; PTR shows tx fifo not empty  -  PRX shows rx fifo with data
    ;#define 
    ;#define 
    ;#define 
    ;#define 
    ;#define 
     CBLOCK 	0x20    
      Reg1      ; for delay subrutines 
      Reg2      ; 
      Reg3      ;
    
      RxDATA1 
      RxDATA2 
      RxDATA3 
      RxDATA4 
    
      TxDATA1 
      TxDATA2 
      TxDATA3 
      TxDATA4   
     ENDC
    
     CBLOCK 	0x70    ; access from any bank
      Arg0   
      Arg1   
      Arg2   
      Arg3   
      Arg4   
      Arg5
      Arg6
      Arg7
      Flg 
     ENDC
     
    
            list    p=16F1826,  r=hex   
            INCLUDE P16F1827.INC    ;  F1826,INC  is not present in MPLAB
    
    	__CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_OFF & _MCLRE_ON & _CP_OFF & _CPD_OFF & _BOREN_ON & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF
    	__CONFIG _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_OFF & _BORV_HI & _LVP_OFF     ; en el .INC ,     _BORV_19 = _BORV_LO es el trip point bajo   _HI alto
    
    
                       ORG 00
    
                  GOTO START
    
    ;;;INT      ; not using INT for this test 
    ;;;	clrf	BSR
    
    ;;;retfie
    
                       
    START         ;     
    call	delay200ms
    
    ; PIC initialize
      BANKSEL		TRISB
                       movlw    B'00000111' ; SETTING PORTB ACCORDING TO SPI, RB0 IS INPUT TO ENABLE TRANSCEIVER IRQ
                       movwf    TRISB  ;RB1 MISO   RB2  para Rx de 485 
    		   		movlw    b'00010010'    ; tecla a GND en RA1 - pongo 10k a +5  - puente a GND para modo TRX
    		   		movwf    TRISA           ;bit5 de MCLR no se baja- teclaa RA1 - LED en salida RA2
    			movlw	b'01111010'    ; para 16M
    			movwf	OSCCON					
    			movlw	b'10000100'    ;con pull-up (ver def. individuales) ; RB0 = 0 INTERRUPT HIGH TO LOW EDGE = bit6
    			movwf	OPTION_REG   ; presc 1/32 para TMR0 ( ver si lo uso) 
      BANKSEL PORTB           
                      MOVLW B'00000000'   
    		  MOVWF	PORTB    
                      MOVLW B'10000000'   
    		  MOVWF	PORTA    ; para CSN en alto 
    		BANKSEL ANSELA 
    		clrf	ANSELA
    		clrf	ANSELB
      BANKSEL  SSP1STAT                     ; tested at, 4MZ also works with SMP = 0
                       MOVLW B'01000000'      ;;; SMP= 1   CKE = 1     ( smp = bit 7 11000000)
                       MOVWF SSP1STAT
                       MOVLW B'00100000'     ; frecSPIclk = fosc/4 = frec instruccion -> 4M  for 16M-osc            
                       MOVWF SSP1CON1            ; bit4 CPK = 0    mode 0,0   smp = 1 
                       MOVLW B'10010000'
      BANKSEL  APFCON0    ; banco2
     			movlw   b'11000000'     ;  RA6 MOSI  
     			movwf	APFCON0         ; (bit7) Tx  USART  RB2 -> RB5
     			movlw   1               ; Rx del USART  RB1 -> RB2
     			movwf	APFCON1
      banco0
    ;;;			movlw	b'10010000'    ; GIE  INTE   - PRX  uses IRQ  falling level
    ;;;		btfsc	PORTA,4      ; to GND -> PRX
    			movlw	0       ; open -> PTX
    			MOVWF INTCON ; for this test I will use poling RIRQ  ;;;  ENABLE GLOBAL INTERRUPTS + RB0 EXTERNAL INTERRUPT IN
          
     clrf	 RxDATA1
     clrf	 RxDATA2
     clrf	 RxDATA3
     clrf	 RxDATA4
     clrf	Arg0  
     clrf	Arg1  
     clrf	Arg2  
     clrf	Arg3  
     clrf	Arg4  
     clrf	Arg5
     clrf	Arg6
     clrf	Arg7  
     clrf	Flg
      movlw	1
    movwf	TxDATA1	    ; for tests
     movlw	2	
    movwf	TxDATA2
     movlw	3
    movwf	TxDATA3
     movlw	4
    movwf	TxDATA4
    
    
    
    btfss	PORTA,4      ; to GND -> PRX
    goto	PRX
    
    ; NRF24L01 *************************** reference:  data sheet- commands table 20 page 51 and registers  9.1 page 57 ******************
    
    ; PTX:    -   IRQ is enabled but not used in PTR
    ; 1) Set the PWR_UP bit in the CONFIG register     -  
    				bcf CSN       				 ; Open NRF SPI
                       MOVLW B'00100000'         ; write reg 0 - CONFIG    (command 001aaaaa = write to aaaaa register 
                       CALL SEND    
                       MOVLW B'01010010'         ;bit5 low: IRQ for Tx send,  POWER_ON   ; no CRC , PTX mode
                       CALL SEND            
    				bsf CSN                      ; close SPI
    ; optional confirm CPNFIG value
    	movlw	0			
    	call	read_Regx
    	movwf	Arg0
    	
    ; necessary ??? disable auto-ack
    				bcf CSN       				 ; Open NRF SPI
                       MOVLW B'00100001'         ; write reg 1 -  EN_AA
                       CALL SEND    
                       MOVLW 0         ;
                       CALL SEND            
    				bsf CSN                      ; close SPI	
    	
    ; -----   2)  3) are the same for
    ; -----   2)  3) are the same for  PTX and PRX    
    ; 2) Set DYNPD to 0x3F   
    				bcf CSN       				 ; 
                       MOVLW B'00111100'         ; write reg 1C - DYNPD    - b'00111100' = (0x20 + 0x1C)
                       CALL SEND    
                       MOVLW B'00111111'         ; dynamic PD all channels
                       CALL SEND                 ; 
    				bsf CSN
    
    ; 3) Set the EN_DPL bit in the FEATURE register
    				bcf CSN       				 ; 
                       MOVLW B'00111101'         ; write reg 1D - FEATURE   - b'00111101' = (0x20 + 0x1D)
                       CALL SEND    
                       MOVLW B'00000010'         ; dynamic PD  enabled
                       CALL SEND                 ; 
    				bsf CSN
    ;optional ? .............. flush tx fifo ..................
    	bcf CSN	
    	    movlw	0xE1   ; b'11100001'
    	    call	SEND
    	bsf CSN		
    								
    ; 4) Upload a payload
    new_payload:
     ; optional ..............   
        		call 	read_fifo_status	  ;  readed value in WREG
    		movwf	Arg1   ;   before load  bit4 EMPTY must be = 1  empty
    	btfss	Arg1,4
    	bsf LED	; PORTA,2   ; a negated copy of Tx fifo EMPTY
    	btfsc	Arg1,4
    	bcf LED	; PORTA,2   ; led O = tx fifo with data
    ;...............
    		bcf CSN   ; habilito SPI para cargar datos en TX FiFO
    					movlw	0xA0       ; comando tx payload
    					call	SEND
    					movf	TxDATA1,w    
    					call	SEND
    					movf	TxDATA2,w
    					call	SEND
    					movf	TxDATA3,w
    					call	SEND
    					movf	TxDATA4,w
    					call	SEND   
    			    bsf CSN	
    
    ;Optional:  read and check fifo status 
    		call 	read_fifo_status	  ;  readed value in WREG
    		movwf	Arg2   ;             bit4 EMPTY must be = 0  not empty
    	btfss	Arg2,4
    	bsf LED	; PORTA,2   ; a negated copy of Tx fifo EMPTY
    	btfsc	Arg2,4
    	bcf LED	; PORTA,2   ; led O = tx fifo with data
    ; 5) Pulse CE for 10 us   ******* DO NOT PLACE BREAKPOINTS HERE    ********
    retry:  
    				bsf	CE
    				call	delay10us
    				call	delay10us  ; minimum 10us
    				bcf	CE
                      ; ***************  TX Rf 4MS MAXIMUN ***********************
    ;Optional:  read and check fifo status  130us for rf iniciate?
       call delay10us	; tx 4 bytes needs 40us at 1MHz rate -> for tx FIFO empty
       call delay10us      ;NEEDS MORE TIME - time for next read is added to a more sure value
    		call 	read_fifo_status	  ;  readed value in WREG
    		movwf	Arg3  ;  after tx the data bit4 txbuf EMPTY must be = 1 empty
    	call	delay1ms    ; at  40us fifo not emty - after 1ms yes
    		call 	read_fifo_status	  ;  readed value in WREG
    		movwf	Arg4  ;  after tx the data bit4 txbuf EMPTY must be = 1 empty
    	btfss	Arg4,4
    	bsf LED	; PORTA,2   ; a negated copy of Tx fifo EMPTY
    	btfsc	Arg4,4
    	bcf LED	; PORTA,2
    
    	; optional ????............ clr tx  IRQ ..............
     	
    		call	read_status
    		movwf	Arg5		
    		
    	bcf CSN	
    	    movlw   0x27	; b'00100111' write to STATUS reg.
    		call	SEND   ;  
    	movlw	b'01110000'	; clr all interrupts flags
    		call	SEND	
    	bsf CSN                ; 56us from CE rise 
    		call	read_status    ; CSN inside
    		movwf	Arg6		; 72us from CE rise
    	
    		btfss	PORTB,0
    		nop		
    		btfsc	PORTB,0
    		nop
    	
    ; ......................................
    	
    		call	delay40ms
    
    btfss	Arg4,4   ; if tx FiFO not  empty, do not load again
    goto retry		
    
    	incf	TxDATA1,f    ;  modified data for next packet trasmition	
    ; 6) Add a delay (1ms+) and repeat from 4)
    	call delay200ms
    
    goto	new_payload
    
    ;;; goto	moreProgram
    ;****************************************************
    	; ; below - PRX 
    ;****************************************************
    
    PRX:
    ; 1) Set the PWR_UP bit and PRIM_RX bits in the CONFIG register     -  
    		bcf CSN       				 ; Open NRF SPI
                MOVLW B'00100000'         ; write reg 0 - CONFIG    (command 001aaaaa = write to aaaaa register 
                CALL SEND    
                MOVLW B'00110011'         ;Bit6 low: IRQ for Rx received,  POWER_ON   ; no CRC , PRX mode
                CALL SEND            
    		bsf CSN                      ; close SPI
    
    ; optional confirm CPNFIG value
    	movlw	0			
    	call	read_Regx
    	movwf	Arg0
    	
    ; necessary ??? disable auto-ack
    				bcf CSN       				 ; Open NRF SPI
                       MOVLW B'00100001'         ; write reg 1 -  EN_AA
                       CALL SEND    
                       MOVLW 0         ;
                       CALL SEND            
    				bsf CSN                      ; close SPI	
    	
    ; -----   2)  3) are the same for  PTX and PRX
    ; 2) Set DYNPD to 0x3F
    				bcf CSN       				 ; 
                       MOVLW B'00111100'         ; write reg 1C - DYNPD    - b'00111100' = (0x20 + 0x1C)
                       CALL SEND    
                       MOVLW B'00111111'         ; dynamic PD all channels
                       CALL SEND                 ; 
    				bsf CSN
     
    ; 3) Set the EN_DPL bit in the FEATURE register
    				bcf CSN       				 ; 
                       MOVLW B'00111101'         ; write reg 1D - FEATURE   - b'00111101' = (0x20 + 0x1D)
                       CALL SEND    
                       MOVLW B'00000010'         ; dynamic PD  enabled
                       CALL SEND                 ; 
    				bsf CSN
     ;optional
    		call 	read_fifo_status	  ;  readed value in WREG
    		movwf	Arg2   ;             bit0 EMPTY must be = 1 empty
     ;optional
    		call	read_status
    		movwf	Arg5		
    		nop
    
    ; 4) Set CE high
    		bsf		CE    ;  set RF  ON  for Rx
    
    ; 5) Wait for the IRQ line to go low   ; no used INT for this test 
    rx_wait:
    		btfss	PORTB,0
    ;;;loop extended to some lines below;	goto	rx_wait
    
    ; 6) Read out the RX payload  ( IRQ low )
    		call	readPayload ;;goto
    ; 7) Repeat from 5) 
    	call	delay40ms     ; read more frecuently than Tx send 
    		bcf	LED ; PORTA,2   ; 
    	call	delay40ms
    
     ;optional
    		call 	read_fifo_status	  ;  readed value in WREG
    		movwf	Arg3   ;             bit0 EMPTY must be = 1 empty
    
    ; required ? flush rx fifo
    	bcf CSN	
    	    movlw	0xE2   ; b'11100010'
    	    call	SEND
    	bsf CSN
    
     ;optional
    		call 	read_fifo_status	  ;  readed value in WREG
    		movwf	Arg4   ;             bit0 EMPTY must be = 1 empty
    
    
    ;optional
    	call	read_status
    	movwf	Arg6		
    	
    ; reset IRQ to 1		
    	bcf CSN	
    	    movlw   0x27	; b'00101110'  write to STATUS reg.
    		call	SEND   ;  
    	movlw	b'01110000'	; clr all interrupts flags
    		call	SEND	
    	bsf CSN                ; 56us from CE rise 
    		
    ;optional
    		call	read_status
    		movwf	Arg7
    				
    goto	rx_wait
    
    ; ***************** main program end ***** subrutines below **********
    ;............................................................
    ; -----------------------------------------------------------------
    
    ;************************* Subrutines ******************************
    
    readPayload      ;; no INT for this test ;banco0     ;only for PRX
    ;optional	
    	bsf	LED	; PORTA,2   ; 		
    
                bcf CSN	
                       MOVLW B'01100001' ;0x61 Comando SEND REQUEST READ PAYLOAD - en pag 51 el tercer comando
                       CALL SEND
                    CALL RECEIVE		; get SPI data
                      MOVWF RxDATA1   ; lee 4 datos manteniendo CSN en bajo
                    CALL RECEIVE
                      MOVWF RxDATA2
                    CALL RECEIVE
                      MOVWF RxDATA3
                    CALL RECEIVE
                      MOVWF RxDATA4                  
                bsf CSN			; cierra el /CS luego de leer 6 datos	  
        ;;;;;;;    BCF INTCON,INTF ; CLEAR RB0 INTERRUPT FLAG    bit1
    	nop
    	nop
    	bcf CSN
    	    movlw	b'00100111'	;  0x27 escribo en STATUS
    		call	SEND
    	    movlw	b'01110000'  ;clear flags  ;     pongo 1 en bit6 => borra flag RDb'01000000'
    		call	SEND
    	bsf CSN 
    ; show RxDATA1  counting
    	btfss	RxDATA1,2	
    	bcf PORTA,3
    	btfsc	RxDATA1,2	
    	bsf PORTA,3
    	return	        ; RETFIE
                       
       ; -----------------------------------------------------------------
    
    SEND: 	  ; procesor SPI send WREG value to NRF
      BANKSEL SSP1STAT
                       MOVWF SSP1BUF ; MOVE BYTE TO W REGISTER BEFORE CALLING
    ;;;..........  wait 8 clk ........
                       BTFSS SSP1STAT,BF ; POLL RECEIVING COMPLETE
                       GOTO $-1
    ;;;;.......................................
      BANKSEL PORTB
                       RETURN
    
    ;*************************************
    
    RECEIVE:    ; procesor receive SPI data from NRF
        BANKSEL SSPSTAT     ;  data was send by SPI before this sub.
    				clrf	SSP1BUF   ; con cargar o borrar este registro inicia 8 clk
    ;;;..........  wait 8 clk ........
                       BTFSS SSP1STAT,BF ; POLL RECEIVING COMPLETE
                       GOTO $-1
    ;;;;.......................................
    			MOVF SSP1BUF,W   ; received SPI data in WREG
      BANKSEL PORTB
                       RETURN
    
    ; *********************************************************
    
    
    
    
    
    ;------------------------ delay  subs ------------------------------------------
    
    delay200ms: movlw .0   ;   
                movwf Reg1
                movlw .16     
                movwf Reg2
                movlw .5
                movwf Reg3
                decfsz Reg1,F
               goto $-1
                decfsz Reg2,F
               goto $-3
                decfsz Reg3,F
               goto $-5
                nop
            RETURN
    ; ---------------------------------------------------
    
    delay40ms:  movlw	.202  ; 
                movwf	Reg1
    	    movlw	    .208     ;  40ms    
                movwf	Reg2            
                decfsz Reg1,F
    		  goto $-1
                decfsz Reg2,F
              goto $-3           
          return      
    
    ; ---------------------------------------------------
    
    delay1ms:  movlw	.60  ;
                movwf	Reg1
    	    movlw	    .6   ;   1ms        
                movwf	Reg2            
                decfsz Reg1,F
    		  goto $-1
                decfsz Reg2,F
              goto $-3           
          return      
    
    ; ----------------------------------------
    
    delay10us: movlw	.13   ; 10us  + 1us for call/return
    			movwf	Reg1
                decfsz Reg1,F
            	goto $-1           
          return      
    
    ;;**************  subs for debug  ****************
    
    read_fifo_status:     ; lo puse para debug - se puede usar en Tx y en Rx
    	bcf	CSN ; PORTA,7
    		movlw	0x17 ; 	(para lectura de un registro no sumar 0x20)
    		call	SEND	
    		    CALL RECEIVE
    	bsf	CSN
    		    return   ; valor leido en w y está en banco0
    ;--------------------------------
    		    
    read_status:     ; lo puse para debug - se puede usar en Tx y en Rx
    	bcf	CSN ; PORTA,7
    		movlw	0x7 ; 	(para lectura de un registro no sumar 0x20)
    		call	SEND	
    		    CALL RECEIVE
    	bsf	CSN
    		    return   ; valor leido en w y está en banco0
    ;---------------------------
    read_Regx:     ; lo puse para debug - se puede usar en Tx y en Rx
    	bcf	CSN ; PORTA,7
    	; usa el valor en  w  ; (para lectura de un registro no sumar 0x20)
    		call	SEND	
    		    CALL RECEIVE
    	bsf	CSN
    		    return   ; valor leido en w y está en banco0
    		    
    ;----------------------------
    
    https://devzone.nordicsemi.com/f/nordic-q-a/98314/using-nrf24l01-with-pure-assembler-programing?ReplySortBy=CreatedDate&ReplySortOrder=Descending#
    
    END               
        
        
    
      Line 150 of asm
    PRX is at line 256

    I added to your list:
    clear register 1 for no auto_ack
    flush Tx FIFO
    flush Rf FIFO
    mask for TX_SD and TX_RD  and clear Flags by writing ones in bytes 6,5,4 of STATUS

    I placed many registers reading to be used for debug . I am using MPLABX (5.35 version) with ICD3

    After writing config register(0) , I read the value and confirm that  SPI write an read ar OK

    I have placed several readings for FIFO_STATUS and for STATUS reg. that I can see at break points in the debug

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

    TPX uses a LED  showing  TX FIFO empy / not empty - it flashs about 4 times a second, according to the used delays

    TxDATA1 in increased in each Tx so there are not identical consecutive packs

    TRX uses the same LED that flashes when reading payload
        It does not work by the moment and readed data is = 0

    I check IRQ by poling, not using interrupts by the moment

    **** => What is working and shows there is some Rx received is a LED conected IRQ output of PRX board

         LED at PRX IRQ FLASHES AT THE SAME RATE as PTR Tx LED  and STOP when  PTX board  is DISCONECTED !!!

    The total delay in the PRX main loop is shorter than the total delay in PTX  

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

    I will try to send the actual asm file

    Best regards, Osvaldo


  • Hi Osvaldo

    I don't quite understand the problem. It seems you are able to send data from the PTX to the PRX, but you are not able to send data the other way? Is that an accurate summary of the issue? 

    As I mentioned earlier, in order to really know what is going on you should try to capture a trace of the communication between the host MCU and the nRF device. Then you will see exactly how the nRF is configured, and what data is sent back and forth. 

    Best regards
    Torbjørn

  • Thank you for the reply.    I just saw it

    I have corrected an error in FEATURE, in the bit  position for dynamic payload enable.

    Now I get the same Rx Data in PRX as the Tx Data in PTX

    By the moment I like to not using ack

    I found necessary two actions for my tests works:

    *** Clear reg1 (auto ack) at the initial settings

    *** Clear STATUS RX_RD after a received payload for have reseted the IRQ out ( I use poling)

    I finally understand that this byte is cleared writing a 1, but the level becomes1 when activated and low when cleared

    *** I guess than flux Rx/Tx  FIFOs is not necessary at the beguining

    I will inform when I may get trasmiting about 40 diferents packets  and receive the same with no error

    Distance is about 60cm

    Best Regards

  • Hi Osvaldo

    If you want to use the dynamic payload length feature you should not clear the bits in the EN_AA register (reg 1). 

    Instead you can use a feature called "dynamic ACK", that allows you to send packets that will not be acked while still being able to use dynamic payload length. 

    In order to use this feature you need to set bit 0 (EN_DYN_ACK) in the FEATURE register (reg 0x1D). 

    It also important that you enable the DPL bit in the DYNPD register for the pipe that you want to use (bit 0 for pipe 0 and so forth). 

    Then finally you have to use the W_TX_PAYLOAD_NO_ACK command (0xB0) to send the payload rather than the normal W_TX_PAYLOAD command (0xA0). 

    Another advantage of this method is that you can send some packets with ACK and other packets without, in case some packets are more critical than others. 

    Please note that when sending packets without ACK you will not know if the packets are successfully received or not, and you have to expect a certain amount of data loss. 

    Best regards
    Torbjørn

Related