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 Reply Children
No Data
Related