{"action":"created","issue":{"url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/8714","repository_url":"https://api.github.com/repos/ARMmbed/mbed-os","labels_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/8714/labels{/name}","comments_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/8714/comments","events_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/8714/events","html_url":"https://github.com/ARMmbed/mbed-os/issues/8714","id":379771207,"node_id":"MDU6SXNzdWUzNzk3NzEyMDc=","number":8714,"title":"STM32L4 - using TICKLESS and serial (UART - AT cellular) losing characters","user":{"login":"mfatiga","id":5451807,"node_id":"MDQ6VXNlcjU0NTE4MDc=","avatar_url":"https://avatars1.githubusercontent.com/u/5451807?v=4","gravatar_id":"","url":"https://api.github.com/users/mfatiga","html_url":"https://github.com/mfatiga","followers_url":"https://api.github.com/users/mfatiga/followers","following_url":"https://api.github.com/users/mfatiga/following{/other_user}","gists_url":"https://api.github.com/users/mfatiga/gists{/gist_id}","starred_url":"https://api.github.com/users/mfatiga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mfatiga/subscriptions","organizations_url":"https://api.github.com/users/mfatiga/orgs","repos_url":"https://api.github.com/users/mfatiga/repos","events_url":"https://api.github.com/users/mfatiga/events{/privacy}","received_events_url":"https://api.github.com/users/mfatiga/received_events","type":"User","site_admin":false},"labels":[{"id":1075658157,"node_id":"MDU6TGFiZWwxMDc1NjU4MTU3","url":"https://api.github.com/repos/ARMmbed/mbed-os/labels/Jira%20status:%20OPEN","name":"Jira status: OPEN","color":"f9d0c4","default":false},{"id":328051906,"node_id":"MDU6TGFiZWwzMjgwNTE5MDY=","url":"https://api.github.com/repos/ARMmbed/mbed-os/labels/devices:%20st","name":"devices: st","color":"0052cc","default":false},{"id":427713129,"node_id":"MDU6TGFiZWw0Mjc3MTMxMjk=","url":"https://api.github.com/repos/ARMmbed/mbed-os/labels/mirrored","name":"mirrored","color":"ededed","default":false},{"id":28847979,"node_id":"MDU6TGFiZWwyODg0Nzk3OQ==","url":"https://api.github.com/repos/ARMmbed/mbed-os/labels/type:%20bug","name":"type: bug","color":"b60205","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":54,"created_at":"2018-11-12T13:14:29Z","updated_at":"2018-11-15T22:38:53Z","closed_at":null,"author_association":"NONE","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\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\nI seem to be experiencing loss of characters sent/received through UART when communicating with the BG96 modem and when I have TICKLESS mode enabled. I have noticed this by viewing traces when connecting to a network. When I disable TICKLESS mode, the modem connects and works perfectly.\r\n\r\nI am using a custom target based on `STM32L476VG` and I'm using the `GCC_ARM` toolchain. I have copied the `DISCO_L476VG` `system_clock.c` and am using mostly the same peripheral pins and pin names files. I am using the QUECTEL BG96 modem and I'm using the integrated mbed driver. I have connected the modem to uart pins and I have also defined and connected flow control pins. The baud rate is set to default at `115200`. Modem pins:\r\n```\r\nMDMRTS = PA_12,\r\nMDMCTS = PA_11,\r\nMDMTXD = PA_9, \r\nMDMRXD = PA_10,\r\n```\r\n\r\ncustom_targets.json\r\n```\r\n{\r\n    \"MY_TARGET\": {\r\n        \"inherits\": [\"FAMILY_STM32\"],\r\n        \"core\": \"Cortex-M4F\",\r\n        \"extra_labels_add\": [\"STM32L4\", \"STM32L476xG\", \"STM32L476VG\"],\r\n        \"config\": {\r\n            \"clock_source\": {\r\n                \"help\": \"Mask value : USE_PLL_HSE_EXTC (need HW patch) | USE_PLL_HSE_XTAL | USE_PLL_HSI | USE_PLL_MSI\",\r\n                \"value\": \"USE_PLL_MSI\",\r\n                \"macro_name\": \"CLOCK_SOURCE\"\r\n            },\r\n            \"lpticker_lptim\": {\r\n                \"help\": \"This target supports LPTIM. Set value 1 to use LPTIM for LPTICKER, or 0 to use RTC wakeup timer\",\r\n                \"value\": 1\r\n            }\r\n        },\r\n        \"OUTPUT_EXT\": \"hex\",\r\n        \"detect_code\": [\"0820\"],\r\n        \"macros_add\": [\r\n            \"USBHOST_OTHER\", \r\n            \"TWO_RAM_REGIONS\",\r\n            \"MBED_TICKLESS\"\r\n        ],\r\n        \"device_has_add\": [\r\n            \"ANALOGOUT\", \r\n            \"CAN\", \r\n            \"LPTICKER\",\r\n            \"SERIAL_FC\",\r\n            \"SERIAL_ASYNCH\",\r\n            \"TRNG\",\r\n            \"FLASH\"\r\n        ],\r\n        \"release_versions\": [\"2\", \"5\"],\r\n        \"device_name\": \"STM32L476VG\",\r\n        \"bootloader_supported\": true\r\n    }\r\n}\r\n```\r\n\r\nmbed_app.json\r\n```\r\n{\r\n    \"target_overrides\": {\r\n        \"*\": {\r\n            \"events.use-lowpower-timer-ticker\": 1,\r\n            \"platform.default-serial-baud-rate\": 115200,\r\n            \r\n            \"platform.stdio-baud-rate\": 115200,\r\n            \"platform.stdio-convert-newlines\": true,\r\n            \"platform.stdio-buffered-serial\": true,\r\n            \"drivers.uart-serial-rxbuf-size\": 256,\r\n            \"drivers.uart-serial-txbuf-size\": 256,\r\n\r\n            \"rtos.idle-thread-stack-size\": 1024,\r\n\r\n            \"platform.cpu-stats-enabled\": 1,\r\n            \"platform.thread-stats-enabled\": 1,\r\n            \"platform.error-filename-capture-enabled\": true,\r\n            \r\n            \"cellular.use-apn-lookup\": 0,\r\n            \"ppp-cell-iface.apn-lookup\": 0,\r\n\r\n            \"mbed-trace.enable\": true\r\n        }\r\n    },\r\n    \"macros\": [\r\n        \"DEFAULT_APN=\\\"internet\\\"\",\r\n        \"CELLULAR_DEVICE=QUECTEL_BG96\"\r\n    ],\r\n    \"config\": {\r\n        \"trace-level\": {\r\n            \"help\": \"Options are TRACE_LEVEL_ERROR,TRACE_LEVEL_WARN,TRACE_LEVEL_INFO,TRACE_LEVEL_DEBUG\",\r\n            \"macro_name\": \"MBED_TRACE_MAX_LEVEL\",\r\n            \"value\": \"TRACE_LEVEL_INFO\"\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nI have tried:\r\n - changing clock sources\r\n - setting `lpticker_lptim` to 0\r\n - overriding `lpticker_delay_ticks` from and testing with values from 0 to 4\r\n - changing uart rx/tx buffer sizes\r\n - disabling trace\r\n - testing with different versions of mbed-os with every combination of the above\r\n\r\nI even tried setting a custom idle callback function, nothing changed. Nothing seems to work except disabling TICKLESS mode, which is not an option for my project. This is a blocker for my project because it requires low-power mode and is rarely turning on the modem and sending data to the backend.\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"},"comment":{"url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/comments/439216203","html_url":"https://github.com/ARMmbed/mbed-os/issues/8714#issuecomment-439216203","issue_url":"https://api.github.com/repos/ARMmbed/mbed-os/issues/8714","id":439216203,"node_id":"MDEyOklzc3VlQ29tbWVudDQzOTIxNjIwMw==","user":{"login":"c1728p9","id":2916772,"node_id":"MDQ6VXNlcjI5MTY3NzI=","avatar_url":"https://avatars2.githubusercontent.com/u/2916772?v=4","gravatar_id":"","url":"https://api.github.com/users/c1728p9","html_url":"https://github.com/c1728p9","followers_url":"https://api.github.com/users/c1728p9/followers","following_url":"https://api.github.com/users/c1728p9/following{/other_user}","gists_url":"https://api.github.com/users/c1728p9/gists{/gist_id}","starred_url":"https://api.github.com/users/c1728p9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/c1728p9/subscriptions","organizations_url":"https://api.github.com/users/c1728p9/orgs","repos_url":"https://api.github.com/users/c1728p9/repos","events_url":"https://api.github.com/users/c1728p9/events{/privacy}","received_events_url":"https://api.github.com/users/c1728p9/received_events","type":"User","site_admin":false},"created_at":"2018-11-15T22:38:53Z","updated_at":"2018-11-15T22:38:53Z","author_association":"CONTRIBUTOR","body":"Even with 6c6dd7b2e2b4899a57844b37cd429c09ffecce60 I still get uart overruns, thought they are much less frequent. I can confirm that the function ```lp_ticker_set_interrupt``` is no longer blocking.\r\n\r\nI'm still seeing interrupt latency as high as 80us causing these overruns. @mfatiga would it be possible to run at a lower baudrate until this latency is addressed? If you could run the uart at 57600 you shouldn't experience any overruns. At 115200 you may see infrequent overruns.\r\n\r\nThe worst case latency I'm seeing in the various configurations:\r\n- lp ticker + wrapper - ~80us\r\n- lp ticker - ~33us*\r\n- us ticker - ~25us\r\n\r\n*When the low power ticker wrapper is turned off scheduling does not work, so this time could be wrong.\r\n\r\nWith IO tracing I'm seeing ~36us of the worst case ~80us being directly due to the low power ticker wrapper."}}
{"actor":{"display_login":"c1728p9"}}