Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
415 changes: 415 additions & 0 deletions ROMFS/robomaster_common/init.d/rc.interface

Large diffs are not rendered by default.

23 changes: 14 additions & 9 deletions ROMFS/robomaster_common/init.d/rcS
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ set IO_PRESENT no
# set MAV_TYPE none
# set MIXER none
# set MIXER_AUX none
# set MIXER_FILE none
set MIXER_FILE none
# set MK_MODE none
# set MKBLCTRL_ARG ""
# set OUTPUT_MODE none
set OUTPUT_MODE none
# set PARAM_FILE /fs/microsd/params
# set PWM_AUX_DISARMED p:PWM_AUX_DISARMED
# set PWM_AUX_MAX p:PWM_AUX_MAX
Expand All @@ -41,7 +41,7 @@ set IO_PRESENT no
# set PWM_MIN p:PWM_MIN
# set PWM_OUT none
# set PWM_RATE p:PWM_RATE
# set RC_INPUT_ARGS ""
set RC_INPUT_ARGS ""
# set SDCARD_MIXERS_PATH /fs/microsd/etc/mixers
set STARTUP_TUNE 1
# set USE_IO no
Expand Down Expand Up @@ -93,7 +93,7 @@ fi
# Needs to be started after the parameters are loaded (for CBRK_BUZZER).
# Note that this will still play the already published startup tone.
#
tone_alarm start
# tone_alarm start

#
# Play the startup tune (if not disabled or there is an error)
Expand Down Expand Up @@ -189,6 +189,10 @@ then
fi
unset BOARD_RC_MAVLINK

#
# Start djican to create can_output0
#
djican start

#
# Start UART/Serial device drivers.
Expand All @@ -199,8 +203,9 @@ sh /etc/init.d/rc.serial


# Must be started after the serial config is read
rc_input start $RC_INPUT_ARGS
# rc_input start /dev/ttyS0
echo $RC_INPUT_ARGS
# rc_input start $RC_INPUT_ARGS
# rc_input start -d /dev/ttyS0

#
# Configure vehicle type specific parameters.
Expand Down Expand Up @@ -250,10 +255,10 @@ unset IO_PRESENT
# unset MAV_TYPE
# unset MIXER
# unset MIXER_AUX
# unset MIXER_FILE
unset MIXER_FILE
# unset MK_MODE
# unset MKBLCTRL_ARG
# unset OUTPUT_MODE
unset OUTPUT_MODE
unset PARAM_DEFAULTS_VER
# unset PARAM_FILE
# unset PWM_AUX_DISARMED
Expand All @@ -266,7 +271,7 @@ unset PARAM_DEFAULTS_VER
# unset PWM_MIN
# unset PWM_OUT
# unset PWM_RATE
# unset RC_INPUT_ARGS
unset RC_INPUT_ARGS
# unset SDCARD_MIXERS_PATH
unset STARTUP_TUNE
# unset USE_IO
Expand Down
7 changes: 5 additions & 2 deletions boards/robomaster/dev-c/default.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ px4_add_board(
TESTING
# UAVCAN_INTERFACES 2
SERIAL_PORTS
URT6:/dev/ttyS0
RC:/dev/ttyS0
# URT6:/dev/ttyS0
DRIVERS
# adc
# barometer # all available barometer drivers
Expand Down Expand Up @@ -47,6 +48,8 @@ px4_add_board(
# test_ppm
tone_alarm
# uavcan
djican
rc_input
MODULES
commander
attitude_estimator_q
Expand Down Expand Up @@ -83,7 +86,7 @@ px4_add_board(
# hardfault_log
i2cdetect
# led_control
# mixer
mixer
# motor_ramp
# motor_test
# mtd
Expand Down
15 changes: 12 additions & 3 deletions boards/robomaster/dev-c/nuttx-config/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,15 @@
#define GPIO_USART6_RX GPIO_USART6_RX_2
#define GPIO_USART6_TX GPIO_USART6_TX_2


/* DBUS
*
* USART3 RX: PC11
*/
#define GPIO_USART3_RX GPIO_USART3_RX_2
#define GPIO_USART3_TX 0


/* PWM
*
* The STM3240G-Eval has no real on-board PWM devices, but the board can be
Expand Down Expand Up @@ -408,8 +417,8 @@
#define GPIO_CAN1_RX GPIO_CAN1_RX_3
#define GPIO_CAN1_TX GPIO_CAN1_TX_3

#define GPIO_CAN2_RX GPIO_CAN2_RX_2
#define GPIO_CAN2_TX GPIO_CAN2_TX_2
// #define GPIO_CAN2_RX GPIO_CAN2_RX_2
// #define GPIO_CAN2_TX GPIO_CAN2_TX_2

/* I2C. Only I2C1 is available on the STM3240G-EVAL. I2C1_SCL and I2C1_SDA are
* available on the following pins:
Expand Down Expand Up @@ -468,7 +477,7 @@
#define GPIO_SPI1_MOSI GPIO_SPI1_MOSI_1

// dma stuff
#define DMAMAP_USART1_RX DMAMAP_USART1_RX_2
// #define DMAMAP_USART1_RX DMAMAP_USART1_RX_2
// #define DMAMAP_USART6_RX DMAMAP_USART6_RX_2

/* DMA Channel/Stream Selections *****************************************************/
Expand Down
14 changes: 14 additions & 0 deletions boards/robomaster/dev-c/nuttx-config/nsh/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,16 @@ CONFIG_CDCACM_TXBUFSIZE=2000
CONFIG_CDCACM_VENDORID=0x26ac
CONFIG_CDCACM_VENDORSTR="NUS RoboMaster"
CONFIG_CLOCK_MONOTONIC=y
CONFIG_DEBUG_CAN=y
CONFIG_DEBUG_CAN_ERROR=y
CONFIG_DEBUG_CAN_WARN=y
CONFIG_DEBUG_ERROR=y
CONFIG_DEBUG_FEATURES=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_HARDFAULT_ALERT=y
CONFIG_DEBUG_INFO=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEBUG_WARN=y
CONFIG_DEFAULT_SMALL=y
CONFIG_DEV_FIFO_SIZE=0
CONFIG_DEV_PIPE_MAXSIZE=1024
Expand Down Expand Up @@ -100,6 +107,7 @@ CONFIG_NSH_NESTDEPTH=8
CONFIG_NSH_QUOTE=y
CONFIG_NSH_ROMFSETC=y
CONFIG_NSH_STRERROR=y
CONFIG_NSH_USBCONSOLE=y
CONFIG_NSH_VARS=y
CONFIG_PIPES=y
CONFIG_PREALLOC_TIMERS=4
Expand Down Expand Up @@ -129,6 +137,8 @@ CONFIG_STDIO_BUFFER_SIZE=32
CONFIG_STM32_BBSRAM=y
CONFIG_STM32_BBSRAM_FILES=5
CONFIG_STM32_BKPSRAM=y
CONFIG_STM32_CAN1=y
CONFIG_STM32_CAN1_BAUD=1000000
CONFIG_STM32_CCMDATARAM=y
CONFIG_STM32_DISABLE_IDLE_SLEEP_DURING_DEBUG=y
CONFIG_STM32_FLASH_CONFIG_G=y
Expand All @@ -146,6 +156,7 @@ CONFIG_STM32_SERIALBRK_BSDCOMPAT=y
CONFIG_STM32_SERIAL_DISABLE_REORDERING=y
CONFIG_STM32_SPI1=y
CONFIG_STM32_USART1=y
CONFIG_STM32_USART3=y
CONFIG_STM32_USART6=y
CONFIG_STM32_USART_BREAKS=y
CONFIG_STM32_USART_SINGLEWIRE=y
Expand All @@ -154,6 +165,9 @@ CONFIG_SYSTEM_NSH=y
CONFIG_TASK_NAME_SIZE=24
CONFIG_TIME_EXTENDED=y
CONFIG_USART1_SERIAL_CONSOLE=y
CONFIG_USART3_BAUD=100000
CONFIG_USART3_PARITY=2
CONFIG_USART3_RXDMA=y
CONFIG_USBDEV=y
CONFIG_USBDEV_BUSPOWERED=y
CONFIG_USER_ENTRYPOINT="nsh_main"
7 changes: 6 additions & 1 deletion boards/robomaster/dev-c/src/board_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,19 @@
// #define PX4IO_SERIAL_VECTOR STM32_IRQ_USART6
// #define PX4IO_SERIAL_TX_DMAMAP DMAMAP_USART6_TX
// #define PX4IO_SERIAL_RX_DMAMAP DMAMAP_USART6_RX
// #define PX4IO_SERIAL_RCC_REG STM32_RCC_APB2ENR
// #define PX4IO_SERIAL_RCC_REG STM32_RCC_APB1ENR
// #define PX4IO_SERIAL_RCC_EN RCC_APB2ENR_USART6EN
// #define PX4IO_SERIAL_CLOCK STM32_PCLK2_FREQUENCY
// #define PX4IO_SERIAL_BITRATE 1500000 /* 1.5Mbps -> max rate for IO */

#define FLASH_BASED_PARAMS
// #define FLASH_BASED_DATAMAN

// setting uavcan stuff
// #define UAVCAN_STM32_NUTTX
// #define RCC_APB1ENR_CAN1EN
// #define UAVCAN_NUM_IFACES_RUNTIME 1

/* PX4FMU GPIOs ***********************************************************************************/

/**
Expand Down
2 changes: 2 additions & 0 deletions boards/robomaster/dev-c/src/can.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ int can_devinit(void);

int can_devinit(void)
{
syslog(LOG_INFO, "can dev init\n");
static bool initialized = false;
struct can_dev_s *can;
int ret;
Expand All @@ -113,6 +114,7 @@ int can_devinit(void)
/* Register the CAN driver at "/dev/can0" */

ret = can_register("/dev/can0", can);
syslog(LOG_INFO, "can dev registered at /dev/can0\n");

if (ret < 0) {
canerr("ERROR: can_register failed: %d\n", ret);
Expand Down
4 changes: 4 additions & 0 deletions boards/robomaster/dev-c/src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@
#include <px4_platform_common/init.h>
#include <px4_platform/board_dma_alloc.h>

#include "can.c"

#include <dataman/dataman.h>

#if defined(FLASH_BASED_PARAMS)
Expand Down Expand Up @@ -378,6 +380,8 @@ __EXPORT int board_app_initialize(uintptr_t arg)
/* configure SPI interfaces (after the hw is determined) */
stm32_spiinitialize();

can_devinit();

px4_platform_init();

/* configure the DMA allocator */
Expand Down
1 change: 1 addition & 0 deletions msg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ set(msg_files
collision_report.msg
commander_state.msg
cpuload.msg
can_motor.msg
debug_array.msg
debug_key_value.msg
debug_value.msg
Expand Down
17 changes: 17 additions & 0 deletions msg/can_motor.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
uint64 timestamp # time since system start (microseconds)

# uint8 data0
# uint8 data1
# uint8 data2
# uint8 data3
# uint8 data4
# uint8 data5
# uint8 data6
# uint8 data7

# values read from the dji motor

uint16 mech_angle
uint16 rot_speed
uint16 torque
uint8 temp
1 change: 0 additions & 1 deletion platforms/nuttx/src/px4/common/px4_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@

int px4_platform_init(void)
{
syslog(LOG_INFO, "px4_platform_init\n");

syslog(LOG_INFO, "px4_platform_init\n");

Expand Down
8 changes: 8 additions & 0 deletions src/drivers/djican/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
px4_add_module(
MODULE drivers__djican
MAIN djican
SRCS
djican.cpp
DEPENDS
px4_work_queue
)
Loading