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

how to interface external MCU host viaUART interface with nrf9160, with only 3 pins from UART (RD,TX,GND)

We would like to use nRF9160 has MODEM only feature, such that MCU in our product can talk to nRF9160 via UART interface.

We have found an sample application [Serial LTE Modem] that comes with nRFConnect SDK , we would need to use this application with following constraint

We have UART TX , UART RX and GND ( 3 signals ) and do not have provision for CTS/RTS or any other additional GPIO for interface MODEM(nRF9160) and our UART I/O signal TTL level is 3.3V

Is this possible to accomplish the same with the sample application [Serial LTE Modem]. 

External Com port ( 115200 bps, 8N1) , 

Pin connection between nrf9160 and 3.3v ttl-uart-usb cable connected to pc

 1. ( P0.11(RX) to usb to TTL cable (TX))

2. (P0.10(TX) to usb to TTL cable (RX))

3. Common ground 

In serial lte modem app .proj file modified to enable  Uart2 based macros and disabled the UART 0 based macro.

Note: I/O switch is kept at 3.3v side

Still couldn't get response for AT commands.

Please let me know is there is a steps to configure UART 2 with no flow control and no additional gpio .

I am using segger embedded studio.

With Best Regards,

Ilanchezhian T

Parents Reply
  • 1. Assume that the modem and application on nRF9160 normally takes responsibility for sleeping whenever there is nothing to do. 

    2. Please refer to Power saving #XSLEEP. #XSLEEP has three options, so the host may put nRF9160 to idle, sleep, or only put the UART to sleep.

    • When the host MCU wants to wake up the UART, use the GPIO.
    • When the host MCU wants to turn off the UART, send AT#XSLEEP=2 to put the UART only to sleep.

    The UART consumes around 700µA so it should be put to sleep whenever possible. After eDRX/PSM is requested, it is important to verify that this is accepted by the network. XMODEMSLEEP is useful for synchronizing sleep and wake-ups when optimizing power consumption. 

Children
  • Hi Helsing, I am trying to put UART in sleep mode  using AT#XSLEEP=2.  I could see that If I put breakpoint  uart power on and uart powerOFF function  of SLM sample application this features works and if I remove the breakpoint is  not working. 

    My Observation: 

    UART 0 is enabled and UART2 is disabled 

    Breakpoint is placed at uart power on() and uart power off() function 

    provide the command AT#XSLEEP=2, break point hit in uart power off () function , run the progam

    Pressed Button 0 in the nrf9160 board , break point hit on the uart power on () function , run the program

    provide Any uart command it works 

    BUT IF I REMOVE the breakpoints and do the same it is not working as expected , in fact nothing happens, what is that i am doing wrong. 

    Please find the Link monitor terminal logs and screen shots attached for further investigation.  break points

    2021-09-22T15:03:41.181Z INFO Application data folder: C:\Users\h438415\AppData\Roaming\nrfconnect\pc-nrfconnect-linkmonitor
    2021-09-22T15:03:41.220Z DEBUG App pc-nrfconnect-linkmonitor v1.1.10 official
    2021-09-22T15:03:41.221Z DEBUG App path: C:\Users\h438415\.nrfconnect-apps\node_modules\pc-nrfconnect-linkmonitor
    2021-09-22T15:03:41.221Z DEBUG nRFConnect 3.7.0, required by the app is (^3.6.0)
    2021-09-22T15:03:41.221Z DEBUG nRFConnect path: C:\Users\h438415\AppData\Local\Programs\nrfconnect\resources\app.asar
    2021-09-22T15:03:41.221Z DEBUG HomeDir: C:\Users\h438415
    2021-09-22T15:03:41.221Z DEBUG TmpDir: C:\Users\h438415\AppData\Local\Temp
    2021-09-22T15:03:43.584Z INFO Modem port is opened
    2021-09-22T15:03:43.593Z DEBUG modem >> AT+CFUN?
    2021-09-22T15:03:43.623Z DEBUG modem << +CFUN: 0
    2021-09-22T15:03:43.626Z DEBUG modem << OK
    2021-09-22T15:04:05.402Z DEBUG modem >> AT+CGDCONT=0,"IP","default"
    2021-09-22T15:04:05.418Z DEBUG modem << OK
    2021-09-22T15:04:10.754Z DEBUG modem >> AT+CFUN=1
    2021-09-22T15:04:10.797Z DEBUG modem << OK
    2021-09-22T15:04:26.826Z DEBUG modem >> AT+CGPADDR=0
    2021-09-22T15:04:26.841Z DEBUG modem << +CGPADDR: 0,"192.168.2.26"
    2021-09-22T15:04:26.845Z DEBUG modem << OK
    2021-09-22T15:04:41.979Z DEBUG modem >> AT#XSLEEP=2
    2021-09-22T15:04:42.981Z ERROR Error: 'AT#XSLEEP=2
    ' timed out
    2021-09-22T15:05:01.466Z DEBUG modem << Ready
    2021-09-22T15:05:10.495Z DEBUG modem >> AT
    2021-09-22T15:05:10.508Z DEBUG modem << OK
    2021-09-22T15:05:30.490Z DEBUG modem >> AT+CGPADDR=0
    2021-09-22T15:05:30.507Z DEBUG modem << +CGPADDR: 0,"192.168.2.26"
    2021-09-22T15:05:30.509Z DEBUG modem << OK
    2021-09-22T15:05:38.747Z DEBUG modem >> AT+CFUN=0
    2021-09-22T15:05:39.747Z ERROR Error: 'AT+CFUN=0
    ' timed out
    2021-09-22T15:05:40.986Z DEBUG modem << OK
    2021-09-22T15:05:47.680Z DEBUG modem >> AT+CFUN=1
    2021-09-22T15:05:47.726Z DEBUG modem << OK
    2021-09-22T15:06:15.688Z DEBUG modem >> AT#XSLEEP=2
    2021-09-22T15:06:16.690Z ERROR Error: 'AT#XSLEEP=2
    ' timed out
    2021-09-22T15:06:33.895Z DEBUG modem << Ready
    2021-09-22T15:06:47.916Z DEBUG modem >> AT
    2021-09-22T15:06:47.923Z DEBUG modem << OK
    2021-09-22T15:07:00.236Z DEBUG modem >> AT#XSLEEP=2
    2021-09-22T15:07:04.626Z DEBUG modem << Ready
    

    Thanks  

    Ilan 

  • Hi Ilan,

    Have you made any modifications to SLM? Have you enabled any configs or implemented the changes related to disabling flow control?

    I am not seeing this when I am testing SLM myself. I tested without any breakpoints, and when I press the button, I can see 'Ready' appear in LTE Link Monitor:

    Would you be able to share your project files?

    Best regards,

    Håkon

  • Hi again,

    It looks like I have been able to reproduce this, and we might have a workaround.

    Ilanchezhian T said:
    BUT IF I REMOVE the breakpoints and do the same it is not working as expected , in fact nothing happens, what is that i am doing wrong. 

    Exactly what is not working? Is the board not waking up? Are you able to send more AT commands? If you are not able to send anything it could be that LTE Link Monitor is failing.

    I have been able to reproduce similar behavior where LTE Link Monitor stops working after the breakpoints are removed.

    Could you please try debugging the board without LTE Link Monitor and switch to a dedicated serial output terminal? Here are the settings that worked on my side. Please note that you might need to select a different COM-port on your side. I have flow control enabled as I am using SLM out of the box.

    Below shows the use of AT#XSLEEP=2 and wake up by button.

    Please let me know if this works on your side. Is this a satisfying workaround at this stage? The issue you reported is is possibly a corner case related to LTE Link Monitory. Hopefully, you should be able to used LTE Link Monitor going forward with your project.

  • Hi Helsing, 

    Thanks for your reply.

    Thanks for confirming that  for me LTE link monitor stopped sending anything after issuing sleep AT command and pressing the wake up button. 

    I am confused what is COM8 in your case , is it the one of the enumerated port of Jlink ?.

    If that is the case  in my case it is as COM45, 46, 47 , I tried  in all ports but it is not working , it is not able to read the Ready message which used to appear when the modem gets powered ON.

    But Anyway , If I am using it has the external host interface where instead of using the UART0 ,using UART2 I could able to successfully sleep using AT#XSLEEP=2 command and  wakeup using the port pin P0.31. This works with both Debug as well as run mode. 

    Right now our use case is to have MCU to have external uart communication, But you can still suggest if I do need to test. 

    With Regards

    Ilanchezhian T 

  • Hi Ilanchezhian 

    Håkon is currently out of office, and I will assist in the mean time. 

    Ilanchezhian T said:
    I am confused what is COM8 in your case , is it the one of the enumerated port of Jlink ?.

    This should be one of the three comports enumerated by the nRF9160DK, yes. I will confirm this when he is available. 

    Ilanchezhian T said:
    But Anyway , If I am using it has the external host interface where instead of using the UART0 ,using UART2 I could able to successfully sleep using AT#XSLEEP=2 command and  wakeup using the port pin P0.31. This works with both Debug as well as run mode. 

    If I understand you correctly you can not get it to work if you try to use UART0 with default settings, but it works if you use UART2 and route the pins from the nRF9160DK to the external uart-ttl-usb device?

    Or are you using your own custom hardware rather than the DK?

    COM45, 46, 47 in your case should be connected to the nRF9160 on the DK, and would not be connected to the nRF9160 on your own board. 

    Best regards
    Torbjørn

Related