Skip to content

board: raytac: Add support for raytac_mdbt50q_cx_40_dongle #88926

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions boards/raytac/mdbt50q_cx_40_dongle/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# SPDX-License-Identifier: Apache-2.0

zephyr_library()
zephyr_library_sources(board.c)
16 changes: 16 additions & 0 deletions boards/raytac/mdbt50q_cx_40_dongle/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Raytac MDBT50Q-CX Dongle NRF52840 board configuration
#
# Copyright (c) 2018-2023 Nordic Semiconductor ASA
# Copyright (c) 2025 Raytac Corporation.
# SPDX-License-Identifier: Apache-2.0

if BOARD_RAYTAC_MDBT50Q_CX_40_DONGLE

config BOARD_HAS_NRF5_BOOTLOADER
bool "Board has nRF5 bootloader"
default y
help
If selected, applications are linked so that they can be loaded by Nordic
nRF5 bootloader.

endif # BOARD_RAYTAC_MDBT50Q_CX_40_DONGLE
27 changes: 27 additions & 0 deletions boards/raytac/mdbt50q_cx_40_dongle/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Raytac MDBT50Q-CX-40 Dongle NRF52840 board configuration
#
# Copyright (c) 2018-2023 Nordic Semiconductor ASA
# Copyright (c) 2025 Raytac Corporation
# SPDX-License-Identifier: Apache-2.0

if BOARD_RAYTAC_MDBT50Q_CX_40_DONGLE

# To let the nRF5 bootloader load an application, the application
# must be linked after Nordic MBR, that is factory-programmed on the board.

# Nordic nRF5 bootloader exists outside of the partitions specified in the
# DTS file, so we manually override FLASH_LOAD_OFFSET to link the application
# correctly, after Nordic MBR.

# When building MCUBoot, MCUBoot itself will select USE_DT_CODE_PARTITION
# which will make it link into the correct partition specified in DTS file,
# the offset is applied here so that the full partition size can be used when
# the bootloader Kconfig option has been disabled.

config FLASH_LOAD_OFFSET
default 0x1000
depends on BOARD_HAS_NRF5_BOOTLOADER && (MCUBOOT || !USE_DT_CODE_PARTITION)

source "boards/common/usb/Kconfig.cdc_acm_serial.defconfig"

endif # BOARD_RAYTAC_MDBT50Q_CX_40_DONGLE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Raytac MDBT50Q-CX-40 Dongle nRF52840 board configuration
#
# Copyright (c) 2018 Nordic Semiconductor ASA
# Copyright (c) 2025 Raytac Corporation
# SPDX-License-Identifier: Apache-2.0

config BOARD_RAYTAC_MDBT50Q_CX_40_DONGLE
select SOC_NRF52840_QIAA
46 changes: 46 additions & 0 deletions boards/raytac/mdbt50q_cx_40_dongle/board.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright (c) 2018 Nordic Semiconductor ASA.
* Copyright (c) 2025 Raytac Corporation.
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <zephyr/init.h>
#include <hal/nrf_power.h>

static int board_raytac_mdbt50q_cx_40_dongle_nrf52840_init(void)
{

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

/* if the nrf52840dongle_nrf52840 board is powered from USB
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*If, and this text doesn't make sense since this refers to a different board

* (high voltage mode), GPIO output voltage is set to 1.8 volts by
* default and that is not enough to turn the green and blue LEDs on.
* Increase GPIO voltage to 3.0 volts.
*/
if ((nrf_power_mainregstatus_get(NRF_POWER) ==
NRF_POWER_MAINREGSTATUS_HIGH) &&
((NRF_UICR->REGOUT0 & UICR_REGOUT0_VOUT_Msk) ==
(UICR_REGOUT0_VOUT_DEFAULT << UICR_REGOUT0_VOUT_Pos))) {

NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {
;
}

NRF_UICR->REGOUT0 =
(NRF_UICR->REGOUT0 & ~((uint32_t)UICR_REGOUT0_VOUT_Msk)) |
(UICR_REGOUT0_VOUT_3V0 << UICR_REGOUT0_VOUT_Pos);

NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {
;
}

/* a reset is required for changes to take effect */
NVIC_SystemReset();
}

return 0;
}

SYS_INIT(board_raytac_mdbt50q_cx_40_dongle_nrf52840_init, PRE_KERNEL_1,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
Comment on lines +45 to +46
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use board hook

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not fixed

9 changes: 9 additions & 0 deletions boards/raytac/mdbt50q_cx_40_dongle/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2018-2023 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

board_runner_args(jlink "--device=nrf52840_xxaa" "--speed=4000")
board_runner_args(pyocd "--target=nrf52840" "--frequency=4000000")
include(${ZEPHYR_BASE}/boards/common/nrfutil.board.cmake)
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
6 changes: 6 additions & 0 deletions boards/raytac/mdbt50q_cx_40_dongle/board.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
board:
name: raytac_mdbt50q_cx_40_dongle
full_name: MDBT50Q-CX-40 Dongle
vendor: raytac
socs:
- name: nrf52840
Binary file not shown.
Binary file not shown.
Loading