cpu: efm32: provide non-standard UART modes#9127
Conversation
|
Ping @kYc0o |
f28ab62 to
71a4d7e
Compare
| init.baudrate = baudrate; | ||
| init.databits = LEUART_DataBits2Def((uart_config[dev].mode >> 0) & 0xf); | ||
| init.stopbits = LEUART_StopBits2Def((uart_config[dev].mode >> 4) & 0xf); | ||
| init.parity = LEUART_Parity2Def((uart_config[dev].mode >> 8) & 0xf); |
There was a problem hiding this comment.
So, the baud rate will only change on init, then it stays like that as I see? Which means once the UART is attached to a device it cannot be detached is it?
There was a problem hiding this comment.
Yes, that's true. #5899 proposes a runtime option, but it is not merged/fixed/proposed.
STM32 Kinetis does the same, iirc.
pkg/gecko_sdk/Makefile
Outdated
| PKG_NAME=gecko_sdk | ||
| PKG_URL=https://github.com/basilfx/RIOT-gecko-sdk | ||
| PKG_VERSION=d381e526d68a2d0c951f37040c1c2e168ac66cd6 | ||
| PKG_VERSION=ee01ab57eaaa8805916601dd444d1b63f03037de |
There was a problem hiding this comment.
I see there's an update to the gecko sdk. Is this intended here?
There was a problem hiding this comment.
Yeah, the update is intended, as they provide the utility methods to convert bits to enums.
|
I also wonder how is this configurable at compile time. The only way to change the behaviour is to modify the source code, which seems not super practical. Maybe you can add an |
71a4d7e to
02ba86b
Compare
|
@kYc0o As we discussed on IRC, I have updated this PR to make this feature optional (in favor of code size, because the current boards/configuration doesn't make use of this feature). I did not make it configurable for each UART interface, since I think that if this is a desired feature, we should fix #5899. I opted for a solution that I can reuse to make other parts of EFM32 optional, like disabling support for low-power peripherals (if not used). So the last two commits may seem like a lot, I want to re-use them and provide a uniform interface/place for EFM32 specific features/toggles. Note that Murdock won't test the code, but if you manually test it and provide |
c6fc3c7 to
a4734cd
Compare
|
Ok, I think we're good here. You may squash. |
a4734cd to
be29e0a
Compare
|
Squashed and rebased. |
be29e0a to
6789c49
Compare
Contribution description
I need non-standard UART modes for some (KNX) transceivers that want 8E1. This PR adds them as an option to the
uart_configstruct, similar to how it was done for some Kinetis boards. The default remains 8N1, for both USART and LEUART.Conversion methods were added to Gecko-SDK (see this commit), which minimizes the changes in the RIOT code and provides a clean abstraction for both USART and LEUART.
Issues/PRs references
#5899, #7165