This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit c53211afb950762d2dca385e71dec294cbd951dc
Author: raiden00pl <[email protected]>
AuthorDate: Thu Nov 16 14:15:43 2023 +0100

    boards/nrf9160-dk: add board specific modem configuration
---
 boards/arm/nrf91/nrf9160-dk/src/CMakeLists.txt  |  4 ++
 boards/arm/nrf91/nrf9160-dk/src/Make.defs       |  4 ++
 boards/arm/nrf91/nrf9160-dk/src/nrf91_bringup.c |  4 ++
 boards/arm/nrf91/nrf9160-dk/src/nrf91_modem.c   | 68 +++++++++++++++++++++++++
 4 files changed, 80 insertions(+)

diff --git a/boards/arm/nrf91/nrf9160-dk/src/CMakeLists.txt 
b/boards/arm/nrf91/nrf9160-dk/src/CMakeLists.txt
index 8996928853..2f6e5a0335 100644
--- a/boards/arm/nrf91/nrf9160-dk/src/CMakeLists.txt
+++ b/boards/arm/nrf91/nrf9160-dk/src/CMakeLists.txt
@@ -34,6 +34,10 @@ if(CONFIG_ARCH_BUTTONS)
   list(APPEND SRCS nrf91_buttons.c)
 endif()
 
+if(CONFIG_NRF91_MODEM)
+  list(APPEND SRCS nrf91_modem.c)
+endif()
+
 target_sources(board PRIVATE ${SRCS})
 
 if(CONFIG_ARCH_BOARD_COMMON)
diff --git a/boards/arm/nrf91/nrf9160-dk/src/Make.defs 
b/boards/arm/nrf91/nrf9160-dk/src/Make.defs
index d9c8b7b122..124d9b6c72 100644
--- a/boards/arm/nrf91/nrf9160-dk/src/Make.defs
+++ b/boards/arm/nrf91/nrf9160-dk/src/Make.defs
@@ -36,6 +36,10 @@ ifeq ($(CONFIG_ARCH_BUTTONS),y)
 CSRCS += nrf91_buttons.c
 endif
 
+ifeq ($(CONFIG_NRF91_MODEM),y)
+CSRCS += nrf91_modem.c
+endif
+
 DEPPATH += --dep-path board
 VPATH += :board
 CFLAGS += 
${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board
diff --git a/boards/arm/nrf91/nrf9160-dk/src/nrf91_bringup.c 
b/boards/arm/nrf91/nrf9160-dk/src/nrf91_bringup.c
index fba6aad4ab..be35cca11f 100644
--- a/boards/arm/nrf91/nrf9160-dk/src/nrf91_bringup.c
+++ b/boards/arm/nrf91/nrf9160-dk/src/nrf91_bringup.c
@@ -46,6 +46,10 @@
 #  include "nrf91_modem_at.h"
 #endif
 
+#ifdef CONFIG_NRF91_MODEM_GNSS
+#  include "nrf91_modem_gnss.h"
+#endif
+
 #ifdef CONFIG_NRF91_PROGMEM
 #  include "nrf91_progmem.h"
 #endif
diff --git a/boards/arm/nrf91/nrf9160-dk/src/nrf91_modem.c 
b/boards/arm/nrf91/nrf9160-dk/src/nrf91_modem.c
new file mode 100644
index 0000000000..5f0372f679
--- /dev/null
+++ b/boards/arm/nrf91/nrf9160-dk/src/nrf91_modem.c
@@ -0,0 +1,68 @@
+/****************************************************************************
+ * boards/arm/nrf91/nrf9160-dk/src/nrf91_modem.c
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <debug.h>
+
+#include "nrf_modem_at.h"
+#include "nrf91_modem.h"
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: nrf91_modem_board_init
+ ****************************************************************************/
+
+int nrf91_modem_board_init(void)
+{
+  int ret;
+
+  /* Configure COEX0 pin - on-board antena */
+
+  ret = nrf_modem_at_printf("AT%%XCOEX0=1,1,1565,1586");
+  if (ret < 0)
+    {
+      nerr("AT%%XCOEX0 config failed %d", ret);
+      goto errout;
+    }
+
+  /* Configure MAGPIO pins */
+
+  ret = nrf_modem_at_printf("AT%%XMAGPIO=1,0,0,1,1,1574,1577");
+  if (ret < 0)
+    {
+      nerr("AT%%XMAGPIO config failed %d", ret);
+      goto errout;
+    }
+
+errout:
+  return ret;
+}

Reply via email to