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

UART, custom and AT commands

Hi,

I have been trying to get UART working properly on my custom board but also on nRF9160 DK. I'm using only UART_0.

With CONFIG_USE_AT_HOST and without any uart code inside my own code, AT commands are working but if I wrote something else like "hi" to terminal, the device is giving a HARD FAULT.

hi
[0[00:01:23.622,528] [1B][1;31m<err> os: ***** HARD FAULT *****[1B][0m
[00:01:23.628,143] [1B][1;31m<err> os:   Fault escalation (see below)[1B][0m
[00:01:23.634,399] [1B][1;31m<err> os: ***** USAGE FAULT *****[1B][0m
[00:01:23.640,045] [1B][1;31m<err> os:   Stack overflow (context area not valid)[1B][0m
[00:01:23.647,216] [1B][1;31m<err> os: r0/a1:  0x2002c600  r1/a2:  0x00000001  r2/a3:  0x20027506[1B][0m
[00:01:23.655,883] [1B][1;31m<err> os: r3/a4:  0x2002c600 r12/ip:  0x000253a9 r14/lr:  0x000252f3[1B][0m
[00:01:23.664,550] [1B][1;31m<err> os:  xpsr:  0x00028e00[1B][0m
[00:01:23.669,769] [1B][1;31m<err> os: s[ 0]:  0x00000000  s[ 1]:  0x00000000  s[ 2]:  0x00000000  s[ 3]:  0x00000000[1B][0m
[00:01:23.680,175] [1B][1;31m<err> os: s[ 4]:  0x00000000  s[ 5]:  0x00000000  s[ 6]:  0x00000000  s[ 7]:  0x00000000[1B][0m
[00:01:23.690,612] [1B][1;31m<err> os: s[ 8]:  0x00000000  s[ 9]:  0x00000000  s[10]:  0x00000000  s[11]:  0x00000000[1B][0m
[00:01:23.701,019] [1B][1;31m<err> os: s[12]:  0x00000000  s[13]:  0x00000000  s[14]:  0x00000000  s[15]:  0x00000000[1B][0m
[00:01:23.711,456] [1B][1;31m<err> os: fpscr:  0x000109b1[1B][0m
[00:01:23.716,674] [1B][1;31m<err> os: Faulting instruction address (r15/pc): 0x2002c600[1B][0m
[00:01:23.724,548] [1B][1;31m<err> os: >>> ZEPHYR FATAL ERROR 2: Stack overflow on CPU 0[1B][0m
[00:01:23.732,421] [1B][1;31m<err> os: Current thread: 0x200229b0 (unknown)[1B][0m
Running main.c error handlerError of type ERROR_SYSTEM_FAULT: 2

With uart code from https://github.com/Rallare/fw-nrfconnect-nrf/blob/nrf9160_samples/samples/nrf9160/uart/ inside my own code, I'm able to write whatever I want to terminal and it echoes that back from uart_cb(). But AT commands are NOT working, the code is understanding them as just similar text like "hi" and is echoing them back and not doing anything with the modem.

So, do you have any idea how should I make them work together? My goal is to give my own commands but also AT commands to the device with only one UART peripheral.

Regards,
Tero

Related