Skip to content

Commit d0410b4

Browse files
committed
boards: Add support for FoBE IDEA Mesh Tracker C1
This commit introduces the necessary files and configurations for the FoBE IDEA Mesh Tracker C1, including board initialization, bootloader support, and pin definitions. Signed-off-by: Chiho Sin <[email protected]>
1 parent 5d1e5e4 commit d0410b4

File tree

7 files changed

+253
-0
lines changed

7 files changed

+253
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2022 Arduino SA
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#include "nrf.h"
28+
#include "nrf_gpio.h"
29+
#include "nrf_rtc.h"
30+
31+
#define PIN_ENABLE_SENSORS_3V3 (40)
32+
#define DFU_MAGIC_SERIAL_ONLY_RESET 0x4e
33+
#define DFU_MAGIC_UF2_RESET 0x57
34+
#define DFU_MAGIC_OTA_RESET 0xA8
35+
36+
void FoBE_board_early_init(void) {
37+
CoreDebug->DEMCR = 0;
38+
NRF_CLOCK->TRACECONFIG = 0;
39+
40+
// Bootloader enables interrupt on COMPARE[0], which we don't handle
41+
// Disable it here to avoid getting stuck when OVERFLOW irq is triggered
42+
nrf_rtc_event_disable(NRF_RTC1, NRF_RTC_INT_COMPARE0_MASK);
43+
nrf_rtc_int_disable(NRF_RTC1, NRF_RTC_INT_COMPARE0_MASK);
44+
}
45+
46+
void FoBE_board_deinit(void) {
47+
}
48+
49+
void FoBE_board_enter_bootloader(void) {
50+
__disable_irq();
51+
NRF_POWER->GPREGRET = DFU_MAGIC_UF2_RESET;
52+
NVIC_SystemReset();
53+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"deploy": [
3+
"deploy.md"
4+
],
5+
"docs": "",
6+
"features": [
7+
"BLE",
8+
"Battery Charging",
9+
"USB-C"
10+
],
11+
"images": [
12+
"fobe_idea_mesh_tracker_c1.jpg"
13+
],
14+
"mcu": "nrf52",
15+
"product": "FoBE IDEA Mesh Tracker C1",
16+
"thumbnail": "",
17+
"url": "https://docs.fobestudio.com/product/f2102",
18+
"vendor": "FoBE Studio"
19+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/* GNU linker script for Adafruit nrf52840 Bootloader */
2+
3+
_bootloader_head_size = 0x1000; /* MBR */
4+
_bootloader_tail_size = 0xC000; /* Bootloader start address 0x000F4000 */
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
The steps below let you create and install the firmware file. For
2+
a .uf2 type file taken from the MicroPython downloads source only
3+
step 4 is needed. For the .hex version of the firmware file, steps
4+
1, 3 and 4 are required.
5+
6+
1. Download and install u2fconv.py. It is available e.g. in the tools
7+
directory of MicroPython.
8+
9+
2. Create a firmware for the FoBE IDEA Mesh Tracker C1 if needed, with the command
10+
11+
`make BOARD=FOBE_IDEA_MESH_TRACKER_C1 -j8`
12+
13+
in the directory build-FOBE_IDEA_MESH_TRACKER_C1-s140. The firmware file will have the
14+
name firmware.uf2.
15+
16+
3. Create the .uf2 file if needed in the build directory with the command:
17+
18+
`uf2conv.py -c -f 0xADA52840 -o firmware.uf2 firmware.hex`
19+
20+
It must report the start address as 0x27000. If you omit the -o option,
21+
the output file will have the name flash.uf2.
22+
23+
4. Enable the upload mode by pushing reset twice or calling
24+
machine.bootloader() and copy the file firmware.uf2 to the board drive,
25+
which will pop up on your PC.
26+
27+
In case the FoBE IDEA Mesh Tracker C1 bootloader is lost or overwritten, it can be found
28+
at https://github.com/fobe-projects/fobe-nrf52-arduino.git in different
29+
formats. Using a JLINK adapter or interface, it can be uploaded as hex version.
30+
The bootloader is as well available through the Arduino IDE.
31+
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2016 Glenn Ruben Bakke
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#define MICROPY_HW_BOARD_NAME "FoBE IDEA Mesh Tracker C1"
28+
#define MICROPY_HW_MCU_NAME "NRF52840"
29+
#define MICROPY_PY_SYS_PLATFORM "nrf52"
30+
31+
#define MICROPY_BOARD_EARLY_INIT FoBE_board_early_init
32+
#define MICROPY_BOARD_DEINIT FoBE_board_deinit
33+
#define MICROPY_BOARD_ENTER_BOOTLOADER(nargs, args) \
34+
FoBE_board_enter_bootloader()
35+
36+
#define MICROPY_HW_ENABLE_USBDEV (1)
37+
#define MICROPY_HW_USB_CDC (1)
38+
#define MICROPY_PY_MACHINE_UART (1)
39+
#define MICROPY_PY_MACHINE_HW_PWM (1)
40+
#define MICROPY_PY_MACHINE_RTCOUNTER (1)
41+
#define MICROPY_PY_MACHINE_I2C (1)
42+
#define MICROPY_PY_MACHINE_ADC (1)
43+
#define MICROPY_PY_MACHINE_TEMP (1)
44+
#define MICROPY_HW_HAS_FLASH (0)
45+
46+
#define MICROPY_HW_ENABLE_RNG (1)
47+
48+
#define MICROPY_HW_HAS_LED (1)
49+
#define MICROPY_HW_LED_COUNT (1)
50+
#define MICROPY_HW_LED_PULLUP (1)
51+
52+
#define MICROPY_HW_LED1 (32 + 11) // LED1
53+
54+
// UART config
55+
#define MICROPY_HW_UART1_TX (32 + 9)
56+
#define MICROPY_HW_UART1_RX (0 + 12)
57+
58+
// SPI0 config
59+
#define MICROPY_HW_SPI0_NAME "SPI0"
60+
61+
#define MICROPY_HW_SPI0_SCK (0 + 20)
62+
#define MICROPY_HW_SPI0_MISO (0 + 24)
63+
#define MICROPY_HW_SPI0_MOSI (0 + 22)
64+
65+
#define MICROPY_HW_PWM0_NAME "PWM0"
66+
#define MICROPY_HW_PWM1_NAME "PWM1"
67+
#define MICROPY_HW_PWM2_NAME "PWM2"
68+
#define MICROPY_HW_PWM3_NAME "PWM3"
69+
70+
#define HELP_TEXT_BOARD_LED "1"
71+
72+
// Enabling these VID/PID values require to include mpconfigboard.h into
73+
// usb_descriptors.c. But there is an open discussion on whether specific
74+
// VID/PID values are wanted. 1200BPS touch is not supported at the moment in
75+
// the USB driver, but at least the flag is set.
76+
#define MICROPY_HW_USB_VID (0x239A)
77+
#define MICROPY_HW_USB_PID (0x8029)
78+
#define MICROPY_HW_USB_CDC_1200BPS_TOUCH (1)
79+
80+
void FoBE_board_early_init(void);
81+
void FoBE_board_deinit(void);
82+
void FoBE_board_enter_bootloader(void);
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
MCU_SERIES = m4
2+
MCU_VARIANT = nrf52
3+
MCU_SUB_VARIANT = nrf52840
4+
SOFTDEV_VERSION = 7.3.0
5+
SD=s140
6+
LD_FILES += boards/FOBE_IDEA_MESH_TRACKER_C1/bootloader.ld boards/nrf52840_1M_256k.ld
7+
8+
NRF_DEFINES += -DNRF52840_XXAA
9+
10+
MICROPY_VFS_LFS2 = 1
11+
FS_SIZE = 256k
12+
13+
# DEBUG ?= 1
14+
15+
uf2: hex
16+
python3 $(TOP)/tools/uf2conv.py -c -o $(BUILD)/firmware.uf2 -f 0xADA52840 $(BUILD)/firmware.hex
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
P0,P0
2+
P1,P1
3+
P2,P2,ADC0_IN0
4+
P3,P3,ADC0_IN1
5+
P4,P4,ADC0_IN2
6+
P5,P5,ADC0_IN3
7+
P6,P6
8+
P7,P7
9+
P8,P8
10+
P9,P9
11+
P10,P10
12+
P11,P11
13+
P12,P12
14+
P13,P13
15+
P14,P14
16+
P15,P15
17+
P16,P16
18+
P17,P17
19+
P18,P18
20+
P19,P19
21+
P20,P20
22+
P21,P21
23+
P22,P22
24+
P23,P23
25+
P24,P24
26+
P25,P25
27+
P26,P26
28+
P27,P27
29+
P28,P28,ADC0_IN4
30+
P29,P29,ADC0_IN5
31+
P30,P30,ADC0_IN6
32+
P31,P31,ADC0_IN7
33+
P32,P32
34+
P33,P33
35+
P34,P34
36+
P35,P35
37+
P36,P36
38+
P37,P37
39+
P38,P38
40+
P39,P39
41+
P40,P40
42+
P41,P41
43+
P42,P42
44+
P43,P43
45+
P44,P44
46+
P45,P45
47+
P46,P46
48+
P47,P47

0 commit comments

Comments
 (0)