Enable or disable TWT with notification

I am studying Lesson 6/wifi fund_1ess6uexer2 and I can run the provided code normally.

(academy.nordicsemi.com/.../)
But I still want to control whether to send packets by pressing button 2 when turning off the TWT function.
As shown in step 3 of the diagram, when I turn off TWT, I press button 2 to enable the send package, but no data packet is sent. I tried to modify the code as shown in step 4 of the diagram, but couldn't. Could you please provide some help and guidance? Thank you very much!

  • Hi,

    ChengQing Zhao said:
    So, why does the legacy power save mode consume more power than the TWT mode when sending a package?

    Because the radio is on for a longer period of time with legacy power save mode. As is explained in the Power save modes topic in DevAcademy, with legacy power save mode, the device sends a PS poll to the AP to inform the AP that it is ready to receive data. The STA will be awake until it receives a frame from the AP with the More Data subfield set to 0, indicating that the AP does not have any more buffered data to send to the STA. In your case, this interaction seems to take 100 ms.

    When it comes to TWT, you have configured the TWT interval to be 100 ms and the wake interval to be 65 ms. This means that for each TWT period, which is 100 ms, the device will be awake for 65 ms and asleep for 35 ms. It does not wait to receive a frame from the AP with the More Data subfield set to 0 before going to sleep, it goes to sleep after being awake for 65 ms, as is agreed upon with the AP. If more data is buffered on the AP, this will be sent during the next wake-up instead.

    The nominal current consumption for RX is 60 mA for 2.4GHz and 56 mA for 5GHz, so the extra 35 ms that the device is awake for with legacy power save will greatly impact the average current consumption.

    The best improvement of TWT is that the device can be asleep for a longer period of time than with legacy power save mode, so comparing the current consumption under the same conditions does not really show the advantages of using TWT. However, for a fairer comparison, I would recommend reducing the TWT wake interval when having such a short TWT interval, as 65 ms wake interval is rather long when the total TWT interval is 100 ms. You can change this by changing the TWT_WAKE_INTERVAL_MS or directly changing params.setup.twt_wake_interval in wifi_set_twt() instead.

    I also recommend checking out the Online Power Profiler for Wi-Fi. Here, you can set the power save mode and other configurations and easily see how legacy power save mode (DTIM) compares with TWT when using different settings.

    Best regards,
    Marte

  • Thank you, . The last question, as you subscribe that, in legacy power save mode, after STA receives the data, the sta will be awake to send "ps-poll", as shown in the figure, so it keeps awake, does not go to sleep, still there is no data, sta then go to sleep, right? 

  • Hi,

    Since the device sent a packet, it will be awake to receive any response and ACKs from the AP. When it receives a frame from the AP informing it that the AP does not have any more data buffered for the device, it will go back to sleep.

    Best regards,
    Marte

  • OK, thank you . So, after it goes back to sleep, How is the peak current in the picture caused?

    I captured the package by the Wireshark and found that there is no package about STA, just about some AP broadcast package.

    As described in the official document "This means that the STA must send a PS-Poll frame for every downlink frame, which is sub-optimal with regards to efficiency and reducing overhead control signaling."https://academy.nordicsemi.com/courses/wi-fi-fundamentals/lessons/lesson-6-wifi-fundamentals/topic/power-save-modes-2/

    So, I think the peak current is caused by the "ps-poll" package, but sta nrf7002dk does not send any package. that is my question.

    And I want to know the the peak current include the package detail, just like the follow picture shows. can you give me some help?

  • Hi,

    ChengQing Zhao said:
    How is the peak current in the picture caused?

    It is the device waking up to see if the AP sends any DTIM beacons, indicating that the AP has data buffered for it.

    Best regards,
    Marte

Related