FIX: fixed the problem that the rtos sample can not run normally on M300 RTK extension port
Signed-off-by: DJI-Martin <DJI-Martin@dji.com>
This commit is contained in:
@ -64,7 +64,7 @@
|
||||
#define configTICK_RATE_HZ ((TickType_t)1000)
|
||||
#define configMAX_PRIORITIES ( 7 )
|
||||
#define configMINIMAL_STACK_SIZE ((uint16_t)128)
|
||||
#define configTOTAL_HEAP_SIZE ((size_t)64000)
|
||||
#define configTOTAL_HEAP_SIZE ((size_t)75000)
|
||||
#define configMAX_TASK_NAME_LEN ( 16 )
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configUSE_MUTEXES 1
|
||||
|
@ -62,11 +62,11 @@
|
||||
#define RUN_INDICATE_TASK_FREQ_0D1HZ 0.1f
|
||||
|
||||
#define DJI_USE_WIDGET_INTERACTION 0
|
||||
#define DJI_EXTENSION_PORT_SUPPORT 0
|
||||
|
||||
/* Private types -------------------------------------------------------------*/
|
||||
|
||||
/* Private values -------------------------------------------------------------*/
|
||||
static bool s_isApplicationStart = false;
|
||||
|
||||
/* Private functions declaration ---------------------------------------------*/
|
||||
static T_DjiReturnCode DjiUser_PrintConsole(const uint8_t *data, uint16_t dataLen);
|
||||
@ -113,8 +113,8 @@ void DjiUser_StartTask(void const *argument)
|
||||
UART_Init(DJI_CONSOLE_UART_NUM, DJI_CONSOLE_UART_BAUD);
|
||||
Led_Init(LED3);
|
||||
|
||||
//Attention: if you want to run payload sdk on extension port, please define the macro DJI_EXTENSION_PORT_SUPPORT.
|
||||
#if DJI_EXTENSION_PORT_SUPPORT
|
||||
//Attention: if you want to run payload sdk on extension port, please define the macro USE_USB_HOST_UART.
|
||||
#if USE_USB_HOST_UART
|
||||
MX_USB_HOST_Init();
|
||||
Osal_TaskSleepMs(2000);
|
||||
#endif
|
||||
@ -169,7 +169,7 @@ void DjiUser_StartTask(void const *argument)
|
||||
|
||||
returnCode = DjiTest_RegApplyHighPowerHandler(&applyHighPowerHandler);
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("regsiter apply high power handler error");
|
||||
USER_LOG_ERROR("register apply high power handler error");
|
||||
}
|
||||
|
||||
returnCode = DjiTest_PowerManagementStartService();
|
||||
@ -178,27 +178,12 @@ void DjiUser_StartTask(void const *argument)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MODULE_SAMPLE_CAMERA_ON
|
||||
returnCode = DjiTest_CameraEmuBaseStartService();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("camera emu common init error");
|
||||
goto out;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MODULE_SAMPLE_WIDGET_ON
|
||||
#if DJI_USE_WIDGET_INTERACTION
|
||||
returnCode = DjiTest_WidgetInteractionStartService();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("widget sample init error");
|
||||
}
|
||||
#else
|
||||
returnCode = DjiTest_WidgetStartService();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("widget sample init error");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MODULE_SAMPLE_DATA_TRANSMISSION_ON
|
||||
returnCode = DjiTest_DataTransmissionStartService();
|
||||
@ -214,6 +199,15 @@ void DjiUser_StartTask(void const *argument)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !USE_USB_HOST_UART
|
||||
#ifdef CONFIG_MODULE_SAMPLE_CAMERA_ON
|
||||
returnCode = DjiTest_CameraEmuBaseStartService();
|
||||
if (returnCode != DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
USER_LOG_ERROR("camera emu common init error");
|
||||
goto out;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MODULE_SAMPLE_GIMBAL_EMU_ON
|
||||
if (aircraftInfoBaseInfo.djiAdapterType == DJI_SDK_ADAPTER_TYPE_SKYPORT_V2 ||
|
||||
aircraftInfoBaseInfo.djiAdapterType == DJI_SDK_ADAPTER_TYPE_NONE) {
|
||||
@ -287,6 +281,7 @@ void DjiUser_StartTask(void const *argument)
|
||||
DJI_ERROR_SYSTEM_MODULE_CODE_SUCCESS) {
|
||||
printf("psdk upgrade init error");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
returnCode = DjiCore_ApplicationStart();
|
||||
@ -294,6 +289,8 @@ void DjiUser_StartTask(void const *argument)
|
||||
USER_LOG_ERROR("start sdk application error");
|
||||
}
|
||||
|
||||
s_isApplicationStart = true;
|
||||
|
||||
while (1) {
|
||||
Osal_TaskSleepMs(500);
|
||||
Led_Trigger(LED3);
|
||||
@ -325,8 +322,11 @@ void DjiUser_MonitorTask(void const *argument)
|
||||
#endif
|
||||
|
||||
while (1) {
|
||||
Osal_TaskSleepMs(1000 / RUN_INDICATE_TASK_FREQ_1HZ);
|
||||
Osal_TaskSleepMs(1000 / RUN_INDICATE_TASK_FREQ_0D1HZ);
|
||||
|
||||
if (s_isApplicationStart == false) {
|
||||
continue;
|
||||
}
|
||||
// report UART buffer state
|
||||
#ifdef USING_UART_PORT_1
|
||||
UART_GetBufferState(UART_NUM_1, &readBufferState, &writeBufferState);
|
||||
@ -385,8 +385,8 @@ void DjiUser_MonitorTask(void const *argument)
|
||||
lastTaskStatusArraySize = currentTaskStatusArraySize;
|
||||
#endif
|
||||
}
|
||||
USER_LOG_DEBUG("used heap size: %d/%d.\r\n", configTOTAL_HEAP_SIZE - xPortGetFreeHeapSize(),
|
||||
configTOTAL_HEAP_SIZE);
|
||||
USER_LOG_INFO("Used heap size: %d/%d.\r\n", configTOTAL_HEAP_SIZE - xPortGetFreeHeapSize(),
|
||||
configTOTAL_HEAP_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,19 +36,19 @@ extern "C" {
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
#define CONFIG_MODULE_SAMPLE_POWER_MANAGEMENT_ON
|
||||
|
||||
#define CONFIG_MODULE_SAMPLE_WIDGET_ON
|
||||
|
||||
#define CONFIG_MODULE_SAMPLE_DATA_TRANSMISSION_ON
|
||||
|
||||
#define CONFIG_MODULE_SAMPLE_WIDGET_ON
|
||||
#define CONFIG_MODULE_SAMPLE_FC_SUBSCRIPTION_ON
|
||||
|
||||
#define CONFIG_MODULE_SAMPLE_GIMBAL_EMU_ON
|
||||
|
||||
#define CONFIG_MODULE_SAMPLE_CAMERA_ON
|
||||
|
||||
#define CONFIG_MODULE_SAMPLE_FC_SUBSCRIPTION_ON
|
||||
|
||||
#define CONFIG_MODULE_SAMPLE_XPORT_ON
|
||||
|
||||
//#define CONFIG_MODULE_SAMPLE_UPGRADE_ON
|
||||
#define CONFIG_MODULE_SAMPLE_UPGRADE_ON
|
||||
|
||||
/*!< Attention: Please uncomment it in gps environment.
|
||||
* */
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "task.h"
|
||||
|
||||
/* Private constants ---------------------------------------------------------*/
|
||||
#define USER_START_TASK_STACK_SIZE 1024
|
||||
#define USER_START_TASK_STACK_SIZE 2048
|
||||
#define USER_START_TASK_PRIORITY 0
|
||||
#define USER_RUN_INDICATE_TASK_STACK_SIZE 256
|
||||
#define USER_RUN_INDICATE_TASK_PRIORITY 0
|
||||
|
@ -34,19 +34,17 @@
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
|
||||
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
//uart uart buffer size define
|
||||
#define UART1_READ_BUF_SIZE 1024
|
||||
#define UART1_WRITE_BUF_SIZE 4096
|
||||
#define UART2_READ_BUF_SIZE 2048
|
||||
#define UART1_READ_BUF_SIZE 64
|
||||
#define UART1_WRITE_BUF_SIZE 64
|
||||
#define UART2_READ_BUF_SIZE 64
|
||||
#define UART2_WRITE_BUF_SIZE 2048
|
||||
#define UART3_READ_BUF_SIZE 1024
|
||||
#define UART3_WRITE_BUF_SIZE 1024
|
||||
#define UART3_READ_BUF_SIZE 4096
|
||||
#define UART3_WRITE_BUF_SIZE 2048
|
||||
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
|
||||
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
#ifdef USING_UART_PORT_1
|
||||
//UART1 read ring buffer structure
|
||||
@ -58,9 +56,9 @@ static T_RingBuffer s_uart1WriteRingBuffer;
|
||||
//USART1 write buffer state
|
||||
static T_UartBufferState s_uart1WriteBufferState;
|
||||
//UART1 read buffer
|
||||
static uint8_t s_uart1ReadBuf[UART1_READ_BUF_SIZE];
|
||||
CCMRAM static uint8_t s_uart1ReadBuf[UART1_READ_BUF_SIZE];
|
||||
//UART1 write buffer
|
||||
static uint8_t s_uart1WriteBuf[UART1_WRITE_BUF_SIZE];
|
||||
CCMRAM static uint8_t s_uart1WriteBuf[UART1_WRITE_BUF_SIZE];
|
||||
|
||||
//UART1 mutex
|
||||
static T_DjiMutexHandle s_uart1Mutex;
|
||||
@ -73,8 +71,8 @@ static T_RingBuffer s_uart2ReadRingBuffer;
|
||||
static T_UartBufferState s_uart2ReadBufferState;
|
||||
static T_RingBuffer s_uart2WriteRingBuffer;
|
||||
static T_UartBufferState s_uart2WriteBufferState;
|
||||
static uint8_t s_uart2ReadBuf[UART2_READ_BUF_SIZE];
|
||||
static uint8_t s_uart2WriteBuf[UART2_WRITE_BUF_SIZE];
|
||||
CCMRAM static uint8_t s_uart2ReadBuf[UART2_READ_BUF_SIZE];
|
||||
CCMRAM static uint8_t s_uart2WriteBuf[UART2_WRITE_BUF_SIZE];
|
||||
|
||||
static T_DjiMutexHandle s_uart2Mutex;
|
||||
static UART_HandleTypeDef s_uart2Handle;
|
||||
@ -85,8 +83,8 @@ static T_RingBuffer s_uart3ReadRingBuffer;
|
||||
static T_UartBufferState s_uart3ReadBufferState;
|
||||
static T_RingBuffer s_uart3WriteRingBuffer;
|
||||
static T_UartBufferState s_uart3WriteBufferState;
|
||||
static uint8_t s_uart3ReadBuf[UART3_READ_BUF_SIZE];
|
||||
static uint8_t s_uart3WriteBuf[UART3_WRITE_BUF_SIZE];
|
||||
CCMRAM static uint8_t s_uart3ReadBuf[UART3_READ_BUF_SIZE];
|
||||
CCMRAM static uint8_t s_uart3WriteBuf[UART3_WRITE_BUF_SIZE];
|
||||
|
||||
static T_DjiMutexHandle s_uart3Mutex;
|
||||
static UART_HandleTypeDef s_uart3Handle;
|
||||
|
@ -280,6 +280,8 @@ void HAL_DisableMemorySwappingBank(void);
|
||||
* @}
|
||||
*/
|
||||
/* Private macros ------------------------------------------------------------*/
|
||||
#define CCMRAM __attribute__((section(".ccmram")))
|
||||
|
||||
/* Private functions ---------------------------------------------------------*/
|
||||
/**
|
||||
* @}
|
||||
@ -287,8 +289,8 @@ void HAL_DisableMemorySwappingBank(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -146,8 +146,8 @@ USBH_ClassTypeDef CDC_Class =
|
||||
|
||||
QueueHandle_t ACMDataRecvQueue;
|
||||
QueueHandle_t ACMDataSendQueue;
|
||||
#if DJI_EXTENSION_PORT_SUPPORT
|
||||
static uint8_t cdcBuff[1024];
|
||||
#if USE_USB_HOST_UART
|
||||
CCMRAM static uint8_t cdcBuff[1024];
|
||||
#endif
|
||||
|
||||
void USBH_CDC_DataQueueInit(void)
|
||||
@ -372,7 +372,7 @@ static USBH_StatusTypeDef USBH_CDC_Process(USBH_HandleTypeDef *phost)
|
||||
CDC_HandleTypeDef *CDC_Handle = (CDC_HandleTypeDef *) phost->pActiveClass->pData;
|
||||
|
||||
if (CDC_Handle->data_rx_state == CDC_IDLE) {
|
||||
#if DJI_EXTENSION_PORT_SUPPORT
|
||||
#if USE_USB_HOST_UART
|
||||
USBH_CDC_Receive(phost, cdcBuff, sizeof(cdcBuff));
|
||||
#endif
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
# This is an STM32F4 discovery board with a single STM32F407VGT6 chip.
|
||||
# http://www.st.com/internet/evalboard/product/252419.jsp
|
||||
|
||||
source [find interface/stlink-v2-1.cfg]
|
||||
source [find interface/jlink.cfg]
|
||||
|
||||
transport select hla_swd
|
||||
transport select swd
|
||||
|
||||
# increase working area to 64KB
|
||||
set WORKAREASIZE 0x10000
|
||||
|
Reference in New Issue
Block a user