Skip to content

Conversation

@geky
Copy link
Contributor

@geky geky commented Jun 22, 2016

@kjbracey-arm has a good write up for the motivation behind this addition: #1969

Adds core.stdio-baud-rate configuration option. Defaults to 9600 for backwards compatibility.

@bogdanm
Copy link
Contributor

bogdanm commented Jun 22, 2016

@kjbracey-arm has a good write up for the motivation behind this addition: #1969

The same conversation that you mention explains why the default baud rate is a better fit for a target configuration parameter.

@geky
Copy link
Contributor Author

geky commented Jun 22, 2016

The same conversation that you mention explains why the default baud rate is a better fit for a target configuration parameter.

Oh, I think I follow. So would the appropriate default mirror STDIO_UART_TX and be defined in device.h?

@geky
Copy link
Contributor Author

geky commented Jun 22, 2016

I added support for a device provided STDIO_UART_BAUD_RATE. Let me know if this isn't what you were looking for. I'm also not sure the appropriate place to document device.h additions.

@sg-
Copy link
Contributor

sg- commented Jun 23, 2016

This seems over complicated. There should be a single stdio_uart_baudrate which is default to 9600 and the application can override this or be old skool and just initialize an object in the application and use the baudrate member. It should not be defined or overridable by a target rather the application. This is a platform (ie: mbed) configuration, not a target configuration.

We can then clean this all up too :) https://github.com/mbedmicro/mbed/search?utf8=%E2%9C%93&q=serial_baud%28obj%2C+9600&type=Code

We dont need STDIO_UART_BAUD_RATE and MBED_CONF_CORE_STDIO_BAUD_RATE

@bogdanm
Copy link
Contributor

bogdanm commented Jun 23, 2016

We dont need STDIO_UART_BAUD_RATE and MBED_CONF_CORE_STDIO_BAUD_RATE.

Agreed. Let me repeat what I already said in #1969 here: sometimes, the default baud rate depends a lot on the target board, since it might not be able to support high baud rates due to a number of hardware limitations (either in the MCU UART implementation, the clock used for the UART or both). I actually hit this issue once, although not with a mbed board (but still with a board that used an ARM MCU). So, if you want your printf("Hello world!\n") to always work without additional fiddling with the code or the configuration, the best place to define the default baud rate is in the target. You can add it as a configuration parameter to the base Target itself, then various targets can override that if they need to. As usual, the application will have the last word on the final value of the baud rate.

@kjbracey
Copy link
Contributor

If the default is 9600 across boards, the expected immediate use here is that the applications that currently set baud to 115200 in their main.cpp (every mbed app I've ever worked on) will set it to 115200 in their JSON.

(If the default was faster, the apps would just leave it alone.)

At the minute the apps make the setting with an assumption that they're running on K64F (because they pass K64F pin assignments). But the point of the JSON is to make it generic - the apps would want to have it an all-target setting. If the baud rate is not supported, the board should ignore the setting and continue to use the default.

@screamerbg
Copy link
Contributor

-1
Reasoning here #1984 (comment)

@geky
Copy link
Contributor Author

geky commented Jun 24, 2016

I'm going to go ahead and close this since it doesn't look like there's a clear way forward. This conversation can continue over here: #1969

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants