Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add UART for host communication? #20

Open
rursprung opened this issue Oct 29, 2022 · 4 comments
Open

add UART for host communication? #20

rursprung opened this issue Oct 29, 2022 · 4 comments

Comments

@rursprung
Copy link

the board has a UART connection via USB which can e.g. be used to send messages to the host (if it's connected via USB, of course).

it might make sense to offer this in this crate?
the function would then have to do something like this:

        let gpioa = dp.GPIOA.split();
        let tx_pin = gpioa.pa2.into_alternate();
        let mut tx = dp
            .USART2
            .tx(
                tx_pin,
                Config::default()
                    .baudrate(115200.bps()) // would probably have to be configurable
                    .wordlength_8()
                    .parity_none(),
                &clocks,
            )
            .unwrap();

note that the example code is only for the TX pin (to send information to the host), RX should be set up in a similar way.

this can then e.g. be used as a simple logging functionality (though using something like defmt in combination with e.g. probe-run makes more sense in most cases):

writeln!(tx, "hello world!").unwrap();

using PuTTY (listening on the correct COM port) you can then read the messages being sent there.

@jkristell
Copy link
Owner

Hi

Yes that make total sense. A thought about adding it earlier, but as you write, rtt and defmt make more sense in most cases, but the functionality is there anyway so why not add it? Feel free to send a pull request!

@rursprung
Copy link
Author

Feel free to send a pull request!

i won't be doing this any time soon - if at all - as i'm currently not using the crate (i stumbled over it by chance, but decided not to use it as my use-case is not actually bound to this board, so i'm better off using more generic crates to avoid unnecessary dependencies) and don't have time right now. just thought that i'd place the idea here so that it isn't forgotten - maybe it'll be useful to somebody else who'll use this crate.

@huntr3ss
Copy link

huntr3ss commented Nov 4, 2022

@rursprung Do you have links to other crates which have realized this feature. This would help a future developer (maybe myself) to realize this feature.

@rursprung
Copy link
Author

Do you have links to other crates which have realized this feature.

i'm afraid not - but i haven't look at a lot of BSP crates yet (i'm still relatively new to the embedded world with rust (and in general)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants