From 14bb15d91f1ada0808feffe95dbb60f173a0fbf5 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Thu, 11 Jun 2020 15:05:21 +0200 Subject: [PATCH] drivers/at86rf215: make reset pulse width configurable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some hardware designers like to include filtering capacitors into reset lines in order to protect against ESD or other pulses. This increases the raise time of the reset signal. To still reach the required 16 µs reset pulse width, we thus have to increase the reset pulse width via board config. --- drivers/at86rf215/Kconfig | 11 +++++++++++ drivers/at86rf215/at86rf215_internal.c | 2 +- drivers/at86rf215/include/at86rf215_internal.h | 5 ++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/at86rf215/Kconfig b/drivers/at86rf215/Kconfig index 063bd09ab2..2c6686fe68 100644 --- a/drivers/at86rf215/Kconfig +++ b/drivers/at86rf215/Kconfig @@ -38,6 +38,17 @@ config AT86RF215_TRIM_VAL 26 MHz the best. For more information Refer Table 6-25 TRIM in Datasheet +config AT86RF215_RESET_PULSE_WIDTH_US + int "Width of the reset pulse (µs)" + range 16 1000 + default 16 + help + If your board design includes a filtering capacitor on the reset line, this raises + the rise time of the reset pulse. + To accommodate for this, select a larger reset pulse width here. + + If unsure, leave this at the default value of 16 µs. + choice prompt "Default Modulation" diff --git a/drivers/at86rf215/at86rf215_internal.c b/drivers/at86rf215/at86rf215_internal.c index 01b04c9e2f..0592d787a2 100644 --- a/drivers/at86rf215/at86rf215_internal.c +++ b/drivers/at86rf215/at86rf215_internal.c @@ -49,7 +49,7 @@ int at86rf215_hardware_reset(at86rf215_t *dev) /* trigger hardware reset */ gpio_clear(dev->params.reset_pin); - xtimer_usleep(AT86RF215_RESET_PULSE_WIDTH_US); + xtimer_usleep(CONFIG_AT86RF215_RESET_PULSE_WIDTH_US); gpio_set(dev->params.reset_pin); xtimer_usleep(AT86RF215_RESET_DELAY_US); diff --git a/drivers/at86rf215/include/at86rf215_internal.h b/drivers/at86rf215/include/at86rf215_internal.h index 9b08f85397..35da96345a 100644 --- a/drivers/at86rf215/include/at86rf215_internal.h +++ b/drivers/at86rf215/include/at86rf215_internal.h @@ -22,6 +22,7 @@ #include #include "at86rf215.h" #include "at86rf215_registers.h" +#include "board.h" #ifdef __cplusplus extern "C" { @@ -30,7 +31,9 @@ extern "C" { /** * @brief Minimum reset pulse width (tRST) in µs */ -#define AT86RF215_RESET_PULSE_WIDTH_US (16U) +#ifndef CONFIG_AT86RF215_RESET_PULSE_WIDTH_US +#define CONFIG_AT86RF215_RESET_PULSE_WIDTH_US (16U) +#endif /** * @brief The typical transition time to TRX_OFF after reset (tPOWERON) in µs