This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF52832 Transceiver Example?

Hi All,

Sorry if this is a simple question, but I can't seem to find an example where the device is programmed as both RX and TX.  (The examples have either one or the other.)

In my code I have "nrf_esb_config.mode" set to NRF_ESB_MODE_PRX  and it receives fine but doesn't transmit.   (If I switch this to NRF_ESB_MODE_PTX it will transmit but not receive.)

Basically I want to receive a message and send it back out (no changes, I am setting the transmit length before sending out.)

thanks for any pointers,

Bob

  • I have it so close to working but in nrf_esb.c -> nrf_esb_write_payload, where the breakpoint is above, m_nrf_esb_mainstate never seems to reach "NRF_ESB_STATE_IDLE" )

    I even tried adding a while(!nrf_esb_is_idle() ) {}  in the main.c program and then make the function call but it never becomes idle.

    thanks for any pointers,

    Bob

  • Hi Bob

    Sorry for the slow response. With the Easter holidays ongoing here in Norway we have been severely understaffed, but now we're back in business ;)

    Stupid question, but why would you want to send exactly the same message back?

    The idea of ESB is that the PRX will send an ACK automatically, which by default is only an empty packet sent back to the same address. 

    There is an ACK payload feature allowing you to embed a payload to the ACK, but you need to prepare the data before the packet is received on the PRX side, which means you can't prepare an ACK payload immediately after receiving a packet, and have it included in the ACK. 
    A workaround to this issue is to send two packets from the PTX, allowing you to prepare the ACK payload after the first packet, and have it sent back after the second packet. 

    It is possible to switch the entire library from PRX to PRX mode if you want to do a more manual ACK, but it requires a bit more work since you need to disable, reconfigure and enable the library for every switch. 

    For an example of this you could have a look at this example I wrote a while back, which implements a simple mesh like protocol where all nodes are in PRX mode most of the time, and only switch to PTX mode when they want to send something. 

    Best regards
    Torbjørn

  • Torbjorn,

    I don't need an ACK, actually I have it setup to run without sending back and ack so the transmitting device can immediately go back to sleep.

    I'm not trying to send the message BACK, but rather send it FORWARD.   Basically a range extender.   The remote device can't transmit to the base, but if I put a device between the remote and base, which can see both devices would allow me to extend the range.

    Summary Remote can't reach Base, but it can reach Repeater.   Repeater will send message to Base.

    Does the example you mention use the nRF52 device?   I'll go check it out.

    thanks,

    Bob

  • I got it working.

    Thanks.  The trick was to close esb and reopen in TX mode, transmit, wait for tx (success or fail) then close and reopen back in RX mode and continue on.

Related