diff --git a/samples/simple_txrx/CMakeLists.txt b/samples/simple_txrx/CMakeLists.txt new file mode 100644 index 0000000..c7e38b2 --- /dev/null +++ b/samples/simple_txrx/CMakeLists.txt @@ -0,0 +1,14 @@ +# Copyright (c) 2023 Silicon Laboratories Inc. +# SPDX-License-Identifier: Zlib + +cmake_minimum_required(VERSION 3.20.0) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(simple_txrx) + +target_include_directories(app PRIVATE + src/rail-configs/${CONFIG_BOARD} +) +target_sources(app PRIVATE + src/main.c + src/rail-configs/${CONFIG_BOARD}/rail_config.c +) diff --git a/samples/simple_txrx/boards/sltb010a.overlay b/samples/simple_txrx/boards/sltb010a.overlay new file mode 100644 index 0000000..f559013 --- /dev/null +++ b/samples/simple_txrx/boards/sltb010a.overlay @@ -0,0 +1,8 @@ +/* + * Copyright (c) 2023 Silicon Laboratories Inc. + * SPDX-License-Identifier: Zlib + */ + +&cpu0 { + cpu-power-states = <&pstate_em1>; +}; diff --git a/samples/simple_txrx/boards/xg24_dk2601b.overlay b/samples/simple_txrx/boards/xg24_dk2601b.overlay new file mode 100644 index 0000000..f559013 --- /dev/null +++ b/samples/simple_txrx/boards/xg24_dk2601b.overlay @@ -0,0 +1,8 @@ +/* + * Copyright (c) 2023 Silicon Laboratories Inc. + * SPDX-License-Identifier: Zlib + */ + +&cpu0 { + cpu-power-states = <&pstate_em1>; +}; diff --git a/samples/simple_txrx/prj.conf b/samples/simple_txrx/prj.conf new file mode 100644 index 0000000..ff3a7cc --- /dev/null +++ b/samples/simple_txrx/prj.conf @@ -0,0 +1,8 @@ +CONFIG_SOC_GECKO_CUSTOM_RADIO_PHY=y +CONFIG_SHELL=y +CONFIG_PM=y +CONFIG_EVENTS=y +CONFIG_LOG=y + +CONFIG_DEBUG_THREAD_INFO=y +CONFIG_DEBUG=y diff --git a/samples/simple_txrx/src/main.c b/samples/simple_txrx/src/main.c new file mode 100644 index 0000000..d329119 --- /dev/null +++ b/samples/simple_txrx/src/main.c @@ -0,0 +1,278 @@ +/* + * Copyright (c) 2024 Silicon Laboratories Inc. + * SPDX-License-Identifier: Apache-2.0 + */ +#include +#include +#include +#include + +#include "rail.h" +#include "rail_config.h" +#include "pa_conversions_efr32.h" + +LOG_MODULE_REGISTER(app); + +#ifdef RAIL0_CHANNEL_GROUP_1_PROFILE_WISUN_OFDM +# if !defined(HARDWARE_BOARD_HAS_EFF) + BUILD_ASSERT(SL_RAIL_UTIL_PA_SELECTION_SUBGHZ == RAIL_TX_POWER_MODE_OFDM_PA, + "Please use the OFDM PA settings in the sl_rail_util_pa_config.h for OFDM phys"); +# endif +# if defined(HARDWARE_BOARD_HAS_EFF) && RAIL_SUPPORTS_EFF + BUILD_ASSERT(SL_RAIL_UTIL_PA_SELECTION_SUBGHZ >= RAIL_TX_POWER_MODE_OFDM_PA_EFF_30DBM, + "Please use the OFDM PA for EFF settings in the sl_rail_util_pa_config.h for OFDM phys"); +# endif +#endif + +static const struct gpio_dt_spec sw0 = GPIO_DT_SPEC_GET(DT_ALIAS(sw0), gpios); +static const struct gpio_dt_spec led_rx = GPIO_DT_SPEC_GET(DT_ALIAS(led0), gpios); +#if DT_NODE_EXISTS(DT_ALIAS(led1)) +static const struct gpio_dt_spec led_tx = GPIO_DT_SPEC_GET(DT_ALIAS(led1), gpios); +#else +static const struct gpio_dt_spec led_tx = led_rx; +#endif + +struct { + RAIL_Handle_t rail_handle; + struct k_event rx_event; + int channel; + const uint8_t *payload; + int payload_len; +} app_ctx; + +void rx_packets(RAIL_Handle_t rail_handle) +{ + uint8_t rx_frame[32]; + RAIL_RxPacketHandle_t handle; + RAIL_RxPacketInfo_t info; + RAIL_Status_t status; + + for (;;) { + handle = RAIL_GetRxPacketInfo(rail_handle, RAIL_RX_PACKET_HANDLE_OLDEST_COMPLETE, + &info); + if (handle == RAIL_RX_PACKET_HANDLE_INVALID) { + return; + } + if (info.packetBytes < sizeof(rx_frame)) { + RAIL_CopyRxPacket(rx_frame, &info); + } + status = RAIL_ReleaseRxPacket(rail_handle, handle); + if (status) { + LOG_ERR("RAIL_ReleaseRxPacket(): %d", status); + } + if (info.packetBytes < sizeof(rx_frame)) { + LOG_HEXDUMP_INF(rx_frame, info.packetBytes, "rx data:"); + } else { + LOG_INF("rx: skip large packet"); + } + gpio_pin_toggle_dt(&led_rx); + } +} + +void tx_packet(RAIL_Handle_t rail_handle, int channel, const uint8_t *payload, int len) +{ + RAIL_Status_t status; + int ret; + + ret = RAIL_WriteTxFifo(rail_handle, payload, len, true); + if (ret != len) { + LOG_ERR("RAIL_WriteTxFifo(): %d", ret); + return; + } + gpio_pin_toggle_dt(&led_tx); + status = RAIL_StartTx(rail_handle, channel, RAIL_TX_OPTIONS_DEFAULT, NULL); + if (status) { + LOG_ERR("RAIL_StartTx(): %d ", status); + } + LOG_HEXDUMP_INF(payload, len, "tx data:"); +} + +void btn_pressed(const struct device *dev, struct gpio_callback *cb, uint32_t pins) +{ + tx_packet(app_ctx.rail_handle, app_ctx.channel, app_ctx.payload, app_ctx.payload_len); +} + +void cli_send(const struct shell *sh, size_t argc, char **argv) +{ + tx_packet(app_ctx.rail_handle, app_ctx.channel, app_ctx.payload, app_ctx.payload_len); +} + +void rail_on_event(RAIL_Handle_t rail_handle, RAIL_Events_t events) +{ + RAIL_Status_t status; + + if (events & RAIL_EVENTS_RX_COMPLETION) { + if (events & RAIL_EVENT_RX_PACKET_RECEIVED) { + gpio_pin_toggle_dt(&led_rx); + RAIL_HoldRxPacket(rail_handle); + k_event_post(&app_ctx.rx_event, 1); + } else { + LOG_ERR("radio rx error: %08llx", events); + } + } + + if (events & RAIL_EVENTS_TX_COMPLETION) { + if (!(events & RAIL_EVENT_TX_PACKET_SENT)) { + LOG_ERR("radio tx error: %08llx", events); + } + gpio_pin_toggle_dt(&led_tx); + } + + if (events & RAIL_EVENTS_TXACK_COMPLETION) { + /* We do not configure Tx ack. Catch the event anyway */ + LOG_INF("received ack completion"); + } + + if (events & RAIL_EVENT_CAL_NEEDED) { + status = RAIL_Calibrate(rail_handle, NULL, RAIL_CAL_ALL_PENDING); + if (status) { + LOG_ERR("RAIL_Calibrate(): %d", status); + } + } +} + +static void rail_on_rf_ready(RAIL_Handle_t rail_handle) +{ + LOG_INF("radio is ready"); +} + +static void rail_on_channel_config(RAIL_Handle_t rail_handle, + const RAIL_ChannelConfigEntry_t *entry) +{ + sl_rail_util_pa_on_channel_config_change(rail_handle, entry); +} + +static RAIL_Handle_t rail_init(void) +{ + static uint8_t tx_fifo[256] __aligned(4); + RAIL_Config_t rail_config = { + .eventsCallback = &rail_on_event, + }; + RAIL_DataConfig_t data_config = { + .txSource = TX_PACKET_DATA, + .rxSource = RX_PACKET_DATA, + .txMethod = PACKET_MODE, + .rxMethod = PACKET_MODE, + }; + RAIL_StateTransitions_t transitions = { + .success = RAIL_RF_STATE_RX, + .error = RAIL_RF_STATE_RX, + }; + RAIL_Handle_t rail_handle; + RAIL_Status_t status; + int ret; + + rail_handle = RAIL_Init(&rail_config, &rail_on_rf_ready); + if (!rail_handle) { + LOG_ERR("RAIL_Init() failed"); + } + status = RAIL_ConfigData(rail_handle, &data_config); + if (status) { + LOG_ERR("RAIL_ConfigData(): %d", status); + } + status = RAIL_ConfigChannels(rail_handle, channelConfigs[0], &rail_on_channel_config); + if (status) { + LOG_ERR("RAIL_ConfigChannels(): %d", status); + } + status = RAIL_SetPtiProtocol(rail_handle, RAIL_PTI_PROTOCOL_CUSTOM); + if (status) { + LOG_ERR("RAIL_SetPtiProtocol(): %d", status); + } + status = RAIL_ConfigCal(rail_handle, RAIL_CAL_TEMP | RAIL_CAL_ONETIME); + if (status) { + LOG_ERR("RAIL_ConfigCal(): %d", status); + } + status = RAIL_ConfigEvents(rail_handle, RAIL_EVENTS_ALL, + RAIL_EVENTS_RX_COMPLETION | + RAIL_EVENTS_TX_COMPLETION | + RAIL_EVENTS_TXACK_COMPLETION | + RAIL_EVENT_CAL_NEEDED); + if (status) { + LOG_ERR("RAIL_ConfigEvents(): %d", status); + } + status = RAIL_SetTxTransitions(rail_handle, &transitions); + if (status) { + LOG_ERR("RAIL_SetTxTransitions(): %d", status); + } + status = RAIL_SetRxTransitions(rail_handle, &transitions); + if (status) { + LOG_ERR("RAIL_SetRxTransitions(): %d", status); + } + ret = RAIL_SetTxFifo(rail_handle, tx_fifo, 0, sizeof(tx_fifo)); + if (ret != sizeof(tx_fifo)) { + LOG_ERR("RAIL_SetTxFifo(): %d != %d", ret, sizeof(tx_fifo)); + } + + return rail_handle; +} + +static void rail_isr_installer(void) +{ +#ifdef CONFIG_SOC_SERIES_EFR32MG24 + IRQ_CONNECT(SYNTH_IRQn, 0, SYNTH_IRQHandler, NULL, 0); +#else + IRQ_CONNECT(RDMAILBOX_IRQn, 0, RDMAILBOX_IRQHandler, NULL, 0); +#endif + IRQ_CONNECT(RAC_SEQ_IRQn, 0, RAC_SEQ_IRQHandler, NULL, 0); + IRQ_CONNECT(RAC_RSM_IRQn, 0, RAC_RSM_IRQHandler, NULL, 0); + IRQ_CONNECT(PROTIMER_IRQn, 0, PROTIMER_IRQHandler, NULL, 0); + IRQ_CONNECT(MODEM_IRQn, 0, MODEM_IRQHandler, NULL, 0); + IRQ_CONNECT(FRC_IRQn, 0, FRC_IRQHandler, NULL, 0); + IRQ_CONNECT(BUFC_IRQn, 0, BUFC_IRQHandler, NULL, 0); + IRQ_CONNECT(AGC_IRQn, 0, AGC_IRQHandler, NULL, 0); +} + +int main(void) +{ + static const uint8_t default_payload[] = { + 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, + 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF + }; + struct gpio_callback sw0_cb; + RAIL_Status_t status; + int ret; + + k_event_init(&app_ctx.rx_event); + gpio_pin_configure_dt(&led_tx, GPIO_OUTPUT_INACTIVE); + gpio_pin_configure_dt(&led_rx, GPIO_OUTPUT_INACTIVE); + gpio_pin_configure_dt(&sw0, GPIO_INPUT); + gpio_pin_interrupt_configure_dt(&sw0, GPIO_INT_EDGE_TO_ACTIVE); + gpio_init_callback(&sw0_cb, btn_pressed, BIT(sw0.pin)); + gpio_add_callback(sw0.port, &sw0_cb); + + rail_isr_installer(); + sl_rail_util_pa_init(); + app_ctx.rail_handle = rail_init(); + app_ctx.channel = 0; + app_ctx.payload = default_payload; + app_ctx.payload_len = sizeof(default_payload); + + ret = RAIL_SetFixedLength(app_ctx.rail_handle, app_ctx.payload_len); + if (ret != app_ctx.payload_len) { + LOG_ERR("RAIL_SetFixedLength(): %d ", ret); + } + status = RAIL_StartRx(app_ctx.rail_handle, app_ctx.channel, NULL); + if (status) { + LOG_ERR("RAIL_StartRx(): %d ", status); + } + +#ifdef CONFIG_PM + status = RAIL_InitPowerManager(); + if (status) { + LOG_ERR("RAIL_InitPowerManager(): %d", status); + } +#endif + + for (;;) { + k_event_wait(&app_ctx.rx_event, 0xFFFFFFFF, true, K_FOREVER); + rx_packets(app_ctx.rail_handle); + } + + return 0; +} + +SHELL_STATIC_SUBCMD_SET_CREATE(radio_cmds, + SHELL_CMD_ARG(send, NULL, "Send a packet", cli_send, 1, 0), + SHELL_SUBCMD_SET_END +); +SHELL_CMD_ARG_REGISTER(radio, &radio_cmds, "Radio control", NULL, 2, 0); diff --git a/samples/simple_txrx/src/rail-configs/sltb010a/radio_settings.radioconf b/samples/simple_txrx/src/rail-configs/sltb010a/radio_settings.radioconf new file mode 100644 index 0000000..af90a4c --- /dev/null +++ b/samples/simple_txrx/src/rail-configs/sltb010a/radio_settings.radioconf @@ -0,0 +1,18 @@ + + + + + + + 0 + 20 + SAME_AS_FIRST_CHANNEL + RAIL_TX_POWER_MAX + {"selectedPhy":"PHY_Datasheet_2450M_2GFSK_1Mbps_500K"} + + + {"selectedPhy":"PHY_Datasheet_2450M_2GFSK_1Mbps_500K"} + + + + \ No newline at end of file diff --git a/samples/simple_txrx/src/rail-configs/sltb010a/rail_config.c b/samples/simple_txrx/src/rail-configs/sltb010a/rail_config.c new file mode 100644 index 0000000..a1ca302 --- /dev/null +++ b/samples/simple_txrx/src/rail-configs/sltb010a/rail_config.c @@ -0,0 +1,333 @@ +/***************************************************************************//** + * @brief RAIL Configuration + * @details + * WARNING: Auto-Generated Radio Config - DO NOT EDIT + * Radio Configurator Version: 2022.5.2 + * RAIL Adapter Version: 2.4.19 + * RAIL Compatibility: 2.x + ******************************************************************************* + * # License + * Copyright 2019 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * SPDX-License-Identifier: Zlib + * + * The licensor of this software is Silicon Laboratories Inc. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ******************************************************************************/ + +#include "em_device.h" +#include "rail_config.h" + +uint32_t RAILCb_CalcSymbolRate(RAIL_Handle_t railHandle) +{ + (void)railHandle; + return 0U; +} + +uint32_t RAILCb_CalcBitRate(RAIL_Handle_t railHandle) +{ + (void)railHandle; + return 0U; +} + +void RAILCb_ConfigFrameTypeLength(RAIL_Handle_t railHandle, const RAIL_FrameType_t *frameType) +{ + (void)railHandle; + (void)frameType; +} + +static const uint8_t irCalConfig[] = {25, 63, 1, 6, 4, 16, 1, 0, 0, 1, 1, 6, 0, + 16, 39, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0}; + +static const int32_t timingConfig[] = {0, 0, 0}; + +static const uint8_t hfxoRetimingConfigEntries[] = { + 2, 0, 0, 0, 0x00, 0xf0, 0x49, 0x02, 6, 20, 0, 0, 0x00, 0xe0, 0x93, 0x04, 5, 56, + 0, 0, 0xa0, 0x08, 0, 0, 0, 0, 0x58, 0x09, 1, 4, 7, 6, 0x10, 0x0a, 1, 4, + 7, 7, 0xc8, 0x0a, 0, 4, 8, 7, 0x80, 0x0b, 0, 4, 8, 8, 0x38, 0x0c, 0, 4, + 9, 8, 0x61, 0x08, 0, 0, 0, 0, 0x68, 0x08, 0, 0, 0, 0, 0xc7, 0x09, 1, 4, + 4, 3, 0x2c, 0x0b, 1, 4, 4, 4, 0x92, 0x0c, 1, 4, 5, 4}; + +static RAIL_ChannelConfigEntryAttr_t channelConfigEntryAttr = { +#if RAIL_SUPPORTS_OFDM_PA + {{0xFFFFFFFFUL}, {0xFFFFFFFFUL, 0xFFFFFFFFUL}} +#else // RAIL_SUPPORTS_OFDM_PA + {0xFFFFFFFFUL}, +#endif // RAIL_SUPPORTS_OFDM_PA +}; + +static const uint32_t phyInfo[] = { + 13UL, + 0x00924924UL, // 146.28571428571428 + (uint32_t)NULL, + (uint32_t)irCalConfig, + (uint32_t)timingConfig, + 0x00000000UL, + 8000000UL, + 28000000UL, + 1000000UL, + 0x00F50101UL, + 0x02503EC5UL, + (uint32_t)NULL, + (uint32_t)hfxoRetimingConfigEntries, + (uint32_t)NULL, + 0UL, + 0UL, + 999997UL, + (uint32_t)NULL, + (uint32_t)NULL, +}; + +const uint32_t Protocol_Configuration_modemConfigBase[] = { + 0x0002400CUL, + 0x00000000UL, + /* 4010 */ 0x00004000UL, + 0x00024020UL, + 0x0000000FUL, + /* 4024 */ 0x00000000UL, + 0x00074030UL, + 0x00000000UL, + /* 4034 */ 0x00000000UL, + /* 4038 */ 0x00000000UL, + /* 403C */ 0x00000000UL, + /* 4040 */ 0x00000000UL, + /* 4044 */ 0x00004000UL, + /* 4048 */ 0x00040700UL, + 0x00014050UL, + 0x00000000UL, + 0x0002405CUL, + 0x00000000UL, + /* 4060 */ 0x00000000UL, + 0x000140A8UL, + 0x00000000UL, + 0x000440BCUL, + 0x00000000UL, + /* 40C0 */ 0x00000000UL, + /* 40C4 */ 0x00000000UL, + /* 40C8 */ 0x00000000UL, + 0x00044104UL, + 0x00004CFFUL, + /* 4108 */ 0x00000000UL, + /* 410C */ 0x00004DFFUL, + /* 4110 */ 0x00000000UL, + 0x1001C020UL, + 0x0007F800UL, + 0x3001C020UL, + 0x000802F5UL, + 0x0008C024UL, + 0x00001300UL, + /* C028 */ 0x83B380ECUL, + /* C02C */ 0x51407543UL, + /* C030 */ 0x48000FA0UL, + /* C034 */ 0x00004030UL, + /* C038 */ 0x00000000UL, + /* C03C */ 0x00000000UL, + /* C040 */ 0x0000022EUL, + 0x0004C050UL, + 0x04301151UL, + /* C054 */ 0xE6092D0EUL, + /* C058 */ 0x08070654UL, + /* C05C */ 0x0002B6D1UL, + 0x000AC064UL, + 0x1C003004UL, + /* C068 */ 0x09183040UL, + /* C06C */ 0x2079640DUL, + /* C070 */ 0x01FBFCEBUL, + /* C074 */ 0x03E8F67FUL, + /* C078 */ 0x15724BBDUL, + /* C07C */ 0x0518A311UL, + /* C080 */ 0x76543210UL, + /* C084 */ 0x00000A98UL, + /* C088 */ 0x00000000UL, + 0x01010008UL, + 0x00000744UL, + 0x01010018UL, + 0x00000000UL, + 0x01010020UL, + 0x0000A001UL, + 0x0108401CUL, + 0x00000010UL, + /* 4020 */ 0x04000000UL, + /* 4024 */ 0x0002C00FUL, + /* 4028 */ 0x00005000UL, + /* 402C */ 0x000C1000UL, + /* 4030 */ 0x03000000UL, + /* 4034 */ 0x00000000UL, + /* 4038 */ 0x00000000UL, + 0x01064058UL, + 0x00FF04C8UL, + /* 405C */ 0x00000C41UL, + /* 4060 */ 0x00000001UL, + /* 4064 */ 0x00140012UL, + /* 4068 */ 0x0000B16FUL, + /* 406C */ 0x00000000UL, + 0x01114080UL, + 0x13C00714UL, + /* 4084 */ 0x00000000UL, + /* 4088 */ 0x003B03F1UL, + /* 408C */ 0x00000000UL, + /* 4090 */ 0x00000000UL, + /* 4094 */ 0x22140A04UL, + /* 4098 */ 0x4F4A4132UL, + /* 409C */ 0x00000000UL, + /* 40A0 */ 0x00000000UL, + /* 40A4 */ 0x00000000UL, + /* 40A8 */ 0x00000000UL, + /* 40AC */ 0x00000000UL, + /* 40B0 */ 0x00000000UL, + /* 40B4 */ 0x00000000UL, + /* 40B8 */ 0x00000000UL, + /* 40BC */ 0x00000000UL, + /* 40C0 */ 0x00000000UL, + 0x010240E0UL, + 0x00000033UL, + /* 40E4 */ 0x00000000UL, + 0x010140ECUL, + 0x8C84B89BUL, + 0x010540F4UL, + 0x07830464UL, + /* 40F8 */ 0x3AC81388UL, + /* 40FC */ 0x000A209CUL, + /* 4100 */ 0x00206100UL, + /* 4104 */ 0x123556B7UL, + 0x0103410CUL, + 0x0011F778UL, + /* 4110 */ 0x29043020UL, + /* 4114 */ 0x4040BB88UL, + 0x01024124UL, + 0x00000000UL, + /* 4128 */ 0x00000000UL, + 0x010A4130UL, + 0x0C660664UL, + /* 4134 */ 0x0000010CUL, + /* 4138 */ 0x00FA53E8UL, + /* 413C */ 0x00000000UL, + /* 4140 */ 0x00000000UL, + /* 4144 */ 0x00000000UL, + /* 4148 */ 0x00000000UL, + /* 414C */ 0x00000000UL, + /* 4150 */ 0x00000000UL, + /* 4154 */ 0x00000101UL, + 0x01034168UL, + 0x07830464UL, + /* 416C */ 0x00821388UL, + /* 4170 */ 0x00000000UL, + 0x01044230UL, + 0x00000000UL, + /* 4234 */ 0x0E000000UL, + /* 4238 */ 0x00000000UL, + /* 423C */ 0x00000000UL, + 0x01024244UL, + 0x00000000UL, + /* 4248 */ 0x001F81F4UL, + 0x010C4254UL, + 0x00000000UL, + /* 4258 */ 0x003C0000UL, + /* 425C */ 0x00000000UL, + /* 4260 */ 0x00000000UL, + /* 4264 */ 0x55555555UL, + /* 4268 */ 0x00000017UL, + /* 426C */ 0x00000000UL, + /* 4270 */ 0x00000000UL, + /* 4274 */ 0x0006AAAAUL, + /* 4278 */ 0x00000000UL, + /* 427C */ 0x00000000UL, + /* 4280 */ 0x00000000UL, + 0x01018010UL, + 0x00000003UL, + 0x01028038UL, + 0x00103EC5UL, + /* 803C */ 0x00000001UL, + 0x0103809CUL, + 0x00000000UL, + /* 80A0 */ 0x00037870UL, + /* 80A4 */ 0x000000D0UL, + 0x110180A8UL, + 0x000001F0UL, + 0x310180A8UL, + 0x01CB4205UL, + 0x110180ACUL, + 0x000001F0UL, + 0x310180ACUL, + 0x00FD3E05UL, + 0x010280B0UL, + 0x02000300UL, + /* 80B4 */ 0x01000037UL, + 0x02020098UL, + 0x04000C00UL, + /* 009C */ 0x0000004CUL, + 0x020100A4UL, + 0x00000400UL, + 0x020200D0UL, + 0xAA400005UL, + /* 00D4 */ 0x00000188UL, + 0x020100E4UL, + 0x11512C6CUL, + 0x020200F4UL, + 0x00000000UL, + /* 00F8 */ 0x1108213DUL, + 0x120100FCUL, + 0x0000003FUL, + 0x320100FCUL, + 0x00045400UL, + 0x02010130UL, + 0x02510060UL, + 0x02010154UL, + 0x00003FC4UL, + 0x02010168UL, + 0x00000400UL, + 0x03014FFCUL, + (uint32_t)&phyInfo, + 0xFFFFFFFFUL, +}; + +const RAIL_ChannelConfigEntry_t Protocol_Configuration_channels[] = { + { + .phyConfigDeltaAdd = NULL, + .baseFrequency = 2450000000, + .channelSpacing = 1000000, + .physicalChannelOffset = 0, + .channelNumberStart = 0, + .channelNumberEnd = 20, + .maxPower = RAIL_TX_POWER_MAX, + .attr = &channelConfigEntryAttr, +#ifdef RADIO_CONFIG_ENABLE_CONC_PHY + .entryType = 0, +#endif +#ifdef RADIO_CONFIG_ENABLE_STACK_INFO + .stackInfo = NULL, +#endif + }, +}; + +const RAIL_ChannelConfig_t Protocol_Configuration_channelConfig = { + .phyConfigBase = Protocol_Configuration_modemConfigBase, + .phyConfigDeltaSubtract = NULL, + .configs = Protocol_Configuration_channels, + .length = 1U, + .signature = 0UL, +}; + +const RAIL_ChannelConfig_t *channelConfigs[] = {&Protocol_Configuration_channelConfig, NULL}; + +#ifdef RADIO_CONFIG_ENABLE_STACK_INFO +#endif // RADIO_CONFIG_ENABLE_STACK_INFO + +uint32_t protocolAccelerationBuffer[303]; diff --git a/samples/simple_txrx/src/rail-configs/sltb010a/rail_config.h b/samples/simple_txrx/src/rail-configs/sltb010a/rail_config.h new file mode 100644 index 0000000..f8123e0 --- /dev/null +++ b/samples/simple_txrx/src/rail-configs/sltb010a/rail_config.h @@ -0,0 +1,52 @@ +/***************************************************************************//** + * @brief RAIL Configuration + * @details + * WARNING: Auto-Generated Radio Config - DO NOT EDIT + * Radio Configurator Version: 2022.5.2 + * RAIL Adapter Version: 2.4.19 + * RAIL Compatibility: 2.x + ******************************************************************************* + * # License + * Copyright 2019 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * SPDX-License-Identifier: Zlib + * + * The licensor of this software is Silicon Laboratories Inc. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ******************************************************************************/ + +#ifndef __RAIL_CONFIG_H__ +#define __RAIL_CONFIG_H__ + +#include +#include "rail_types.h" + +#define PROTOCOL_ACCELERATION_BUFFER protocolAccelerationBuffer +extern uint32_t protocolAccelerationBuffer[]; +#define RADIO_CONFIG_XTAL_FREQUENCY 38400000UL + +#define RAIL0_CHANNEL_GROUP_1_PHY_DATASHEET_2450M_2GFSK_1MBPS_500K +#define RAIL0_CHANNEL_GROUP_1_PROFILE_BASE +extern const RAIL_ChannelConfig_t *channelConfigs[]; + +#ifdef RADIO_CONFIG_ENABLE_STACK_INFO +#endif // RADIO_CONFIG_ENABLE_STACK_INFO + +#endif // __RAIL_CONFIG_H__ diff --git a/samples/simple_txrx/src/rail-configs/xg24_dk2601b/radio_settings.radioconf b/samples/simple_txrx/src/rail-configs/xg24_dk2601b/radio_settings.radioconf new file mode 100644 index 0000000..dfb42b0 --- /dev/null +++ b/samples/simple_txrx/src/rail-configs/xg24_dk2601b/radio_settings.radioconf @@ -0,0 +1,18 @@ + + + + + + + 0 + 20 + SAME_AS_FIRST_CHANNEL + RAIL_TX_POWER_MAX + {"selectedPhy":"PHY_Studio_2450M_2GFSK_1Mbps_500K"} + + + {"selectedPhy":"PHY_Studio_2450M_2GFSK_1Mbps_500K"} + + + + \ No newline at end of file diff --git a/samples/simple_txrx/src/rail-configs/xg24_dk2601b/rail_config.c b/samples/simple_txrx/src/rail-configs/xg24_dk2601b/rail_config.c new file mode 100644 index 0000000..6ea2494 --- /dev/null +++ b/samples/simple_txrx/src/rail-configs/xg24_dk2601b/rail_config.c @@ -0,0 +1,366 @@ +/***************************************************************************//** + * @brief RAIL Configuration + * @details + * WARNING: Auto-Generated Radio Config - DO NOT EDIT + * Radio Configurator Version: 2022.5.2 + * RAIL Adapter Version: 2.4.19 + * RAIL Compatibility: 2.x + ******************************************************************************* + * # License + * Copyright 2019 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * SPDX-License-Identifier: Zlib + * + * The licensor of this software is Silicon Laboratories Inc. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ******************************************************************************/ +#include "em_device.h" +#include "rail_config.h" + +uint32_t RAILCb_CalcSymbolRate(RAIL_Handle_t railHandle) +{ + (void) railHandle; + return 0U; +} + +uint32_t RAILCb_CalcBitRate(RAIL_Handle_t railHandle) +{ + (void) railHandle; + return 0U; +} + +void RAILCb_ConfigFrameTypeLength(RAIL_Handle_t railHandle, + const RAIL_FrameType_t *frameType) +{ + (void) railHandle; + (void) frameType; +} + +static const uint8_t irCalConfig[] = { + 25, 63, 1, 6, 4, 16, 1, 0, 0, 1, 1, 6, 0, 16, 39, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static const int32_t timingConfig[] = { + 8000, 8000, 0 +}; + +static const uint8_t hfxoRetimingConfigEntries[] = { + 2, 0, 0, 0, 0xc0, 0x17, 0x53, 0x02, 6, 20, 0, 0, 0x80, 0x2f, 0xa6, 0x04, 5, 56, 0, 0, 0xa0, 0x08, 0, 0, 0, 0, 0x58, 0x09, 1, 4, 7, 6, 0x10, 0x0a, 1, 4, 7, 7, 0xc8, 0x0a, 0, 4, 8, 7, 0x80, 0x0b, 0, 4, 8, 8, 0x38, 0x0c, 0, 4, 9, 8, 0x61, 0x08, 0, 0, 0, 0, 0x8a, 0x08, 0, 0, 0, 0, 0xc7, 0x09, 1, 4, 4, 3, 0x2c, 0x0b, 1, 4, 4, 4, 0x92, 0x0c, 1, 4, 5, 4 +}; + +static RAIL_ChannelConfigEntryAttr_t channelConfigEntryAttr = { +#if RAIL_SUPPORTS_OFDM_PA + { +#ifdef RADIO_CONFIG_ENABLE_IRCAL_MULTIPLE_RF_PATHS + { 0xFFFFFFFFUL, 0xFFFFFFFFUL, }, +#else + { 0xFFFFFFFFUL }, +#endif // RADIO_CONFIG_ENABLE_IRCAL_MULTIPLE_RF_PATHS + { 0xFFFFFFFFUL, 0xFFFFFFFFUL } + } +#else // RAIL_SUPPORTS_OFDM_PA +#ifdef RADIO_CONFIG_ENABLE_IRCAL_MULTIPLE_RF_PATHS + { 0xFFFFFFFFUL, 0xFFFFFFFFUL, }, +#else + { 0xFFFFFFFFUL }, +#endif // RADIO_CONFIG_ENABLE_IRCAL_MULTIPLE_RF_PATHS +#endif // RAIL_SUPPORTS_OFDM_PA +}; + +static const uint32_t phyInfo[] = { + 13UL, + 0x00444444UL, // 68.26666666666667 + (uint32_t) NULL, + (uint32_t) irCalConfig, + (uint32_t) timingConfig, + 0x00000000UL, + 0UL, + 36000000UL, + 1000000UL, + 0x00F80101UL, + 0x021039C3UL, + (uint32_t) NULL, + (uint32_t) hfxoRetimingConfigEntries, + (uint32_t) NULL, + 0UL, + 0UL, + 1000002UL, + (uint32_t) NULL, + (uint32_t) NULL, +}; + +const uint32_t Protocol_Configuration_modemConfigBase[] = { + 0x0002400CUL, 0x00000000UL, + /* 4010 */ 0x00004000UL, + 0x00024020UL, 0x0000000FUL, + /* 4024 */ 0x00000000UL, + 0x00074030UL, 0x00000000UL, + /* 4034 */ 0x00000000UL, + /* 4038 */ 0x00000000UL, + /* 403C */ 0x00000000UL, + /* 4040 */ 0x00000000UL, + /* 4044 */ 0x00004000UL, + /* 4048 */ 0x03000700UL, + 0x00014050UL, 0x00000000UL, + 0x0002405CUL, 0x00000000UL, + /* 4060 */ 0x00000000UL, + 0x000140A8UL, 0x00000007UL, + 0x000440BCUL, 0x00000000UL, + /* 40C0 */ 0x00000000UL, + /* 40C4 */ 0x00000000UL, + /* 40C8 */ 0x00000000UL, + 0x00044108UL, 0x00004CFFUL, + /* 410C */ 0x00000000UL, + /* 4110 */ 0x00004DFFUL, + /* 4114 */ 0x00000000UL, + 0x1001C020UL, 0x0007F800UL, + 0x3001C020UL, 0x012801FEUL, + 0x0009C024UL, 0x00001300UL, + /* C028 */ 0x03B380ECUL, + /* C02C */ 0x51407543UL, + /* C030 */ 0xF8000FA0UL, + /* C034 */ 0x00004000UL, + /* C038 */ 0x0007AAA8UL, + /* C03C */ 0x00000000UL, + /* C040 */ 0x00000000UL, + /* C044 */ 0x00000000UL, + 0x0010C054UL, 0x00302151UL, + /* C058 */ 0xE6110012UL, + /* C05C */ 0x00000036UL, + /* C060 */ 0x100F0E0AUL, + /* C064 */ 0x00000011UL, + /* C068 */ 0x0002C688UL, + /* C06C */ 0x00000520UL, + /* C070 */ 0x000010BAUL, + /* C074 */ 0x00200400UL, + /* C078 */ 0x00801804UL, + /* C07C */ 0x01203C0BUL, + /* C080 */ 0x02107C18UL, + /* C084 */ 0x06E0FC2FUL, + /* C088 */ 0x0000007FUL, + /* C08C */ 0x00000000UL, + /* C090 */ 0x00000000UL, + 0x0005C0A8UL, 0x15724BBDUL, + /* C0AC */ 0x0518A311UL, + /* C0B0 */ 0x76543210UL, + /* C0B4 */ 0x00000A98UL, + /* C0B8 */ 0x00000000UL, + 0x0004C0CCUL, 0x00000001UL, + /* C0D0 */ 0x00000000UL, + /* C0D4 */ 0x000A0001UL, + /* C0D8 */ 0x00280001UL, + 0x01010008UL, 0x00000744UL, + 0x01010018UL, 0x00000000UL, + 0x01010020UL, 0x0000A001UL, + 0x01254040UL, 0x70400000UL, + /* 4044 */ 0x00000000UL, + /* 4048 */ 0x00000010UL, + /* 404C */ 0x04000000UL, + /* 4050 */ 0x0082C00FUL, + /* 4054 */ 0x20000000UL, + /* 4058 */ 0x00000000UL, + /* 405C */ 0x03000000UL, + /* 4060 */ 0x20000000UL, + /* 4064 */ 0x00000000UL, + /* 4068 */ 0x00F804B9UL, + /* 406C */ 0x00000C40UL, + /* 4070 */ 0x00000008UL, + /* 4074 */ 0x00140012UL, + /* 4078 */ 0x0000B16FUL, + /* 407C */ 0x00000000UL, + /* 4080 */ 0x00000E7CUL, + /* 4084 */ 0x00000000UL, + /* 4088 */ 0x002A03F1UL, + /* 408C */ 0x62040000UL, + /* 4090 */ 0x00000000UL, + /* 4094 */ 0x22140A04UL, + /* 4098 */ 0x4F4A4132UL, + /* 409C */ 0x00000000UL, + /* 40A0 */ 0x00000000UL, + /* 40A4 */ 0x00000000UL, + /* 40A8 */ 0x00000000UL, + /* 40AC */ 0x00000000UL, + /* 40B0 */ 0x00000000UL, + /* 40B4 */ 0x00000000UL, + /* 40B8 */ 0x00000000UL, + /* 40BC */ 0x00000000UL, + /* 40C0 */ 0x00000000UL, + /* 40C4 */ 0x00000000UL, + /* 40C8 */ 0x00000000UL, + /* 40CC */ 0x00000000UL, + /* 40D0 */ 0x00000000UL, + 0x010140E0UL, 0x00000200UL, + 0x01024110UL, 0x00051E33UL, + /* 4114 */ 0x00000000UL, + 0x010E411CUL, 0x8C416000UL, + /* 4120 */ 0x00000000UL, + /* 4124 */ 0x078304FFUL, + /* 4128 */ 0x3AC81388UL, + /* 412C */ 0x0C6606FFUL, + /* 4130 */ 0x078304FFUL, + /* 4134 */ 0x03FF1388UL, + /* 4138 */ 0xF00A20BCUL, + /* 413C */ 0x005160EBUL, + /* 4140 */ 0x40A46503UL, + /* 4144 */ 0x55F68D00UL, + /* 4148 */ 0x42A832A4UL, + /* 414C */ 0x00403B89UL, + /* 4150 */ 0x800003C0UL, + 0x01024158UL, 0x00000000UL, + /* 415C */ 0x0000FDFFUL, + 0x010D4164UL, 0x0000010CUL, + /* 4168 */ 0x00FA53E8UL, + /* 416C */ 0x40000000UL, + /* 4170 */ 0x00000000UL, + /* 4174 */ 0x00000000UL, + /* 4178 */ 0x00000000UL, + /* 417C */ 0x00000000UL, + /* 4180 */ 0x00000000UL, + /* 4184 */ 0x00000101UL, + /* 4188 */ 0x00000000UL, + /* 418C */ 0x00000000UL, + /* 4190 */ 0x00000000UL, + /* 4194 */ 0x00000000UL, + 0x010241A4UL, 0x00000000UL, + /* 41A8 */ 0x00000000UL, + 0x010241B0UL, 0x00000000UL, + /* 41B4 */ 0xC03795E0UL, + 0x010341BCUL, 0x00000000UL, + /* 41C0 */ 0x003C0000UL, + /* 41C4 */ 0x00069069UL, + 0x010341D0UL, 0x55555555UL, + /* 41D4 */ 0x806E01E6UL, + /* 41D8 */ 0x00AA0006UL, + 0x011641E0UL, 0x00000000UL, + /* 41E4 */ 0x30DF0C02UL, + /* 41E8 */ 0x00319E2EUL, + /* 41EC */ 0x00161801UL, + /* 41F0 */ 0x0002939DUL, + /* 41F4 */ 0x0DF03A13UL, + /* 41F8 */ 0x04687FA9UL, + /* 41FC */ 0x2CE524B3UL, + /* 4200 */ 0x30DF0C02UL, + /* 4204 */ 0x00319E2EUL, + /* 4208 */ 0x00161801UL, + /* 420C */ 0x0002939DUL, + /* 4210 */ 0x0DF03A13UL, + /* 4214 */ 0x04687FA9UL, + /* 4218 */ 0x2CE524B3UL, + /* 421C */ 0x80000000UL, + /* 4220 */ 0x00000000UL, + /* 4224 */ 0x00000040UL, + /* 4228 */ 0x00000000UL, + /* 422C */ 0x40001860UL, + /* 4230 */ 0x00000000UL, + /* 4234 */ 0x00000000UL, + 0x0101423CUL, 0x00000000UL, + 0x01034244UL, 0x00000014UL, + /* 4248 */ 0x00000000UL, + /* 424C */ 0x04050008UL, + 0x01014268UL, 0x00000000UL, + 0x01024280UL, 0x00000000UL, + /* 4284 */ 0x00000081UL, + 0x01054298UL, 0x0200003FUL, + /* 429C */ 0x0000FFFFUL, + /* 42A0 */ 0x0000FFFFUL, + /* 42A4 */ 0x000003FFUL, + /* 42A8 */ 0x0000FFFFUL, + 0x010142B4UL, 0x00000000UL, + 0x010A4330UL, 0x01200040UL, + /* 4334 */ 0x000000A0UL, + /* 4338 */ 0x01005008UL, + /* 433C */ 0x1F1F1F1FUL, + /* 4340 */ 0x1B1F1F1FUL, + /* 4344 */ 0x11131518UL, + /* 4348 */ 0x0C0D0E10UL, + /* 434C */ 0x2F87C145UL, + /* 4350 */ 0x00000000UL, + /* 4354 */ 0x00000000UL, + 0x01018010UL, 0x00000003UL, + 0x01028038UL, 0x001039C3UL, + /* 803C */ 0x00000001UL, + 0x0103809CUL, 0x00000000UL, + /* 80A0 */ 0x00037870UL, + /* 80A4 */ 0x0000C0D5UL, + 0x110180A8UL, 0x000001F0UL, + 0x310180A8UL, 0x01CB4205UL, + 0x110180ACUL, 0x000001F0UL, + 0x310180ACUL, 0x008D2205UL, + 0x010280B0UL, 0x02000300UL, + /* 80B4 */ 0x01000037UL, + 0x0201009CUL, 0x04000C00UL, + 0x020300D8UL, 0xAA400005UL, + /* 00DC */ 0x00000188UL, + /* 00E0 */ 0x000000C0UL, + 0x120100ECUL, 0x00000FE0UL, + 0x320100ECUL, 0x1151200CUL, + 0x020100F0UL, 0x0000012BUL, + 0x12010110UL, 0x000FFF00UL, + 0x32010110UL, 0x31000002UL, + 0x12010150UL, 0x0001C000UL, + 0x32010150UL, 0x00A200C1UL, + 0x02010174UL, 0x019BF169UL, + 0x12010178UL, 0x001C0000UL, + 0x32010178UL, 0x1FE00410UL, + 0x12010180UL, 0x00000779UL, + 0x32010180UL, 0x00000002UL, + 0x02020184UL, 0x00000000UL, + /* 0188 */ 0x00000050UL, + 0x03014FFCUL, (uint32_t) &phyInfo, + 0xFFFFFFFFUL, +}; + +const RAIL_ChannelConfigEntry_t Protocol_Configuration_channels[] = { + { + .phyConfigDeltaAdd = NULL, + .baseFrequency = 2450000000, + .channelSpacing = 1000000, + .physicalChannelOffset = 0, + .channelNumberStart = 0, + .channelNumberEnd = 20, + .maxPower = RAIL_TX_POWER_MAX, + .attr = &channelConfigEntryAttr, +#ifdef RADIO_CONFIG_ENABLE_CONC_PHY + .entryType = 0, +#endif +#ifdef RADIO_CONFIG_ENABLE_STACK_INFO + .stackInfo = NULL, +#endif + }, +}; + +const RAIL_ChannelConfig_t Protocol_Configuration_channelConfig = { + .phyConfigBase = Protocol_Configuration_modemConfigBase, + .phyConfigDeltaSubtract = NULL, + .configs = Protocol_Configuration_channels, + .length = 1U, + .signature = 0UL, +}; + +const RAIL_ChannelConfig_t *channelConfigs[] = { + &Protocol_Configuration_channelConfig, + NULL +}; + + +#ifdef RADIO_CONFIG_ENABLE_STACK_INFO +#endif // RADIO_CONFIG_ENABLE_STACK_INFO + +uint32_t protocolAccelerationBuffer[435]; diff --git a/samples/simple_txrx/src/rail-configs/xg24_dk2601b/rail_config.h b/samples/simple_txrx/src/rail-configs/xg24_dk2601b/rail_config.h new file mode 100644 index 0000000..df21122 --- /dev/null +++ b/samples/simple_txrx/src/rail-configs/xg24_dk2601b/rail_config.h @@ -0,0 +1,52 @@ +/***************************************************************************//** + * @brief RAIL Configuration + * @details + * WARNING: Auto-Generated Radio Config Header - DO NOT EDIT + * Radio Configurator Version: 2022.5.2 + * RAIL Adapter Version: 2.4.19 + * RAIL Compatibility: 2.x + ******************************************************************************* + * # License + * Copyright 2019 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* + * + * SPDX-License-Identifier: Zlib + * + * The licensor of this software is Silicon Laboratories Inc. + * + * This software is provided 'as-is', without any express or implied + * warranty. In no event will the authors be held liable for any damages + * arising from the use of this software. + * + * Permission is granted to anyone to use this software for any purpose, + * including commercial applications, and to alter it and redistribute it + * freely, subject to the following restrictions: + * + * 1. The origin of this software must not be misrepresented; you must not + * claim that you wrote the original software. If you use this software + * in a product, an acknowledgment in the product documentation would be + * appreciated but is not required. + * 2. Altered source versions must be plainly marked as such, and must not be + * misrepresented as being the original software. + * 3. This notice may not be removed or altered from any source distribution. + * + ******************************************************************************/ + +#ifndef __RAIL_CONFIG_H__ +#define __RAIL_CONFIG_H__ + +#include +#include "rail_types.h" + +#define PROTOCOL_ACCELERATION_BUFFER protocolAccelerationBuffer +extern uint32_t protocolAccelerationBuffer[]; +#define RADIO_CONFIG_XTAL_FREQUENCY 39000000UL + +#define RAIL0_CHANNEL_GROUP_1_PHY_STUDIO_2450M_2GFSK_1MBPS_500K +#define RAIL0_CHANNEL_GROUP_1_PROFILE_BASE +extern const RAIL_ChannelConfig_t *channelConfigs[]; + +#ifdef RADIO_CONFIG_ENABLE_STACK_INFO +#endif // RADIO_CONFIG_ENABLE_STACK_INFO + +#endif // __RAIL_CONFIG_H__