I need to use High Drive Strength of pin used as TX of UART. How may it be done using zephyr ?
I need to use High Drive Strength of pin used as TX of UART. How may it be done using zephyr ?
Try using the field nordic,drive-mode like it's done in nrf/boards/arm/nrf5340_audio_dk_nrf5340/nrf5340_audio_dk_nrf5340_cpuapp_common-pinctrl.dtsi. Set it to any of the modes defined in nrf-pinctrl.h
Best regards,
Simon
is it to be set in Overlay file or at the time of Initialization of pin using DT_GET_.... ? Please, write as per example
I think it should be enough setting it in the overlay, then I think the uart driver will set the drive through uart_nrfx_uarte.c-->pinctrl_apply_state()-->pinctrl_configure_pins() at boot.
Try reading the PIN_CNF-->DRIVE register after booting up and see if it's set correctly. You can read it from main() or just through nrfjprog.
For example if you're reading GPIO pin 0 (nonsecure), you read from address 0x40842500 (nonsecure) + 0x200 + (0 (P0.0) × 0x4) = 0x40842700
nrfjprog --memrd 0x40842700 --n 4
Best regards,
Simon
pls explain how to write in overlay ?
Add the following to an overlay file nrf9160dk_nrf9160_ns.overlay:
&pinctrl { uart0_default: uart0_default { group1 { psels = <NRF_PSEL(UART_TX, 0, 29)>, <NRF_PSEL(UART_RTS, 0, 27)>; nordic,drive-mode = <NRF_DRIVE_H0H1>; }; group2 { psels = <NRF_PSEL(UART_RX, 0, 28)>, <NRF_PSEL(UART_CTS, 0, 26)>; bias-pull-up; nordic,drive-mode = <NRF_DRIVE_H0H1>; }; }; };
I tested this with the hello world sample attached below:
I built it with NCS v2.0.0 and the board nrf9160dk_nrf9160_ns. After flashing it to the board, I read the PIN_CNF of P0.29 (uart TX), and got the following result:
@$ nrfjprog --memrd 0x40842774 --n 4 0x40842774: 00000303 |....|
0x303 is 0011 0000 0011 in binary, and if you look at PIN_CNF, you can see that 11 (3 in decimal) on position 8 and 9 corresponds to H0H1:
Best regards,
Simon