Skip to content

Commit 9b694c4

Browse files
committed
boards: raytac: Add support for raytac_mdbt50q_cx_40_dongle
Add support for Raytac's new TYPE-C dongle. Signed-off-by: Stanley Huang <[email protected]>
1 parent c6413c3 commit 9b694c4

17 files changed

+756
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
zephyr_library()
4+
zephyr_library_sources(board.c)
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Raytac MDBT50Q-CX Dongle NRF52840 board configuration
2+
#
3+
# Copyright (c) 2018-2023 Nordic Semiconductor ASA
4+
# Copyright (c) 2025 Raytac Corporation.
5+
# SPDX-License-Identifier: Apache-2.0
6+
7+
if BOARD_RAYTAC_MDBT50Q_CX_40_DONGLE
8+
9+
config BOARD_HAS_NRF5_BOOTLOADER
10+
bool "Board has nRF5 bootloader"
11+
default y
12+
help
13+
If selected, applications are linked so that they can be loaded by Nordic
14+
nRF5 bootloader.
15+
16+
endif # BOARD_RAYTAC_MDBT50Q_CX_40_DONGLE
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Raytac MDBT50Q-CX-40 Dongle NRF52840 board configuration
2+
#
3+
# Copyright (c) 2018-2023 Nordic Semiconductor ASA
4+
# Copyright (c) 2025 Raytac Corporation
5+
# SPDX-License-Identifier: Apache-2.0
6+
7+
if BOARD_RAYTAC_MDBT50Q_CX_40_DONGLE
8+
9+
# To let the nRF5 bootloader load an application, the application
10+
# must be linked after Nordic MBR, that is factory-programmed on the board.
11+
12+
# Nordic nRF5 bootloader exists outside of the partitions specified in the
13+
# DTS file, so we manually override FLASH_LOAD_OFFSET to link the application
14+
# correctly, after Nordic MBR.
15+
16+
# When building MCUBoot, MCUBoot itself will select USE_DT_CODE_PARTITION
17+
# which will make it link into the correct partition specified in DTS file,
18+
# the offset is applied here so that the full partition size can be used when
19+
# the bootloader Kconfig option has been disabled.
20+
21+
config FLASH_LOAD_OFFSET
22+
default 0x1000
23+
depends on BOARD_HAS_NRF5_BOOTLOADER && (MCUBOOT || !USE_DT_CODE_PARTITION)
24+
25+
source "boards/common/usb/Kconfig.cdc_acm_serial.defconfig"
26+
27+
endif # BOARD_RAYTAC_MDBT50Q_CX_40_DONGLE
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Raytac MDBT50Q-CX-40 Dongle nRF52840 board configuration
2+
#
3+
# Copyright (c) 2018 Nordic Semiconductor ASA
4+
# Copyright (c) 2025 Raytac Corporation
5+
# SPDX-License-Identifier: Apache-2.0
6+
7+
config BOARD_RAYTAC_MDBT50Q_CX_40_DONGLE
8+
select SOC_NRF52840_QIAA
+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright (c) 2018 Nordic Semiconductor ASA.
3+
* Copyright (c) 2025 Raytac Corporation.
4+
*
5+
* SPDX-License-Identifier: Apache-2.0
6+
*/
7+
8+
#include <zephyr/init.h>
9+
#include <hal/nrf_power.h>
10+
11+
void board_early_init_hook(void)
12+
{
13+
/* if the raytac_mdbt50q_cx_40_dongle is powered from USB
14+
* (high voltage mode), GPIO output voltage is set to 1.8 volts by
15+
* default and that is not enough to turn the LEDs on.
16+
* Increase GPIO voltage to 3.0 volts.
17+
*/
18+
if ((nrf_power_mainregstatus_get(NRF_POWER) ==
19+
NRF_POWER_MAINREGSTATUS_HIGH) &&
20+
((NRF_UICR->REGOUT0 & UICR_REGOUT0_VOUT_Msk) ==
21+
(UICR_REGOUT0_VOUT_DEFAULT << UICR_REGOUT0_VOUT_Pos))) {
22+
23+
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
24+
while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {
25+
;
26+
}
27+
28+
NRF_UICR->REGOUT0 =
29+
(NRF_UICR->REGOUT0 & ~((uint32_t)UICR_REGOUT0_VOUT_Msk)) |
30+
(UICR_REGOUT0_VOUT_3V0 << UICR_REGOUT0_VOUT_Pos);
31+
32+
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
33+
while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {
34+
;
35+
}
36+
37+
/* a reset is required for changes to take effect */
38+
NVIC_SystemReset();
39+
}
40+
41+
return 0;
42+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copyright (c) 2018-2023 Nordic Semiconductor ASA
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
board_runner_args(jlink "--device=nrf52840_xxaa" "--speed=4000")
5+
board_runner_args(pyocd "--target=nrf52840" "--frequency=4000000")
6+
include(${ZEPHYR_BASE}/boards/common/nrfutil.board.cmake)
7+
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
8+
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
9+
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
board:
2+
name: raytac_mdbt50q_cx_40_dongle
3+
full_name: MDBT50Q-CX-40 Dongle
4+
vendor: raytac
5+
socs:
6+
- name: nrf52840
Binary file not shown.

0 commit comments

Comments
 (0)