Skip to content

Instantly share code, notes, and snippets.

View hieuv's full-sized avatar

Võ Thanh Hiếu (Hieu Vo) hieuv

  • Nordic Semiconductor
View GitHub Profile
@hieuv
hieuv / nrf5_sdk_dfu_merge_hexes.bat
Created August 31, 2023 15:04
Generate bootloader settings and generate merged hex file in nRF5 SDK DFU work
@set app_hex=C:\_AAA\nRF5_SDK_17.1.0_ddde560\_AAA\_AAA\project\ble_app_buttonless_dfu\pca10040\s132\ses\Output\Debug\Exe\ble_app_buttonless_dfu_pca10040_s132.hex
@set bl_hex=C:\_AAA\nRF5_SDK_17.1.0_ddde560\_AAA\_AAA\secure_bootloader\pca10040_uart_debug\ses\Output\Release\Exe\secure_bootloader_uart_mbr_pca10040_debug.hex
@set sd_hex=C:\_AAA\nRF5_SDK_17.1.0_ddde560\components\softdevice\s132\hex\s132_nrf52_7.2.0_softdevice.hex
@call :CheckExist %app_hex% || exit
@call :CheckExist %bl_hex% || exit
@call :CheckExist %sd_hex% || exit
@hieuv
hieuv / ncs_2.4.0+_application_add_mcuboot.conf
Last active November 7, 2023 08:45
NCS v2.4.0 Add MCUboot and MCUmgr over UART to an application
# Add MCUboot and DFU over UART to application
# Applicable for NCS 2.4.0+
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_MCUMGR=y
CONFIG_MCUMGR_GRP_IMG=y
# DFU over UART
CONFIG_MCUMGR_TRANSPORT_UART=y
@hieuv
hieuv / led.c
Last active July 9, 2024 23:13
Get pin info from Devicetree
#include <zephyr/kernel.h>
#include <hal/nrf_gpio.h>
#define PRINTK_MACRO(_MMACRO) printk(#_MMACRO "\n\tDecimal: %d\n\tHex: 0x%08x\n", _MMACRO, _MMACRO);
// Explanation
// The relevant DTS lines we want to look at are
// In nrf52840dk_nrf52840.dts:
// aliases {
// led0 = &led0;
// ...
@hieuv
hieuv / method1_nrfx_drivers.c
Created July 15, 2024 21:45
nRF52x - Two ways to connect RADIO events to GPIOTE with PPI
// Pro: The nrfx drivers keep track of which PPI and GPIOTE channels are in used.
static void alloc_assign_enable_nrfx_ppi(nrf_ppi_channel_t* p_channel,
uint32_t event_end_point,
uint32_t task_end_point)
{
#if (!NRFX_PPI_ENABLED)
#error "Require enabling NRFX_PPI_ENABLED in sdk_config.h. In nRF5 SDK, also check PPI_ENABLED (refer to apply_old_config.h)"
#endif