Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions arch/arm/src/nrf52/hardware/nrf52_twi.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@
#define NRF52_TWIM_RXDAMOUNT_OFFSET 0x053c /* Number of bytes transferred in the last RXD transaction */
#define NRF52_TWIM_RXDLIST_OFFSET 0x0540 /* RX EasyDMA list type */
#define NRF52_TWIM_TXDPTR_OFFSET 0x0544 /* TXD Data pointer */
#define NRF52_TWIM_TXMAXCNT_OFFSET 0x0548 /* Maximum number of bytes in TXD buffer */
#define NRF52_TWIM_TXAMOUNT_OFFSET 0x054c /* Number of bytes transferred in the last TXD transaction */
#define NRF52_TWIM_TXLIST_OFFSET 0x0550 /* TX EasyDMA list type */
#define NRF52_TWIM_TXDMAXCNT_OFFSET 0x0548 /* Maximum number of bytes in TXD buffer */
#define NRF52_TWIM_TXDAMOUNT_OFFSET 0x054c /* Number of bytes transferred in the last TXD transaction */
#define NRF52_TWIM_TXDLIST_OFFSET 0x0550 /* TX EasyDMA list type */
#define NRF52_TWIM_ADDRESS_OFFSET 0x0588 /* TWIM address */

/* Register offsets for TWI slave (TWIS) ************************************/
Expand Down Expand Up @@ -154,7 +154,7 @@

#define TWIM_FREQUENCY_100KBPS (0x01980000) /* 100 kbps */
#define TWIM_FREQUENCY_250KBPS (0x04000000) /* 250 kbps */
#define TWIM_FREQUENCY_400KBPS (0x06400000) /* 400 kbps */
#define TWIM_FREQUENCY_400KBPS (0x06200000) /* 400 kbps */

/* RXDMAXCNT Register */

Expand Down
5 changes: 4 additions & 1 deletion arch/arm/src/nrf52/nrf52_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
****************************************************************************/

#include <nuttx/config.h>
#include <nuttx/signal.h>

#include <assert.h>
#include <errno.h>
Expand Down Expand Up @@ -373,7 +374,9 @@ static int nrf52_i2c_transfer(struct i2c_master_s *dev,
/* Write number of bytes in TXD buffer */

regval = priv->dcnt;
nrf52_i2c_putreg(priv, NRF52_TWIM_TXMAXCNT_OFFSET, regval);
nrf52_i2c_putreg(priv, NRF52_TWIM_TXDMAXCNT_OFFSET, regval);

nxsig_usleep(1);

/* Start TX sequence */

Expand Down
5 changes: 3 additions & 2 deletions arch/arm/src/nrf52/nrf52_usbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3052,9 +3052,10 @@ static void nrf52_hwinitialize(struct nrf52_usbdev_s *priv)
{
/* Wait for VBUS */

/* TODO: connect to POWER USB events */

while (getreg32(NRF52_POWER_EVENTS_USBDETECTED) == 0);
/* Wait for both power applied and ready */

while ((getreg32(NRF52_POWER_USBREGSTATUS) & NRF52_POWER_USBREGSTATUS_VBUSDETECT) == 0) ;

/* Errata [187] USBD: USB cannot be enabled */

Expand Down
11 changes: 11 additions & 0 deletions boards/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,13 @@ config ARCH_BOARD_NRF52840_DONGLE
---help---
This option selects the Nordic nRF52840 Dongle (PCA10059)

config ARCH_BOARD_ARDUINO_NANO_33BLE
bool "Arduino Nano 33 BLE Sense based on Nordic nRF52840"
depends on ARCH_CHIP_NRF52
select ARCH_HAVE_LEDS
---help---
Arduino Nano 33 BLE Sense based on Nordic nRF52840

config ARCH_BOARD_THINGY52
bool "Nordic Thingy:52 Prototyping platform"
depends on ARCH_CHIP_NRF52
Expand Down Expand Up @@ -2865,6 +2872,7 @@ config ARCH_BOARD
default "arduino-mega2560" if ARCH_BOARD_ARDUINO_MEGA2560
default "arduino-due" if ARCH_BOARD_ARDUINO_DUE
default "arduino-m0" if ARCH_BOARD_ARDUINO_M0
default "arduino-nano-33ble" if ARCH_BOARD_ARDUINO_NANO_33BLE
default "arty_a7" if ARCH_BOARD_ARTY_A7
default "avr32dev1" if ARCH_BOARD_AVR32DEV1
default "axoloti" if ARCH_BOARD_AXOLOTI
Expand Down Expand Up @@ -3429,6 +3437,9 @@ endif
if ARCH_BOARD_ARDUINO_M0
source "boards/arm/samd2l2/arduino-m0/Kconfig"
endif
if ARCH_BOARD_ARDUINO_NANO_33BLE
source "boards/arm/nrf52/arduino-nano-33ble/Kconfig"
endif
if ARCH_BOARD_CIRCUIT_EXPRESS
source "boards/arm/samd2l2/circuit-express/Kconfig"
endif
Expand Down
3 changes: 3 additions & 0 deletions boards/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,9 @@ boards/hc/mcs92s12ne6/ne64badge
STATUS: Under development. The port is code-complete but has
not yet been fully tested.

boards/arm/nrf52/arduino-nano-33ble
NuttX port to the Arduino Nano 33 BLE Sense board

boards/arm/nrf52/nrf52-feather
NuttX port to the Adafruit nRF52832 Feather board

Expand Down
21 changes: 21 additions & 0 deletions boards/arm/nrf52/arduino-nano-33ble/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# ##############################################################################
# boards/arm/nrf52/arduino-nano-33ble/CMakeLists.txt
#
# 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.
#
# ##############################################################################

add_subdirectory(src)
8 changes: 8 additions & 0 deletions boards/arm/nrf52/arduino-nano-33ble/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#
# For a description of the syntax of this configuration file,
# see the file kconfig-language.txt in the NuttX tools repository.
#

if ARCH_BOARD_ARDUINO_NANO_33BLE

endif
41 changes: 41 additions & 0 deletions boards/arm/nrf52/arduino-nano-33ble/configs/nsh/defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#
# 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="arduino-nano-33ble"
CONFIG_ARCH_BOARD_ARDUINO_NANO_33BLE=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_FAT_LCNAMES=y
CONFIG_FAT_LFN=y
CONFIG_FS_FAT=y
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_MM_REGIONS=2
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
45 changes: 45 additions & 0 deletions boards/arm/nrf52/arduino-nano-33ble/configs/usbnsh/defconfig
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_DEV_CONSOLE is not set
# CONFIG_SYSLOG_DEFAULT is not set
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="arduino-nano-33ble"
CONFIG_ARCH_BOARD_ARDUINO_NANO_33BLE=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_BOARDCTL_USBDEVCTRL=y
CONFIG_BOARD_LOOPSPERMSEC=5500
CONFIG_BUILTIN=y
CONFIG_CDCACM=y
CONFIG_CDCACM_CONSOLE=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_EXAMPLES_HELLO=y
CONFIG_IDLETHREAD_STACKSIZE=2048
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_MM_REGIONS=2
CONFIG_NRF52_HFCLK_XTAL=y
CONFIG_NRF52_USBDEV=y
CONFIG_NSH_ARCHINIT=y
CONFIG_NSH_BUILTIN_APPS=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_SYSTEM_NSH=y
120 changes: 120 additions & 0 deletions boards/arm/nrf52/arduino-nano-33ble/include/board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
/****************************************************************************
* boards/arm/nrf52/arduino-nano-33ble/include/board.h
*
* 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.
*
****************************************************************************/

#ifndef __BOARDS_ARM_NRF52_ARDUINO_NANO_33BLE_INCLUDE_BOARD_H
#define __BOARDS_ARM_NRF52_ARDUINO_NANO_33BLE_INCLUDE_BOARD_H

/****************************************************************************
* Included Files
****************************************************************************/

#include <nuttx/config.h>
#include <stdbool.h>

#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_NRF52_GPIOTE)
# include <nuttx/irq.h>
#endif

/****************************************************************************
* Pre-processor Definitions
****************************************************************************/

/* Clocking *****************************************************************/

#define BOARD_SYSTICK_CLOCK (64000000)

/* LED definitions **********************************************************/

/*
* LED index values for use with board_userled()
*/

#define BOARD_LED1 0
#define BOARD_LED2 1
#define BOARD_LED3 2
#define BOARD_LED4 3
#define BOARD_LED5 4
#define BOARD_NLEDS 5

/* LED bits for use with board_userled_all() */

#define BOARD_LED1_BIT (1 << BOARD_LED1)
#define BOARD_LED2_BIT (1 << BOARD_LED2)
#define BOARD_LED3_BIT (1 << BOARD_LED3)
#define BOARD_LED4_BIT (1 << BOARD_LED4)
#define BOARD_LED5_BIT (1 << BOARD_LED5)

/* If CONFIG_ARCH_LEDS is defined, the LED will be controlled as follows
* for NuttX debug functionality.
*/

#define LED_STARTED 0
#define LED_HEAPALLOCATE 1
#define LED_IRQSENABLED 2
#define LED_STACKCREATED 3
#define LED_INIRQ 4
#define LED_SIGNAL 5
#define LED_ASSERTION 6
#define LED_PANIC 7

/* If CONFIG_ARCH_LEDS is not defined, then the LEDs are completely under
* control of the application. The following interfaces are then available
* for application control of the LEDs:
*
* uint32_t board_userled_initialize(void);
* void board_userled(int led, bool ledon);
* void board_userled_all(uint32_t ledset);
*/

/* Button definitions *******************************************************/

/* Board supports no buttons. */

#define NUM_BUTTONS 0

/* UART Pins ****************************************************************/

/* The following definitions must be provided so that the NRF52 serial
* driver can set up the UART for the serial console properly.
*/

#define BOARD_UART0_RX_PIN (GPIO_INPUT | GPIO_PORT1 | GPIO_PIN(10))
#define BOARD_UART0_TX_PIN (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT1 | GPIO_PIN(3))

/* I2C Pins *****************************************************************/

/* I2C0 (TWI0) - Internal I2C
* I2C0_SCL - P0.15
* I2C0_SDA - P0.14
*/

#define BOARD_I2C0_SCL_PIN (GPIO_OUTPUT | GPIO_PORT0 | GPIO_PIN(15))
#define BOARD_I2C0_SDA_PIN (GPIO_INPUT | GPIO_PORT0 | GPIO_PIN(14))
#define BOARD_I2C0_PULLUP_PIN (GPIO_OUTPUT | GPIO_VALUE_ONE | GPIO_PORT1 | GPIO_PIN(0))

/* I2C1 (TWI1) - External I2C
* I2C1_SCL - P0.2
* I2C1_SDA - P0.31
*/

#define BOARD_I2C1_SCL_PIN (GPIO_OUTPUT | GPIO_PORT0 | GPIO_PIN(2))
#define BOARD_I2C1_SDA_PIN (GPIO_INPUT | GPIO_PORT0 | GPIO_PIN(31))

#endif /* __BOARDS_ARM_NRF52_ARDUINO_NANO_33BLE_INCLUDE_BOARD_H */
39 changes: 39 additions & 0 deletions boards/arm/nrf52/arduino-nano-33ble/scripts/Make.defs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
############################################################################
# boards/arm/nrf52/arduino-nano-33ble/scripts/Make.defs
#
# 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.
#
############################################################################

include $(TOPDIR)/.config
include $(TOPDIR)/tools/Config.mk
include $(TOPDIR)/arch/arm/src/armv7-m/Toolchain.defs

LDSCRIPT = flash_config.ld
ARCHSCRIPT += $(BOARD_DIR)$(DELIM)scripts$(DELIM)$(LDSCRIPT)

ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10

CFLAGS := $(ARCHCFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS)
CXXFLAGS := $(ARCHCXXFLAGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS) -pipe
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
CPPFLAGS := $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRAFLAGS)
AFLAGS := $(CFLAGS) -D__ASSEMBLY__

NXFLATLDFLAGS1 = -r -d -warn-common
NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections
LDNXFLATFLAGS = -e main -s 2048
Loading