From 73bb18a05355d3789d34f37dc609927c6af4ae4e Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Thu, 28 May 2020 04:48:55 -0700 Subject: [PATCH] px4_fmu-v6x: Limit Slew rate So IMU works with DMA The defualt in NuttX is OSPEED of 50Mhz. This is realy a slew rate control. At the default high slew rate the overshoot was .7 Volts. On a ICM20649 this was causing the device to output garbage. All 0s N.B. A passive scope or Logic analyser's probes load will mask the failure. Useed a FET probe to verify the issue. --- .../px4/fmu-v6x/nuttx-config/include/board.h | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/boards/px4/fmu-v6x/nuttx-config/include/board.h b/boards/px4/fmu-v6x/nuttx-config/include/board.h index a635efb8f6..441d7d3cd9 100644 --- a/boards/px4/fmu-v6x/nuttx-config/include/board.h +++ b/boards/px4/fmu-v6x/nuttx-config/include/board.h @@ -408,25 +408,27 @@ * */ -#define GPIO_SPI1_MISO GPIO_SPI1_MISO_3 /* PG9 */ -#define GPIO_SPI1_MOSI GPIO_SPI1_MOSI_2 /* PB5 */ -#define GPIO_SPI1_SCK GPIO_SPI1_SCK_1 /* PA5 */ +#define ADJ_SLEW_RATE(p) (((p) & ~GPIO_SPEED_MASK) | (GPIO_SPEED_2MHz)) -#define GPIO_SPI2_MISO GPIO_SPI2_MISO_3 /* PI2 */ -#define GPIO_SPI2_MOSI GPIO_SPI2_MOSI_4 /* PI3 */ -#define GPIO_SPI2_SCK GPIO_SPI2_SCK_6 /* PI1 */ +#define GPIO_SPI1_MISO GPIO_SPI1_MISO_3 /* PG9 */ +#define GPIO_SPI1_MOSI GPIO_SPI1_MOSI_2 /* PB5 */ +#define GPIO_SPI1_SCK ADJ_SLEW_RATE(GPIO_SPI1_SCK_1) /* PA5 */ -#define GPIO_SPI3_MISO GPIO_SPI3_MISO_2 /* PC11 */ -#define GPIO_SPI3_MOSI GPIO_SPI3_MOSI_3 /* PB2 */ -#define GPIO_SPI3_SCK GPIO_SPI3_SCK_2 /* PC10 */ +#define GPIO_SPI2_MISO GPIO_SPI2_MISO_3 /* PI2 */ +#define GPIO_SPI2_MOSI GPIO_SPI2_MOSI_4 /* PI3 */ +#define GPIO_SPI2_SCK ADJ_SLEW_RATE(GPIO_SPI2_SCK_6) /* PI1 */ -#define GPIO_SPI5_MISO GPIO_SPI5_MISO_2 /* PH7 */ -#define GPIO_SPI5_MOSI GPIO_SPI5_MOSI_1 /* PF11 */ -#define GPIO_SPI5_SCK GPIO_SPI5_SCK_1 /* PF7 */ +#define GPIO_SPI3_MISO GPIO_SPI3_MISO_2 /* PC11 */ +#define GPIO_SPI3_MOSI GPIO_SPI3_MOSI_3 /* PB2 */ +#define GPIO_SPI3_SCK ADJ_SLEW_RATE(GPIO_SPI3_SCK_2) /* PC10 */ -#define GPIO_SPI6_MISO GPIO_SPI6_MISO_2 /* PA6 */ -#define GPIO_SPI6_MOSI GPIO_SPI6_MOSI_1 /* PG14 */ -#define GPIO_SPI6_SCK GPIO_SPI6_SCK_3 /* PB3 */ +#define GPIO_SPI5_MISO GPIO_SPI5_MISO_2 /* PH7 */ +#define GPIO_SPI5_MOSI GPIO_SPI5_MOSI_1 /* PF11 */ +#define GPIO_SPI5_SCK ADJ_SLEW_RATE(GPIO_SPI5_SCK_1) /* PF7 */ + +#define GPIO_SPI6_MISO GPIO_SPI6_MISO_2 /* PA6 */ +#define GPIO_SPI6_MOSI GPIO_SPI6_MOSI_1 /* PG14 */ +#define GPIO_SPI6_SCK ADJ_SLEW_RATE(GPIO_SPI6_SCK_3) /* PB3 */ /* I2C *