{"action":"created","issue":{"url":"https://api.github.com/repos/mbedmicro/mbed/issues/1969","repository_url":"https://api.github.com/repos/mbedmicro/mbed","labels_url":"https://api.github.com/repos/mbedmicro/mbed/issues/1969/labels{/name}","comments_url":"https://api.github.com/repos/mbedmicro/mbed/issues/1969/comments","events_url":"https://api.github.com/repos/mbedmicro/mbed/issues/1969/events","html_url":"https://github.com/mbedmicro/mbed/issues/1969","id":160832717,"number":1969,"title":"Configure stdio baud rate","user":{"login":"kjbracey-arm","id":11025917,"avatar_url":"https://avatars.githubusercontent.com/u/11025917?v=3","gravatar_id":"","url":"https://api.github.com/users/kjbracey-arm","html_url":"https://github.com/kjbracey-arm","followers_url":"https://api.github.com/users/kjbracey-arm/followers","following_url":"https://api.github.com/users/kjbracey-arm/following{/other_user}","gists_url":"https://api.github.com/users/kjbracey-arm/gists{/gist_id}","starred_url":"https://api.github.com/users/kjbracey-arm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kjbracey-arm/subscriptions","organizations_url":"https://api.github.com/users/kjbracey-arm/orgs","repos_url":"https://api.github.com/users/kjbracey-arm/repos","events_url":"https://api.github.com/users/kjbracey-arm/events{/privacy}","received_events_url":"https://api.github.com/users/kjbracey-arm/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-06-17T08:00:28Z","updated_at":"2016-06-27T06:52:38Z","closed_at":null,"body":"Magic is built in to initialise and bind stdio to a target-specified serial port. This is lovely.\r\n\r\nBut people still write code like this:\r\n\r\n    Serial output(USBTX, USBRX);\r\n    int main()\r\n    {\r\n         output.baud(115200);\r\n         output.printf(\"\\r\\n\\r\\nConnecting...\\r\\n\");\r\n\r\nThey start with the Serial object because they need to set the baud rate. If they did use stdio, best they could do would be this slightly iffy mixed version:\r\n\r\n    Serial output(USBTX, USBRX);\r\n    int main()\r\n    {\r\n         output.baud(115200);\r\n         printf(\"\\n\\nConnecting...\\n\");\r\n\r\n(assuming https://github.com/mbedmicro/mbed/pull/1876 is merged). They can't drop the board pin knowledge.\r\n\r\nStdio serial baud rate should be configurable (\"mbed.stdio-serial-baud\") so the example app can just be:\r\n\r\n    int main()\r\n    {\r\n         printf(\"\\n\\nConnecting...\\n\");\r\n\r\nwith baud set in the json. App is now board portable.\r\n\r\n@geky "},"comment":{"url":"https://api.github.com/repos/mbedmicro/mbed/issues/comments/228666866","html_url":"https://github.com/mbedmicro/mbed/issues/1969#issuecomment-228666866","issue_url":"https://api.github.com/repos/mbedmicro/mbed/issues/1969","id":228666866,"user":{"login":"kjbracey-arm","id":11025917,"avatar_url":"https://avatars.githubusercontent.com/u/11025917?v=3","gravatar_id":"","url":"https://api.github.com/users/kjbracey-arm","html_url":"https://github.com/kjbracey-arm","followers_url":"https://api.github.com/users/kjbracey-arm/followers","following_url":"https://api.github.com/users/kjbracey-arm/following{/other_user}","gists_url":"https://api.github.com/users/kjbracey-arm/gists{/gist_id}","starred_url":"https://api.github.com/users/kjbracey-arm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kjbracey-arm/subscriptions","organizations_url":"https://api.github.com/users/kjbracey-arm/orgs","repos_url":"https://api.github.com/users/kjbracey-arm/repos","events_url":"https://api.github.com/users/kjbracey-arm/events{/privacy}","received_events_url":"https://api.github.com/users/kjbracey-arm/received_events","type":"User","site_admin":false},"created_at":"2016-06-27T06:52:38Z","updated_at":"2016-06-27T06:52:38Z","body":"I would be quite happy for stdio terminal to have a different default to the serial object itself. That seems perfectly natural - you are specifically configuring the console - \"console=ttyS0,115200\" in Linux-speak, not a generic serial port.\r\n\r\nRaw serial port devices having default rate 9600 is conventional for backwards compatibility. Consoles less so.\r\n\r\nBut if the console does not have a fast/sensible default speed on platforms I'm going to be using, I just want an application or its config to be able to (attempt to) set 115200 baud ratio for stdio without knowing precisely what board it's running on. Doesn't seem like a lot to ask.\r\n\r\n(Personally, this does not feel to me like an application setting though - it feels more natural to me that the target should choose an appropriately fast console output rate. But if the platform chooses 9600, I am going to need the application to override it).\r\n\r\nObviously the setting will be somewhat target-specific. Some targets may not have stdout going to a UART, and some targets might have a UART not capable of 115200. (Seriously?)\r\n\r\nWe just want to say \"stdout, if going to a UART, please go fast\". If it can't go fast, then it can't. But it can almost certainly go faster than 9600. Any \"set baud\" API should logically select the closest possible.\r\n\r\nMaybe this could be done through API - get a file handle via fileno(stdout), map to serial device handle, and manipulate it? Not sure there's enough infrastructure there to support that though.\r\n"}}
{"actor":{"display_login":"kjbracey-arm"}}