Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
boards/nrf52840-dk: add MX25 QSPI memory support
- Loading branch information
1 parent
cc7826d
commit 4f86a62
Showing
6 changed files
with
196 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# | ||
# This file is autogenerated: PLEASE DO NOT EDIT IT. | ||
# | ||
# You can use "make menuconfig" to make any modifications to the installed .config file. | ||
# You can then do "make savedefconfig" to generate a new defconfig file that includes your | ||
# modifications. | ||
# | ||
# CONFIG_ARCH_FPU is not set | ||
# CONFIG_NSH_DISABLE_IFCONFIG is not set | ||
# CONFIG_NSH_DISABLE_PS is not set | ||
CONFIG_ARCH="arm" | ||
CONFIG_ARCH_BOARD="nrf52840-dk" | ||
CONFIG_ARCH_BOARD_NRF52840_DK=y | ||
CONFIG_ARCH_CHIP="nrf52" | ||
CONFIG_ARCH_CHIP_NRF52840=y | ||
CONFIG_ARCH_CHIP_NRF52=y | ||
CONFIG_ARCH_STACKDUMP=y | ||
CONFIG_ARCH_STDARG_H=y | ||
CONFIG_BOARD_LOOPSPERMSEC=5500 | ||
CONFIG_DEBUG_SYMBOLS=y | ||
CONFIG_FS_LITTLEFS=y | ||
CONFIG_IDLETHREAD_STACKSIZE=2048 | ||
CONFIG_INIT_ENTRYPOINT="nsh_main" | ||
CONFIG_INIT_STACKSIZE=4098 | ||
CONFIG_MM_REGIONS=2 | ||
CONFIG_MTD=y | ||
CONFIG_MTD_MX25RXX=y | ||
CONFIG_NRF52_QSPI=y | ||
CONFIG_NRF52_UART0=y | ||
CONFIG_NSH_ARCHINIT=y | ||
CONFIG_NSH_FILEIOSIZE=512 | ||
CONFIG_NSH_LINELEN=64 | ||
CONFIG_NSH_READLINE=y | ||
CONFIG_PREALLOC_TIMERS=4 | ||
CONFIG_RAM_SIZE=65535 | ||
CONFIG_RAM_START=0x20000000 | ||
CONFIG_RAW_BINARY=y | ||
CONFIG_RR_INTERVAL=200 | ||
CONFIG_SCHED_WAITPID=y | ||
CONFIG_START_DAY=26 | ||
CONFIG_START_MONTH=3 | ||
CONFIG_SYMTAB_ORDEREDBYNAME=y | ||
CONFIG_SYSTEM_NSH=y | ||
CONFIG_TASK_NAME_SIZE=0 | ||
CONFIG_UART0_SERIAL_CONSOLE=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
/**************************************************************************** | ||
* boards/arm/nrf52/nrf52840-dk/src/nrf52_mx25.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 <stdio.h> | ||
#include <sys/types.h> | ||
|
||
#include <nuttx/fs/fs.h> | ||
#include <nuttx/mtd/mtd.h> | ||
#include <nuttx/spi/qspi.h> | ||
|
||
#include "nrf52_qspi.h" | ||
|
||
/**************************************************************************** | ||
* Public Functions | ||
****************************************************************************/ | ||
|
||
/**************************************************************************** | ||
* Name: nrf52_mx25_initialize | ||
* | ||
* Description: | ||
* Initialize the MX25RXX QSPI memeory | ||
* | ||
****************************************************************************/ | ||
|
||
int nrf52_mx25_initialize(void) | ||
{ | ||
struct qspi_dev_s *qspi_dev; | ||
struct mtd_dev_s *mtd_dev; | ||
char blockdev[32]; | ||
int ret = -1; | ||
|
||
/* Create an instance of the NRF52 QSPI device driver */ | ||
|
||
qspi_dev = nrf52_qspi_initialize(0); | ||
if (!qspi_dev) | ||
{ | ||
_err("nrf52_qspi_initialize() failed\n"); | ||
return -1; | ||
} | ||
|
||
_info("nrf52_qspi_initialize() successful\n"); | ||
|
||
/* Use the QSPI device instance to initialize the MX25 device */ | ||
|
||
mtd_dev = mx25rxx_initialize(qspi_dev, true); | ||
if (!mtd_dev) | ||
{ | ||
_err("mx25rxx_initialize() failed\n"); | ||
return -1; | ||
} | ||
|
||
/* Configure the device with no partition support */ | ||
|
||
snprintf(blockdev, sizeof(blockdev), "/dev/mtdqspi%d", 0); | ||
|
||
ret = register_mtddriver(blockdev, mtd_dev, 0755, NULL); | ||
if (ret != OK) | ||
{ | ||
_err("register_mtddriver() failed: %d\n", ret); | ||
return -1; | ||
} | ||
|
||
_info("register_mtddriver() successful\n"); | ||
|
||
#ifdef CONFIG_FS_LITTLEFS | ||
ret = nx_mount(blockdev, "/mnt/qspi", "littlefs", 0, NULL); | ||
if (ret < 0) | ||
{ | ||
ret = nx_mount(blockdev, "/mnt/qspi", "littlefs", 0, | ||
"forceformat"); | ||
if (ret < 0) | ||
{ | ||
_err("nx_mount() failed: %d\n", ret); | ||
} | ||
else | ||
{ | ||
_info("nx_mount() successful\n"); | ||
} | ||
} | ||
#endif | ||
|
||
return ret; | ||
} |