Skip to content

Commit 87bc6de

Browse files
author
Jamie Smith
authored
Add Arduino Nicla Sense ME support (ARMmbed#271)
* Port over Nicla Sense ME arduino target * Re-add button1 * Fix missing licenses, fix I2C assignment, fix LoRa module descriptions
1 parent 9711f6f commit 87bc6de

File tree

11 files changed

+340
-26
lines changed

11 files changed

+340
-26
lines changed

drivers/source/PwmOut.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ void PwmOut::resume()
142142
core_util_critical_section_enter();
143143
if (!_initialized) {
144144
PwmOut::init();
145-
PwmOut::write(_duty_cycle);
146145
PwmOut::period_us(_period_us);
146+
PwmOut::write(_duty_cycle);
147147
}
148148
core_util_critical_section_exit();
149149
}

storage/blockdevice/COMPONENT_SPIF/mbed_lib.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@
6767
"SPI_MISO": "SPI3_MISO",
6868
"SPI_CLK": "SPI3_SCK",
6969
"SPI_CS": "SPI_CS1"
70-
}
70+
},
71+
"ARDUINO_NICLA_SENSE_ME": {
72+
"SPI_CS": "CS_FLASH"
73+
}
7174
}
7275
}

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
add_library(mbed-nrf52-dk INTERFACE)
55
add_library(mbed-sdt52832b INTERFACE)
6+
add_library(mbed-arduino-nicla-sense-me INTERFACE)
67

78
target_include_directories(mbed-nrf52-dk
89
INTERFACE
@@ -14,6 +15,12 @@ target_include_directories(mbed-sdt52832b
1415
TARGET_SDT52832B
1516
)
1617

18+
target_include_directories(mbed-arduino-nicla-sense-me
19+
INTERFACE
20+
TARGET_ARDUINO_NICLA_SENSE_ME
21+
)
22+
23+
1724
if(${MBED_TOOLCHAIN} STREQUAL "ARM")
1825
set(LINKER_FILE device/TOOLCHAIN_ARM_STD/nRF52832.sct)
1926
set(STARTUP_FILE device/TOOLCHAIN_ARM_STD/startup_nrf52832.S)
@@ -46,3 +53,4 @@ mbed_set_linker_script(mbed-mcu-nrf52832 ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FI
4653
target_link_libraries(mbed-mcu-nrf52832 INTERFACE mbed-nrf52 mbed-sdk-15-0)
4754
target_link_libraries(mbed-nrf52-dk INTERFACE mbed-mcu-nrf52832)
4855
target_link_libraries(mbed-sdt52832b INTERFACE mbed-mcu-nrf52832)
56+
target_link_libraries(mbed-arduino-nicla-sense-me INTERFACE mbed-mcu-nrf52832)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
/*
2+
* Copyright (c) 2016 Nordic Semiconductor ASA
3+
* All rights reserved.
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*
6+
* Redistribution and use in source and binary forms, with or without modification,
7+
* are permitted provided that the following conditions are met:
8+
*
9+
* 1. Redistributions of source code must retain the above copyright notice, this list
10+
* of conditions and the following disclaimer.
11+
*
12+
* 2. Redistributions in binary form, except as embedded into a Nordic Semiconductor ASA
13+
* integrated circuit in a product or a software update for such product, must reproduce
14+
* the above copyright notice, this list of conditions and the following disclaimer in
15+
* the documentation and/or other materials provided with the distribution.
16+
*
17+
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its contributors may be
18+
* used to endorse or promote products derived from this software without specific prior
19+
* written permission.
20+
*
21+
* 4. This software, with or without modification, must only be used with a
22+
* Nordic Semiconductor ASA integrated circuit.
23+
*
24+
* 5. Any software provided in binary or object form under this license must not be reverse
25+
* engineered, decompiled, modified and/or disassembled.
26+
*
27+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
28+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
29+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
30+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
31+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
32+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
33+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
34+
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37+
*
38+
*/
39+
40+
/* MBED TARGET LIST: ARDUINO_NICLA_SENSE_ME */
41+
42+
#ifndef MBED_PINNAMES_H
43+
#define MBED_PINNAMES_H
44+
45+
#include "cmsis.h"
46+
47+
#ifdef __cplusplus
48+
extern "C" {
49+
#endif
50+
51+
typedef enum {
52+
PIN_INPUT,
53+
PIN_OUTPUT
54+
} PinDirection;
55+
56+
typedef enum {
57+
p0 = 0,
58+
p1 = 1,
59+
p2 = 2,
60+
p3 = 3,
61+
p4 = 4,
62+
p5 = 5,
63+
p6 = 6,
64+
p7 = 7,
65+
p8 = 8,
66+
p9 = 9,
67+
p10 = 10,
68+
p11 = 11,
69+
p12 = 12,
70+
p13 = 13,
71+
p14 = 14,
72+
p15 = 15,
73+
p16 = 16,
74+
p17 = 17,
75+
p18 = 18,
76+
p19 = 19,
77+
p20 = 20,
78+
p21 = 21,
79+
p22 = 22,
80+
p23 = 23,
81+
p24 = 24,
82+
p25 = 25,
83+
p26 = 26,
84+
p27 = 27,
85+
p28 = 28,
86+
p29 = 29,
87+
p30 = 30,
88+
p31 = 31,
89+
90+
// Not connected
91+
NC = (int)0xFFFFFFFF,
92+
93+
P0_0 = p0,
94+
P0_1 = p1,
95+
P0_2 = p2,
96+
P0_3 = p3,
97+
P0_4 = p4,
98+
P0_5 = p5,
99+
P0_6 = p6,
100+
P0_7 = p7,
101+
102+
P0_8 = p8,
103+
P0_9 = p9,
104+
P0_10 = p10,
105+
P0_11 = p11,
106+
P0_12 = p12,
107+
P0_13 = p13,
108+
P0_14 = p14,
109+
P0_15 = p15,
110+
111+
P0_16 = p16,
112+
P0_17 = p17,
113+
P0_18 = p18,
114+
P0_19 = p19,
115+
P0_20 = p20,
116+
P0_21 = p21,
117+
P0_22 = p22,
118+
P0_23 = p23,
119+
120+
P0_24 = p24,
121+
P0_25 = p25,
122+
P0_26 = p26,
123+
P0_27 = p27,
124+
P0_28 = p28,
125+
P0_29 = p29,
126+
P0_30 = p30,
127+
P0_31 = p31,
128+
129+
//INT_BQ = p18,
130+
INT_BHI260 = p14,
131+
BQ_CDN = p25,
132+
INT_ESLOV = p19,
133+
//BHI_HOSTBOOT = p25,
134+
RESET_BHI260 = p18,
135+
136+
GPIO0 = p24,
137+
GPIO1 = p20,
138+
GPIO2 = p9,
139+
GPIO3 = p10,
140+
141+
RX_PIN_NUMBER = p9,
142+
TX_PIN_NUMBER = p20,
143+
CTS_PIN_NUMBER = NC,
144+
RTS_PIN_NUMBER = NC,
145+
146+
CONSOLE_TX = TX_PIN_NUMBER,
147+
CONSOLE_RX = RX_PIN_NUMBER,
148+
149+
// Mbed interface chip pins
150+
STDIO_UART_TX = TX_PIN_NUMBER,
151+
STDIO_UART_RX = RX_PIN_NUMBER,
152+
STDIO_UART_CTS = CTS_PIN_NUMBER,
153+
STDIO_UART_RTS = RTS_PIN_NUMBER,
154+
} PinName;
155+
156+
// Alternate names for pins
157+
#define SPI_PSELSCK0 p3
158+
#define SPI_PSELMISO0 p5
159+
#define SPI_PSELMOSI0 p4
160+
#define SPI_PSELSS0 p31
161+
#define CS_FLASH p26
162+
163+
#define SPI_PSELSS1 p29
164+
#define SPI_PSELMISO1 p28
165+
#define SPI_PSELMOSI1 p27
166+
#define SPI_PSELSCK1 p11
167+
168+
#define SPI_MOSI SPI_PSELMOSI0
169+
#define SPI_MISO SPI_PSELMISO0
170+
#define SPI_SCK SPI_PSELSCK0
171+
#define SPI_CS SPI_PSELSS0
172+
173+
#define SPI_COPI SPI_PSELMOSI0
174+
#define SPI_CIPO SPI_PSELMISO0
175+
176+
// Note: Arduino convention is for I2C1 to be the "internal" I2C and for I2C0
177+
// to be the "external" I2C available on the pins. Unfortunately this is backward to
178+
// how they are named in the schematic...
179+
180+
#define I2C_SDA0 p22
181+
#define I2C_SCL0 p23
182+
183+
#define I2C_SDA1 p15
184+
#define I2C_SCL1 p16
185+
186+
// LEDs & buttons
187+
#define BUTTON1 p21
188+
189+
typedef enum {
190+
PullNone = 0,
191+
PullDown = 1,
192+
PullUp = 3,
193+
PullDefault = PullUp
194+
} PinMode;
195+
196+
#ifdef __cplusplus
197+
}
198+
#endif
199+
200+
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2006-2013 ARM Limited
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
#ifndef MBED_DEVICE_H
18+
#define MBED_DEVICE_H
19+
20+
#include "objects.h"
21+
22+
#endif

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/device/TOOLCHAIN_GCC_ARM/NRF52832.ld

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,12 @@
1616

1717
/* Linker script to configure memory regions. */
1818

19-
/* Default to no softdevice */
20-
#if !defined(MBED_APP_START)
21-
#define MBED_APP_START 0x0
22-
#endif
23-
24-
#if !defined(MBED_APP_SIZE)
25-
#define MBED_APP_SIZE 0x80000
26-
#endif
27-
28-
#if !defined(MBED_RAM_START)
29-
#define MBED_RAM_START 0x20000000
30-
#define MBED_RAM_SIZE 0x10000
31-
#endif
19+
#include "../nrf52832_memory_regions.h"
3220

3321
#if !defined(MBED_CONF_TARGET_BOOT_STACK_SIZE)
3422
#define MBED_CONF_TARGET_BOOT_STACK_SIZE 0x800
3523
#endif
3624

37-
#define MBED_RAM0_START MBED_RAM_START
38-
#define MBED_RAM0_SIZE 0xE0
39-
#define MBED_RAM1_START (MBED_RAM_START + MBED_RAM0_SIZE)
40-
#define MBED_RAM1_SIZE (MBED_RAM_SIZE - MBED_RAM0_SIZE)
4125

4226
MEMORY
4327
{

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/TARGET_MCU_NRF52832/device/cmsis_nvic.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Copyright (c) 2016 ARM Limited. All rights reserved.
44
* All rights reserved.
55
*
6+
* SPDX-License-Identifier: BSD-3-Clause
7+
*
68
* Redistribution and use in source and binary forms, with or without
79
* modification, are permitted provided that the following conditions are met:
810
*
@@ -36,7 +38,7 @@
3638

3739
#include "nrf52.h"
3840
#include "cmsis.h"
39-
41+
#include "nrf52832_memory_regions.h"
4042

4143
#ifdef __cplusplus
4244
extern "C" {
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright (c) 2024 ARM Limited
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
#ifndef NRF52832_MEMORY_REGIONS_H
20+
#define NRF52832_MEMORY_REGIONS_H
21+
22+
/* Default to no softdevice */
23+
#if !defined(MBED_APP_START)
24+
#define MBED_APP_START 0x0
25+
#endif
26+
27+
#if !defined(MBED_APP_SIZE)
28+
#define MBED_APP_SIZE 0x80000
29+
#endif
30+
31+
#if !defined(MBED_RAM_START)
32+
#define MBED_RAM_START 0x20000000
33+
#define MBED_RAM_SIZE 0x10000
34+
#endif
35+
36+
#define MBED_RAM0_START MBED_RAM_START
37+
#define MBED_RAM0_SIZE 0xE0
38+
#define MBED_RAM1_START (MBED_RAM_START + MBED_RAM0_SIZE)
39+
#define MBED_RAM1_SIZE (MBED_RAM_SIZE - MBED_RAM0_SIZE)
40+
41+
#endif //NRF52832_MEMORY_REGIONS_H

targets/drivers.json5

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,15 @@
134134

135135
// LoRa modules ---------------------------------------------------------------------
136136
"COMPONENT_SX126x": {
137-
"description": "LoRa Connect™ 150-960MHz Transcievers",
138-
"friendly_name": "Semtech SX1272"
137+
"description": "LoRa Connect™ 150-960MHz Transceivers",
138+
"friendly_name": "Semtech SX126x"
139139
},
140140
"COMPONENT_SX1272": {
141-
"description": "LoRa Connect™ 860-1000MHz Transciever",
141+
"description": "LoRa Connect™ 860-1000MHz Transceiver",
142142
"friendly_name": "Semtech SX1272"
143143
},
144144
"COMPONENT_SX1276": {
145-
"description": "LoRa Connect™ 137-1020MHz Transciever",
145+
"description": "LoRa Connect™ 137-1020MHz Transceiver",
146146
"friendly_name": "Semtech SX1276"
147147
},
148148

0 commit comments

Comments
 (0)