This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

LPUART nRF9160 - nRF52840

Hi,

we have troubles to use 4wire NRF LPUART between nRF52840 (client) and nRF9160 Serial LTE Modem app (server).

We use v1.5.1 of nRF Connect SDK.

For nRF9160 we added CONFIG_SLM_CONNECT_LPUART and modified slm_at_host.c.

nRF9160 prj.conf:

```

CONFIG_LOG=n
CONFIG_LOG_DEFAULT_LEVEL=3
CONFIG_STACK_SENTINEL=y
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
CONFIG_RING_BUFFER=y

CONFIG_USE_SEGGER_RTT=n
CONFIG_RTT_CONSOLE=n
CONFIG_UART_CONSOLE=n
CONFIG_LOG_BACKEND_RTT=n
CONFIG_LOG_BACKEND_UART=n

CONFIG_NETWORKING=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_NATIVE=n

CONFIG_NRF_MODEM_LIB=y
CONFIG_POSIX_MAX_FDS=8

CONFIG_GPIO=y
CONFIG_GPIO_NRFX=y
CONFIG_GPIO_NRF_P0=y

CONFIG_SERIAL=y
CONFIG_UART_ASYNC_API=y
CONFIG_NRFX_TIMER2=y

CONFIG_LTE_LINK_CONTROL=y
CONFIG_LTE_AUTO_INIT_AND_CONNECT=n

CONFIG_MAIN_STACK_SIZE=4096
CONFIG_HEAP_MEM_POOL_SIZE=16384
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096

CONFIG_DEVICE_POWER_MANAGEMENT=y

CONFIG_HTTP_PARSER_URL=y
CONFIG_FOTA_DOWNLOAD=y
CONFIG_FOTA_DOWNLOAD_PROGRESS_EVT=y
CONFIG_DFU_TARGET=y
CONFIG_DOWNLOAD_CLIENT=y
CONFIG_DOWNLOAD_CLIENT_STACK_SIZE=4096
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_IMG_MANAGER=y
CONFIG_FLASH=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y

CONFIG_SLM_LOG_LEVEL_INF=y
CONFIG_SLM_EXTERNAL_XTAL=n
CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2
CONFIG_SLM_DATAMODE_HWFC=n
CONFIG_SLM_CONNECT_LPUART=y

CONFIG_SLM_GPIO_WAKEUP=n

CONFIG_NRF_SW_LPUART=y

```
slm_at_host.c:
```
#if defined(CONFIG_SLM_CONNECT_LPUART)
    uart_dev = device_get_binding("LPUART");
#elif defined(CONFIG_SLM_CONNECT_UART_0)
    uart_dev = device_get_binding(DT_LABEL(DT_NODELABEL(uart0)));
#elif defined(CONFIG_SLM_CONNECT_UART_2)
    uart_dev = device_get_binding(DT_LABEL(DT_NODELABEL(uart2)));
#else
```
And some tweeks to compile.
Our board nrf9160 .dts contains:
```
...
&gpiote {
	status = "okay";
    /*
    interrupts = <13 NRF_DEFAULT_IRQ_PRIORITY>;
    */
};
...
&uart0 {
	compatible = "nordic,nrf-uarte";
	current-speed = <115200>;
	status = "okay";
    tx-pin = <21>;
    rx-pin = <22>;
    /delete-property/ hw-flow-control;
    /delete-property/ rts-pin;
    /delete-property/ cts-pin;
    lpuart: nrf-sw-lpuart {
            compatible = "nordic,nrf-sw-lpuart";
            status = "okay";
            label = "LPUART";
            req-pin = <23>;
            rdy-pin = <24>;
    };
};
``` 
Our board nRF52840 .dts contains:
```
...
&gpiote {
	status = "okay";
	interrupts = <6 NRF_DEFAULT_IRQ_PRIORITY>;
};
...
&uart0 {
	compatible = "nordic,nrf-uarte";
	status = "okay";
	current-speed = <115200>;
	tx-pin = <13>;
	rx-pin = <14>;
	/delete-property/ hw-flow-control;
	/delete-property/ rts-pin;
	/delete-property/ cts-pin;
	lpuart: nrf-sw-lpuart {
		compatible = "nordic,nrf-sw-lpuart";
		status = "okay";
		label = "LPUART";
		req-pin = <15>;
		rdy-pin = <16>;
	};
};

After nRF9160 power cycle nRF9160 consumes ~17uA on DK (i.e. without clock who is started by LPUART transaction), that is fine for us.
We use just AT+CFUN=0 for testing, we are getting only some OK responses, some are lost.
For longer command like AT%XSYSTEMMODE=0,1,0,0 we are getting sometimes ERROR response.

We are sure, that UART handling in nRF52840 is OK since it works with 2wire UART without troubles (no characters lost, no responses lost, no ERROR responses even with long data transfer commands).

In case of `interrupts = <13 NRF_DEFAULT_IRQ_PRIORITY` use on nRF9160, no responses at all.
How we can make LPUART with automatic clock on/off handling for AT transaqctions work fine between nRF52840 and nRF9160 please ?

Other observations:
With v1.6.0-rc2 SLM for nRF9160 does not compile with RTT disabled.
With v1.6.0-rc2 we do not get any response from nRF9160.
Thank you.

Parents
  • Hello, Michal!

    Thanks for reaching out. There are known issues with the LPUART driver on v1.5.1 of NCS, and several fixes should be present in v1.6.0-rc2. I will try to dig up the specific commits, but ideally you should move to the new release and then I can help you resolving the issues you have there.

    I just tested disabling RTT when build SLM on v1.6.0-rc2 without any issues. What kind of errors are you getting?

    Best regards,
    Carl Richard

Reply
  • Hello, Michal!

    Thanks for reaching out. There are known issues with the LPUART driver on v1.5.1 of NCS, and several fixes should be present in v1.6.0-rc2. I will try to dig up the specific commits, but ideally you should move to the new release and then I can help you resolving the issues you have there.

    I just tested disabling RTT when build SLM on v1.6.0-rc2 without any issues. What kind of errors are you getting?

    Best regards,
    Carl Richard

Children
No Data
Related