Skip to content

Commit

Permalink
WIP: IMU SPI DMA
Browse files Browse the repository at this point in the history
  • Loading branch information
dagar committed Jul 9, 2019
1 parent d1e4673 commit 4c209bd
Show file tree
Hide file tree
Showing 74 changed files with 254 additions and 255 deletions.
2 changes: 1 addition & 1 deletion boards/aerotenna/ocpoc/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
#
############################################################################

px4_add_library(drivers_board
add_library(drivers_board
${PX4_SOURCE_DIR}/src/drivers/boards/common/board_identity.c # TODO: this is horrible and should be fixed
)
3 changes: 3 additions & 0 deletions boards/airmind/mindpx-v2/nuttx-config/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@
#define GPIO_SPI4_MOSI (GPIO_SPI4_MOSI_1|GPIO_SPEED_50MHz)
#define GPIO_SPI4_SCK (GPIO_SPI4_SCK_1|GPIO_SPEED_50MHz)

#define DMACHAN_SPI4_RX DMAMAP_SPI4_RX_1
#define DMACHAN_SPI4_TX DMAMAP_SPI4_TX_2

/************************************************************************************
* Public Data
************************************************************************************/
Expand Down
2 changes: 2 additions & 0 deletions boards/airmind/mindpx-v2/nuttx-config/nsh/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ CONFIG_STM32_SERIAL_DISABLE_REORDERING=y
CONFIG_STM32_SPI1=y
CONFIG_STM32_SPI2=y
CONFIG_STM32_SPI4=y
CONFIG_STM32_SPI4_DMA=y
CONFIG_STM32_SPI_DMA=y
CONFIG_STM32_TIM10=y
CONFIG_STM32_TIM11=y
CONFIG_STM32_TIM1=y
Expand Down
2 changes: 1 addition & 1 deletion boards/airmind/mindpx-v2/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#
############################################################################

px4_add_library(drivers_board
add_library(drivers_board
can.c
init.c
led.c
Expand Down
2 changes: 1 addition & 1 deletion boards/airmind/mindpx-v2/src/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@

/* This board provides a DMA pool and APIs */

#define BOARD_DMA_ALLOC_POOL_SIZE 5120
#define BOARD_DMA_ALLOC_POOL_SIZE 6144 // 5120 fat + 1024 spi

/* This board provides the board_on_reset interface */

Expand Down
2 changes: 1 addition & 1 deletion boards/atlflight/eagle/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#
############################################################################

px4_add_library(drivers_board
add_library(drivers_board
${PX4_SOURCE_DIR}/src/drivers/boards/common/board_identity.c # TODO: this is horrible and should be fixed
sitl_led.c
)
2 changes: 1 addition & 1 deletion boards/auav/esc35-v1/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ message(WARNING "Configuraton is incomplete")
message(WARNING "DO NOT RUN THIS ON HW")
message(WARNING "IT IS NOT PINED OUT TO HW")

px4_add_library(drivers_board
add_library(drivers_board
init.c
led.c
usb.c
Expand Down
16 changes: 8 additions & 8 deletions boards/auav/x21/nuttx-config/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,8 @@

/* Alternate function pin selections ************************************************/

/*
* UARTs.
*/
/* UARTs */

#define GPIO_USART1_RX GPIO_USART1_RX_1 /* Console in from IO */
#define GPIO_USART1_TX 0 /* USART1 is RX-only */

Expand All @@ -234,16 +233,14 @@
#define GPIO_UART7_RX GPIO_UART7_RX_1
#define GPIO_UART7_TX GPIO_UART7_TX_1


/* UART8 has no alternate pin config */

/* UART RX DMA configurations */

#define DMAMAP_USART1_RX DMAMAP_USART1_RX_2
#define DMAMAP_USART6_RX DMAMAP_USART6_RX_2

/*
* CAN
/* CAN
*
* CAN1 is routed to the onboard transceiver.
*/
Expand All @@ -262,15 +259,18 @@
#define GPIO_I2C1_SCL_GPIO (GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN8)
#define GPIO_I2C1_SDA_GPIO (GPIO_OUTPUT|GPIO_OPENDRAIN|GPIO_SPEED_50MHz|GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN9)

/*
* SPI
/* SPI
*
* There are sensors on SPI1, and SPI2 is connected to the FRAM.
*/

#define GPIO_SPI1_MISO GPIO_SPI1_MISO_1
#define GPIO_SPI1_MOSI GPIO_SPI1_MOSI_1
#define GPIO_SPI1_SCK GPIO_SPI1_SCK_1

#define DMACHAN_SPI1_RX DMAMAP_SPI1_RX_1
#define DMACHAN_SPI1_TX DMAMAP_SPI1_TX_1

#define GPIO_SPI2_MISO GPIO_SPI2_MISO_1
#define GPIO_SPI2_MOSI GPIO_SPI2_MOSI_1
#define GPIO_SPI2_SCK GPIO_SPI2_SCK_2
Expand Down
2 changes: 2 additions & 0 deletions boards/auav/x21/nuttx-config/nsh/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ CONFIG_STM32_SDIO_CARD=y
CONFIG_STM32_SERIALBRK_BSDCOMPAT=y
CONFIG_STM32_SERIAL_DISABLE_REORDERING=y
CONFIG_STM32_SPI1=y
CONFIG_STM32_SPI1_DMA=y
CONFIG_STM32_SPI2=y
CONFIG_STM32_SPI_DMA=y
CONFIG_STM32_TIM10=y
CONFIG_STM32_TIM11=y
CONFIG_STM32_TIM1=y
Expand Down
2 changes: 1 addition & 1 deletion boards/auav/x21/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#
############################################################################

px4_add_library(drivers_board
add_library(drivers_board
can.c
init.c
led.c
Expand Down
2 changes: 1 addition & 1 deletion boards/auav/x21/src/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS

/* This board provides a DMA pool and APIs */
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
#define BOARD_DMA_ALLOC_POOL_SIZE 6144 // 5120 fat + 1024 spi

/* This board provides the board_on_reset interface */

Expand Down
6 changes: 6 additions & 0 deletions boards/av/x-v1/nuttx-config/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,16 @@
#define GPIO_SPI1_MOSI GPIO_SPI1_MOSI_2 /* PB5 */
#define GPIO_SPI1_SCK GPIO_SPI1_SCK_1 /* PA5 */

#define DMAMAP_SPI1_RX DMAMAP_SPI1_RX_1
#define DMAMAP_SPI1_TX DMAMAP_SPI1_TX_2

#define GPIO_SPI2_MISO GPIO_SPI2_MISO_3 /* PI2 */
#define GPIO_SPI2_MOSI GPIO_SPI2_MOSI_3 /* PI3 */
#define GPIO_SPI2_SCK GPIO_SPI2_SCK_4 /* PD3 */

//#define DMAMAP_SPI2_RX DMAMAP_SPI2_RX_1
//#define DMAMAP_SPI2_TX DMAMAP_SPI2_TX_1

#define GPIO_SPI4_MISO GPIO_SPI4_MISO_1 /* PE5 */
#define GPIO_SPI4_MOSI GPIO_SPI4_MOSI_1 /* PE6 */
#define GPIO_SPI4_SCK GPIO_SPI4_SCK_1 /* PE2 */
Expand Down
12 changes: 9 additions & 3 deletions boards/av/x-v1/nuttx-config/nsh/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ CONFIG_ARMV7M_USEBASEPRI=y
CONFIG_BOARDCTL_FINALINIT=y
CONFIG_BOARDCTL_RESET=y
CONFIG_BOARD_CRASHDUMP=y
CONFIG_BOARD_LOOPSPERMSEC=43103
CONFIG_BOARD_LOOPSPERMSEC=22114
CONFIG_BOARD_RESET_ON_ASSERT=2
CONFIG_BUILTIN=y
CONFIG_C99_BOOL8=y
Expand All @@ -73,7 +73,10 @@ CONFIG_FS_CROMFS=y
CONFIG_FS_FAT=y
CONFIG_FS_FATTIME=y
CONFIG_FS_PROCFS=y
CONFIG_FS_PROCFS_INCLUDE_PROGMEM=y
CONFIG_FS_PROCFS_EXCLUDE_BLOCKS=y
CONFIG_FS_PROCFS_EXCLUDE_MOUNT=y
CONFIG_FS_PROCFS_EXCLUDE_MOUNTS=y
CONFIG_FS_PROCFS_EXCLUDE_USAGE=y
CONFIG_FS_PROCFS_REGISTER=y
CONFIG_FS_ROMFS=y
CONFIG_GRAN=y
Expand Down Expand Up @@ -146,7 +149,7 @@ CONFIG_PREALLOC_WDOGS=50
CONFIG_PRIORITY_INHERITANCE=y
CONFIG_PTHREAD_MUTEX_ROBUST=y
CONFIG_PTHREAD_STACK_MIN=512
CONFIG_RAM_SIZE=376832
CONFIG_RAM_SIZE=245760
CONFIG_RAM_START=0x20010000
CONFIG_RAW_BINARY=y
CONFIG_RTC_DATETIME=y
Expand Down Expand Up @@ -204,9 +207,12 @@ CONFIG_STM32F7_SDMMC_DMA=y
CONFIG_STM32F7_SERIALBRK_BSDCOMPAT=y
CONFIG_STM32F7_SERIAL_DISABLE_REORDERING=y
CONFIG_STM32F7_SPI1=y
CONFIG_STM32F7_SPI1_DMA=y
CONFIG_STM32F7_SPI2=y
CONFIG_STM32F7_SPI2_DMA=y
CONFIG_STM32F7_SPI4=y
CONFIG_STM32F7_SPI5=y
CONFIG_STM32F7_SPI_DMA=y
CONFIG_STM32F7_TIM10=y
CONFIG_STM32F7_TIM11=y
CONFIG_STM32F7_TIM14=y
Expand Down
5 changes: 3 additions & 2 deletions boards/av/x-v1/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,18 @@
#
############################################################################

px4_add_library(drivers_board
add_library(drivers_board
init.c
manifest.c
sdio.c
spi.cpp
timer_config.c
)

target_link_libraries(drivers_board
PRIVATE
drivers__led # drv_led_start
nuttx_arch # sdio
nuttx_drivers # sdio
px4_layer
)
)
2 changes: 1 addition & 1 deletion boards/av/x-v1/src/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@

/* This board provides a DMA pool and APIs */

#define BOARD_DMA_ALLOC_POOL_SIZE 5120
#define BOARD_DMA_ALLOC_POOL_SIZE 6144 // 5120 fat + 1024 spi

/* This board provides the board_on_reset interface */

Expand Down
2 changes: 1 addition & 1 deletion boards/beaglebone/blue/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error")

px4_add_library(drivers_board
add_library(drivers_board
init.c
${PX4_SOURCE_DIR}/src/drivers/boards/common/board_identity.c # TODO: this is horrible and should be fixed
)
Expand Down
2 changes: 1 addition & 1 deletion boards/bitcraze/crazyflie/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#
############################################################################

px4_add_library(drivers_board
add_library(drivers_board
init.c
led.c
spi.c
Expand Down
5 changes: 2 additions & 3 deletions boards/bitcraze/crazyflie/src/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
************************************************************************************/

#include <px4_config.h>
#include <px4_log.h>

#include <stdint.h>
#include <stdbool.h>
Expand Down Expand Up @@ -69,15 +68,15 @@ __EXPORT int stm32_spi_bus_initialize(void)
spi_expansion = stm32_spibus_initialize(PX4_SPI_BUS_EXPANSION);

if (!spi_expansion) {
PX4_ERR("[boot] FAILED to initialize SPI port %d\n", PX4_SPI_BUS_EXPANSION);
syslog(LOG_ERR, "[boot] FAILED to initialize SPI port %d\n", PX4_SPI_BUS_EXPANSION);
return -ENODEV;
}

#ifdef CONFIG_MMCSD
int ret = mmcsd_spislotinitialize(CONFIG_NSH_MMCSDMINOR, CONFIG_NSH_MMCSDSLOTNO, spi_expansion);

if (ret != OK) {
PX4_ERR("[boot] FAILED to bind SPI port 1 to the MMCSD driver\n");
syslog(LOG_ERR, "[boot] FAILED to bind SPI port 1 to the MMCSD driver\n");
return -ENODEV;
}

Expand Down
2 changes: 1 addition & 1 deletion boards/emlid/navio2/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
#
############################################################################

px4_add_library(drivers_board
add_library(drivers_board
${PX4_SOURCE_DIR}/src/drivers/boards/common/board_identity.c # TODO: this is horrible and should be fixed
)
3 changes: 3 additions & 0 deletions boards/intel/aerofc-v1/nuttx-config/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@
#define GPIO_SPI1_MISO (GPIO_SPI1_MISO_1 | GPIO_SPEED_50MHz)
#define GPIO_SPI1_MOSI (GPIO_SPI1_MOSI_1 | GPIO_SPEED_50MHz)

#define DMACHAN_SPI1_RX DMAMAP_SPI1_RX_1
#define DMACHAN_SPI1_TX DMAMAP_SPI1_TX_1

/* The following Pin Mapping is just for completeness */
/*
* JTAG
Expand Down
2 changes: 2 additions & 0 deletions boards/intel/aerofc-v1/nuttx-config/nsh/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ CONFIG_STM32_RTC_MAGIC_REG=1
CONFIG_STM32_SERIALBRK_BSDCOMPAT=y
CONFIG_STM32_SERIAL_DISABLE_REORDERING=y
CONFIG_STM32_SPI1=y
CONFIG_STM32_SPI1_DMA=y
CONFIG_STM32_SPI_DMA=y
CONFIG_STM32_TIM10=y
CONFIG_STM32_TIM11=y
CONFIG_STM32_TIM1=y
Expand Down
2 changes: 1 addition & 1 deletion boards/intel/aerofc-v1/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#
############################################################################

px4_add_library(drivers_board
add_library(drivers_board
init.c
led.c
spi.c
Expand Down
3 changes: 3 additions & 0 deletions boards/intel/aerofc-v1/src/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@
*/
#define BOARD_TAP_ESC_MODE 1

/* This board provides a DMA pool and APIs. */
#define BOARD_DMA_ALLOC_POOL_SIZE 6144 // 5120 fat + 1024 spi

#define MEMORY_CONSTRAINED_SYSTEM

#define BOARD_CRASHDUMP_RESET_ONLY
Expand Down
4 changes: 2 additions & 2 deletions boards/nxp/fmuk66-v3/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#
############################################################################

px4_add_library(drivers_board
add_library(drivers_board
autoleds.c
automount.c
can.c
Expand All @@ -49,4 +49,4 @@ target_link_libraries(drivers_board
nuttx_drivers # sdio
drivers__led # drv_led_start
px4_layer
)
)
3 changes: 3 additions & 0 deletions boards/omnibus/f4sd/nuttx-config/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,9 @@
#define GPIO_SPI1_MISO GPIO_SPI1_MISO_1
#define GPIO_SPI1_MOSI GPIO_SPI1_MOSI_1

#define DMACHAN_SPI1_RX DMAMAP_SPI1_RX_1
#define DMACHAN_SPI1_TX DMAMAP_SPI1_TX_1

/* SPI2:
* SD Card
* CS: PB12 -- configured in board_config.h
Expand Down
2 changes: 2 additions & 0 deletions boards/omnibus/f4sd/nuttx-config/nsh/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,10 @@ CONFIG_STM32_SDIO_CARD=y
CONFIG_STM32_SERIALBRK_BSDCOMPAT=y
CONFIG_STM32_SERIAL_DISABLE_REORDERING=y
CONFIG_STM32_SPI1=y
CONFIG_STM32_SPI1_DMA=y
CONFIG_STM32_SPI2=y
CONFIG_STM32_SPI3=y
CONFIG_STM32_SPI_DMA=y
CONFIG_STM32_TIM1=y
CONFIG_STM32_TIM3=y
CONFIG_STM32_TIM5=y
Expand Down
2 changes: 1 addition & 1 deletion boards/omnibus/f4sd/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#
############################################################################

px4_add_library(drivers_board
add_library(drivers_board
init.c
led.c
spi.c
Expand Down
2 changes: 1 addition & 1 deletion boards/omnibus/f4sd/src/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@
#define BOARD_HAS_PWM DIRECT_PWM_OUTPUT_CHANNELS

/* This board provides a DMA pool and APIs */
#define BOARD_DMA_ALLOC_POOL_SIZE 5120
#define BOARD_DMA_ALLOC_POOL_SIZE 6144 // 5120 fat + 1024 spi

#define BOARD_HAS_ON_RESET 1

Expand Down
2 changes: 1 addition & 1 deletion boards/parrot/bebop/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
#
############################################################################

px4_add_library(drivers_board
add_library(drivers_board
${PX4_SOURCE_DIR}/src/drivers/boards/common/board_identity.c # TODO: this is horrible and should be fixed
)
2 changes: 1 addition & 1 deletion boards/px4/cannode-v1/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#
############################################################################

px4_add_library(drivers_board
add_library(drivers_board
buttons.c
can.c
init.c
Expand Down
Loading

0 comments on commit 4c209bd

Please sign in to comment.