{"action":"opened","issue":{"url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/8906","repository_url":"https://api.github.com/repos/ARMmbed/mbed-os","labels_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/8906/labels{/name}","comments_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/8906/comments","events_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/8906/events","html_url":"https://github.com/ARMmbed/mbed-os/issues/8906","id":385798049,"node_id":"MDU6SXNzdWUzODU3OTgwNDk=","number":8906,"title":"LowPowerTimeout Broken","user":{"login":"klaas019","id":17363305,"node_id":"MDQ6VXNlcjE3MzYzMzA1","avatar_url":"https://avatars3.githubusercontent.com/u/17363305?v=4","gravatar_id":"","url":"https://api.github.com/users/klaas019","html_url":"https://github.com/klaas019","followers_url":"https://api.github.com/users/klaas019/followers","following_url":"https://api.github.com/users/klaas019/following{/other_user}","gists_url":"https://api.github.com/users/klaas019/gists{/gist_id}","starred_url":"https://api.github.com/users/klaas019/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klaas019/subscriptions","organizations_url":"https://api.github.com/users/klaas019/orgs","repos_url":"https://api.github.com/users/klaas019/repos","events_url":"https://api.github.com/users/klaas019/events{/privacy}","received_events_url":"https://api.github.com/users/klaas019/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-29T15:45:20Z","updated_at":"2018-11-29T15:45:20Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"<!--\r\n\r\n   ************************************** WARNING **************************************\r\n\r\n   The ciarcom bot parses this header automatically. Any deviation from the \r\n   template may cause the bot to automatically correct this header or may result in a \r\n   warning message, requesting updates.\r\n\r\n   Please ensure that nothing follows the Issue request type section, all \r\n   issue details are within the Description section and no changes are made to the \r\n   template format (as detailed below).\r\n\r\n   *************************************************************************************\r\n\r\n-->\r\n\r\n### Description\r\n\r\nLowPowerTimeout is broken in mbed-os-5.10.3 and 5.10.4. The LowPowerTimeout will not work properly if the time to fire is set to 3 seconds or greater. If one of the timeouts is less than 3 seconds then all of the timeouts will fire correctly.\r\n\r\nTest1:\r\n\r\nCode:\r\n\r\n#include \"mbed.h\"\r\n#define NUM_TIMEOUTS 5\r\n\r\nint main() {\r\n    Timer timers[NUM_TIMEOUTS];\r\n    LowPowerTimeout timeouts[NUM_TIMEOUTS];\r\n\r\n    for (int i = 0; i < NUM_TIMEOUTS; i++) {\r\n        timers[i].start();\r\n        timeouts[i].attach_us(mbed::callback(&timers[i], &Timer::stop), 3000000);\r\n    }\r\n\r\n    wait(6); //wait for all timeouts to fire\r\n\r\n    for (size_t i = 0; i < NUM_TIMEOUTS; i++) {\r\n        printf(\"%d : %d \\n\\r\", i, timers[i].read_us());\r\n    }\r\n\r\n    return 0;\r\n}\r\n\r\nOutput:\r\n\r\n0 : 6000538 \r\n1 : 6013045 \r\n2 : 6027559 \r\n3 : 6042073 \r\n4 : 6056589\r\n\r\nNone of the timeouts fired.\r\n\r\nTest 2:\r\n\r\nCode:\r\n\r\n#include \"mbed.h\"\r\n#define NUM_TIMEOUTS 5\r\n\r\nint main() {\r\n    Timer timers[NUM_TIMEOUTS];\r\n    LowPowerTimeout timeouts[NUM_TIMEOUTS];\r\n\r\n    timers[NUM_TIMEOUTS-1].start();\r\n    timeouts[NUM_TIMEOUTS-1].attach_us(mbed::callback(&timers[NUM_TIMEOUTS-1], &Timer::stop), 2000000);\r\n\r\n    for (int i = 0; i < NUM_TIMEOUTS - 1; i++) {\r\n        timers[i].start();\r\n        timeouts[i].attach_us(mbed::callback(&timers[i], &Timer::stop), 3000000);\r\n    }\r\n\r\n    wait(6); //wait for all timeouts to fire\r\n\r\n    for (size_t i = 0; i < NUM_TIMEOUTS; i++) {\r\n        printf(\"%d : %d \\n\\r\", i, timers[i].read_us());\r\n    }\r\n\r\n    return 0;\r\n}\r\n\r\nOutput:\r\n\r\n0 : 3000504 \r\n1 : 3000467 \r\n2 : 3000431 \r\n3 : 3000399 \r\n4 : 2000352\r\n\r\nAll fired correctly with the last one firing at 2 seconds instead of 3. Somehow this affects the behavior of the other timeouts. \r\n\r\nEven setting one timeout to >= 3 seconds, the timeout will fail by itself. The number of timeouts set doesn't appear to affect this.\r\n\r\nTested with mbed-os-5.10.3, GCC_ARM v 6 q2, XDOT_L151CC, MTS_MDOT_F411RE, NUCLEO_F411RE.\r\n\r\n<!--\r\n    Required\r\n    Add detailed description of what you are reporting.\r\n    Good example: https://os.mbed.com/docs/latest/reference/workflow.html\r\n    Things to consider sharing:\r\n    - What target does this relate to?\r\n    - What toolchain (name + version) are you using?\r\n    - What tools (name + version - is it mbed-cli, online compiler or IDE) are you using?\r\n    - What is the SHA of Mbed OS (git log -n1 --oneline)?\r\n    - Steps to reproduce. (Did you publish code or a test case that exhibits the problem?)\r\n-->\r\n\r\n\r\n### Issue request type\r\n\r\n<!--\r\n    Required\r\n    Please add only one X to one of the following types. Do not fill multiple types (split the issue otherwise.)\r\n    Please note this is not a GitHub task list, indenting the boxes or changing the format to add a '.' or '*' in front\r\n    of them would change the meaning incorrectly. The only changes to be made are to add a description text under the\r\n    description heading and to add a 'x' to the correct box.\r\n-->\r\n    [ ] Question\r\n    [ ] Enhancement\r\n    [x] Bug\r\n\r\n"}}
{"actor":{"display_login":"klaas019"}}