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
drivers: uart: Add low power uart module #2591
Conversation
All checks are passing now. checkpatch (informational only, not a failure)
Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages. |
7b8545c
to
eeee391
Compare
drivers/uart/Kconfig
Outdated
config NRF_LPUART_REQ_PIN | ||
int "Transfer request pin" | ||
default 0 | ||
|
||
config NRF_LPUART_RDY_PIN | ||
int "Receiver ready pin" | ||
default 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not define those pins in dts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's where border between kconfig is unclear. I could create something build on top or uart as a bus. As for now, ncs has only dts/bindings/sensor
and dts/bindings/net
and lpuart does not fit there. I could add something like dts/bindings/serial/nordic,nrf-lpuart.yaml
but then it suggests as if that is a hw peripheral. What if some next gen SoC gets low power uart?
@anangl @Mierunski what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
software pwm is defined in nordic,nrf-sw-pwm.yaml
, how about adding nordic,nrf-sw-lpuart.yaml
which would extend standard uart?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved to DT
samples/peripheral/lpuart/README.rst
Outdated
Overview | ||
******** | ||
|
||
Sample implements simple loopback using single UART instance.Sample by default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
samples/peripheral/lpuart/README.rst
Outdated
* |nRF52840DK| | ||
* |nRF9160DK| | ||
|
||
* Pins shortend |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shorted or connected, same below in line 34
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
drivers/uart/uart_nrf_lpuart.c
Outdated
data->rx_state = RX_ACTIVE; | ||
} | ||
|
||
/* Called when end of transfer is detected. It sets resposnse pin to idle and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
response
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@nordic-krch this seems to use the standard UART API, so is there a reason why this is downstream? |
@anangl can you take a look please? |
@carlescufi It is not standard uart (custom pin protocol) and multiple customers is asking for this and zephyr means longer review and more time till it is supported by ncs (upmerge). Because of that I put it here but there is no long term obstacles. I can as well move downstram (now or later). |
f507070
to
c5721ae
Compare
@greg-fer can you take o look or add other doc reviewer? |
6f1b8bb
to
cabc866
Compare
This comment has been minimized.
This comment has been minimized.
1871457
to
ec57439
Compare
@anangl thanks for comments, please recheck. |
samples/peripheral/lpuart/README.rst
Outdated
:start-after: set18_start | ||
:end-before: set18_end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't these two be set22_start
and set22_end
, respectively?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well spotted. fixed
One more detail: the commit title "drivers: uart: Add low power uart module" should actually start with "drivers: serial:". |
c9b08a2
to
63e66fa
Compare
drivers/serial/uart_nrf_sw_lpuart.c
Outdated
#define GPIO(id) DT_NODELABEL(gpio##id) | ||
|
||
#define GET_PORT(pin_prop) \ | ||
COND_CODE_1(DT_NODE_EXISTS(DT_INST(1, nordic_nrf_gpio)), \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
COND_CODE_1(DT_NODE_EXISTS(DT_INST(1, nordic_nrf_gpio)), \ | |
COND_CODE_1(DT_NODE_EXISTS(GPIO(1)), \ |
drivers/serial/uart_nrf_sw_lpuart.c
Outdated
.pin = (DT_INST_PROP(0, pin_prop) >= 32) ? \ | ||
(DT_INST_PROP(0, pin_prop) - 32) : DT_INST_PROP(0, pin_prop), \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.pin = (DT_INST_PROP(0, pin_prop) >= 32) ? \ | |
(DT_INST_PROP(0, pin_prop) - 32) : DT_INST_PROP(0, pin_prop), \ | |
.pin = (DT_INST_PROP(0, pin_prop) & 0x1F), \ |
a09497e
to
6d7cdbf
Compare
@utzig can you review changes in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
c044bae
to
a2a5c69
Compare
Apart from all of the recent wackiness of the CI, this particular error in the previous doc build looks like a valid one:
But we need some doc expert to interpret this. |
it states:
But this PR does not modify line 13 of this file and line 13 looks perfectly normal Now it is again:
|
There is a backquote missing here in line 322 of this file: |
Low power UART implements UART asynchronous API and is using 2 additional pins to control the transfer. Based on pin status receiver can be disabled during idle phase. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Added documentation for low power UART module. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Sample application used to sanity check low power uart and measure power consumption. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Added nordic-krch as sample codeowner. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Adding DTS lexer. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
@b-gent thanks for pointing it out. |
The CI failures are unrelated to this PR, merging. |
Low Power UART is a driver which implements standard asynchronous UART API and uses two control lines (instead
of standard hardware flow control lines) protocol to allow disabling UART receiver during idle period. This allows achieving low power consumption since high frequency clock (required when UART receiver is enabled) can be shut down when UART is in idle.
PR provides driver and sample.
See documentation for operation details.
I'm planning to add test in additional PR.
Primary use case is to use it for HCI communication between nrf52 and nrf91.