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

PTX with dyn ack, sleep problem

Hi, There's a problem when using dynamic ack with return payload plus timer/sleep. Sending a single packet doesn't work. sending two packets works. not sleeping/using timer works. I've attached details (and code) files. Thanks in advance for your help! Best, Mahesh

OVERVIEW:

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

The PTX device needs to send data to PRX and get ACK and a return payload of data. It should then SLEEP for two seconds, wake up, and do it all over again. It does not work properly. PTX and PRX C files (ptx-main.c, prx-main.c) are attached and the output for 3 test cases follow.

Case 1: WORKS (but we don't need this): wake, send data continuously. packets are received and the return ack payload is received by PTX.

Case 2: DOES NOT WORK (but we want this!!!): send ONE packet, sleep. PRX IRQ is fired ONLY the first time. PTX, strangely, gets an ack BUT it always has only the data from the first (and only) return packet.

Case 3: WORKS (but we don't need this): wake, send TWO packets, sleep. both packets are received and the return ack payloads are received by PTX.

PTX & PRX OUTPUTS:

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

TEST CASE 1: (send packets continuously, no sleep)
-------------------------------------------------------------------
PTX:
Sent. Ack pack:length:32, Payload: C9, 02, 03
Sent. Ack pack:length:32, Payload: CA, 02, 03
Sent. Ack pack:length:32, Payload: CB, 02, 03
Sent. Ack pack:length:32, Payload: CC, 02, 03
Sent. Ack pack:length:32, Payload: CD, 02, 03
Sent. Ack pack:length:32, Payload: CE, 02, 03
Sent. Ack pack:length:32, Payload: CF, 02, 03
Sent. Ack pack:length:32, Payload: D0, 02, 03
Sent. Ack pack:length:32, Payload: D1, 02, 03
Sent. Ack pack:length:32, Payload: D2, 02, 03
Sent. Ack pack:length:32, Payload: D3, 02, 03
Sent. Ack pack:length:32, Payload: D4, 02, 03
Sent. Ack pack:length:32, Payload: D5, 02, 03
Sent. Ack pack:length:32, Payload: D6, 02, 03
Sent. Ack pack:length:32, Payload: D7, 02, 03
Sent. Ack pack:length:32, Payload: D8, 02, 03
Sent. Ack pack:length:32, Payload: D9, 02, 03
Sent. Ack pack:length:32, Payload: DA, 02, 03
Sent. Ack pack:length:32, Payload: DB, 02, 03
PRX:
got packet!
got packet!
got packet!
got packet!
got packet!
got packet!
got packet!
got packet!
got packet!
got packet!
(etc...)
TEST CASE 2: (send one packet, then go sleep, repeat)
-------------------------------------------------------------------
PTX: gets a first ACK payload, but it never gets updated. PRX sends only one and never again.
woke up:
Sent. Ack pack:length:32, Payload: 1B, 02, 03
woke up:
Sent. Ack pack:length:32, Payload: 1B, 02, 03
woke up:
Sent. Ack pack:length:32, Payload: 1C, 02, 03
woke up:
Sent. Ack pack:length:32, Payload: 1C, 02, 03
(etc...)
PRX: (prints the following ONCE, and that too, not always)
got packet!
TEST CASE 3: (sending two packets, then going to sleep, and repeat)
-------------------------------------------------------------------
PTX: (byte #1 of payload increments, my packet counter)
woke up:
Sent. Ack pack:length:32, Payload: 7C, 02, 03 -------> packet 1
Sent. Ack pack:length:32, Payload: 7D, 02, 03 -------> packet 2
woke up:
Sent. Ack pack:length:32, Payload: 7E, 02, 03
Sent. Ack pack:length:32, Payload: 7F, 02, 03
woke up:
Sent. Ack pack:length:32, Payload: 80, 02, 03
Sent. Ack pack:length:32, Payload: 81, 02, 03
woke up:
Sent. Ack pack:length:32, Payload: 82, 02, 03
Sent. Ack pack:length:32, Payload: 83, 02, 03
woke up:
Sent. Ack pack:length:32, Payload: 84, 02, 03
Sent. Ack pack:length:32, Payload: 85, 02, 03
woke up:
Sent. Ack pack:length:32, Payload: 86, 02, 03
Sent. Ack pack:length:32, Payload: 87, 02, 03
woke up:
Sent. Ack pack:length:32, Payload: 88, 02, 03
Sent. Ack pack:length:32, Payload: 89, 02, 03
woke up:
Sent. Ack pack:length:32, Payload: 8A, 02, 03
Sent. Ack pack:length:32, Payload: 8B, 02, 03
PRX:
got packet!
got packet!
got packet!
got packet!
got packet!
got packet!
got packet!
got packet!
got packet!
got packet!
got packet!
got packet!
(etc....)

prx-main.c

ptx-main.c

Parents
  • Hi Mahesh,

     

    In order for the PRX device to send an ACK-payload, this has to be updated to a specific RF pipe.

    If you are, on the PRX, uploading this to the radio at the time of receiving a packet, the hardware simultaneously controlling the radio and performing the RX->TX turnover. At this point, you have a race-condition between the CPU and the radio-hardware, and you're not guaranteed to successfully upload the ACK-payload before the radio has started transmitting the empty ACK.

     

    This is the reason why case 3 will work. You send one TX-payload, the PRX is then able to upload the ACK, then you send a new TX-payload to fetch the ACK-payload.

     

    Best regards,

    Håkon

Reply
  • Hi Mahesh,

     

    In order for the PRX device to send an ACK-payload, this has to be updated to a specific RF pipe.

    If you are, on the PRX, uploading this to the radio at the time of receiving a packet, the hardware simultaneously controlling the radio and performing the RX->TX turnover. At this point, you have a race-condition between the CPU and the radio-hardware, and you're not guaranteed to successfully upload the ACK-payload before the radio has started transmitting the empty ACK.

     

    This is the reason why case 3 will work. You send one TX-payload, the PRX is then able to upload the ACK, then you send a new TX-payload to fetch the ACK-payload.

     

    Best regards,

    Håkon

Children
No Data
Related