通讯待测试
This commit is contained in:
parent
1c265bee21
commit
fba5f0720c
|
@ -145,27 +145,10 @@
|
||||||
<SetRegEntry>
|
<SetRegEntry>
|
||||||
<Number>0</Number>
|
<Number>0</Number>
|
||||||
<Key>ST-LINKIII-KEIL_SWO</Key>
|
<Key>ST-LINKIII-KEIL_SWO</Key>
|
||||||
<Name>-U-O142 -O2254 -SF10000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP (ARM Core") -D00(0BC11477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC800 -FN1 -FF0STM32L0xx_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32L072RBTx$CMSIS\Flash\STM32L0xx_128.FLM) -WA0 -WE0 -WVCE4 -WS2710 -WM0 -WP2</Name>
|
<Name>-US -O2254 -SF10000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP (ARM Core") -D00(0BC11477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC800 -FN1 -FF0STM32L0xx_128.FLM -FS08000000 -FL020000 -FP0($$Device:STM32L072RBTx$CMSIS\Flash\STM32L0xx_128.FLM) -WA0 -WE0 -WVCE4 -WS2710 -WM0 -WP2</Name>
|
||||||
</SetRegEntry>
|
</SetRegEntry>
|
||||||
</TargetDriverDllRegistry>
|
</TargetDriverDllRegistry>
|
||||||
<Breakpoint>
|
<Breakpoint/>
|
||||||
<Bp>
|
|
||||||
<Number>0</Number>
|
|
||||||
<Type>0</Type>
|
|
||||||
<LineNumber>207</LineNumber>
|
|
||||||
<EnabledFlag>1</EnabledFlag>
|
|
||||||
<Address>134223234</Address>
|
|
||||||
<ByteObject>0</ByteObject>
|
|
||||||
<HtxType>0</HtxType>
|
|
||||||
<ManyObjects>0</ManyObjects>
|
|
||||||
<SizeOfObject>0</SizeOfObject>
|
|
||||||
<BreakByAccess>0</BreakByAccess>
|
|
||||||
<BreakIfRCount>1</BreakIfRCount>
|
|
||||||
<Filename>../Core/Src/stm32l0xx_it.c</Filename>
|
|
||||||
<ExecCommand></ExecCommand>
|
|
||||||
<Expression>\\motor\../Core/Src/stm32l0xx_it.c\207</Expression>
|
|
||||||
</Bp>
|
|
||||||
</Breakpoint>
|
|
||||||
<WatchWindow1>
|
<WatchWindow1>
|
||||||
<Ww>
|
<Ww>
|
||||||
<count>0</count>
|
<count>0</count>
|
||||||
|
@ -197,6 +180,21 @@
|
||||||
<WinNumber>1</WinNumber>
|
<WinNumber>1</WinNumber>
|
||||||
<ItemText>motor_dir</ItemText>
|
<ItemText>motor_dir</ItemText>
|
||||||
</Ww>
|
</Ww>
|
||||||
|
<Ww>
|
||||||
|
<count>6</count>
|
||||||
|
<WinNumber>1</WinNumber>
|
||||||
|
<ItemText>deal_done_flag,0x0A</ItemText>
|
||||||
|
</Ww>
|
||||||
|
<Ww>
|
||||||
|
<count>7</count>
|
||||||
|
<WinNumber>1</WinNumber>
|
||||||
|
<ItemText>uarts</ItemText>
|
||||||
|
</Ww>
|
||||||
|
<Ww>
|
||||||
|
<count>8</count>
|
||||||
|
<WinNumber>1</WinNumber>
|
||||||
|
<ItemText>uart</ItemText>
|
||||||
|
</Ww>
|
||||||
</WatchWindow1>
|
</WatchWindow1>
|
||||||
<Tracepoint>
|
<Tracepoint>
|
||||||
<THDelay>0</THDelay>
|
<THDelay>0</THDelay>
|
||||||
|
@ -242,12 +240,12 @@
|
||||||
<pMultCmdsp></pMultCmdsp>
|
<pMultCmdsp></pMultCmdsp>
|
||||||
<SystemViewers>
|
<SystemViewers>
|
||||||
<Entry>
|
<Entry>
|
||||||
<Name>System Viewer\TIM21</Name>
|
<Name>System Viewer\DMA1</Name>
|
||||||
<WinId>35905</WinId>
|
<WinId>35904</WinId>
|
||||||
</Entry>
|
</Entry>
|
||||||
<Entry>
|
<Entry>
|
||||||
<Name>System Viewer\TIM6</Name>
|
<Name>System Viewer\USART1</Name>
|
||||||
<WinId>35904</WinId>
|
<WinId>35905</WinId>
|
||||||
</Entry>
|
</Entry>
|
||||||
</SystemViewers>
|
</SystemViewers>
|
||||||
<DebugDescription>
|
<DebugDescription>
|
||||||
|
@ -262,7 +260,7 @@
|
||||||
|
|
||||||
<Group>
|
<Group>
|
||||||
<GroupName>Application/MDK-ARM</GroupName>
|
<GroupName>Application/MDK-ARM</GroupName>
|
||||||
<tvExp>0</tvExp>
|
<tvExp>1</tvExp>
|
||||||
<tvExpOptDlg>0</tvExpOptDlg>
|
<tvExpOptDlg>0</tvExpOptDlg>
|
||||||
<cbSel>0</cbSel>
|
<cbSel>0</cbSel>
|
||||||
<RteFlg>0</RteFlg>
|
<RteFlg>0</RteFlg>
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
<CreateLib>0</CreateLib>
|
<CreateLib>0</CreateLib>
|
||||||
<CreateHexFile>1</CreateHexFile>
|
<CreateHexFile>1</CreateHexFile>
|
||||||
<DebugInformation>1</DebugInformation>
|
<DebugInformation>1</DebugInformation>
|
||||||
<BrowseInformation>1</BrowseInformation>
|
<BrowseInformation>0</BrowseInformation>
|
||||||
<ListingPath></ListingPath>
|
<ListingPath></ListingPath>
|
||||||
<HexFormatSelection>1</HexFormatSelection>
|
<HexFormatSelection>1</HexFormatSelection>
|
||||||
<Merge32K>0</Merge32K>
|
<Merge32K>0</Merge32K>
|
||||||
|
@ -314,7 +314,7 @@
|
||||||
</ArmAdsMisc>
|
</ArmAdsMisc>
|
||||||
<Cads>
|
<Cads>
|
||||||
<interw>1</interw>
|
<interw>1</interw>
|
||||||
<Optim>0</Optim>
|
<Optim>1</Optim>
|
||||||
<oTime>0</oTime>
|
<oTime>0</oTime>
|
||||||
<SplitLS>0</SplitLS>
|
<SplitLS>0</SplitLS>
|
||||||
<OneElfS>1</OneElfS>
|
<OneElfS>1</OneElfS>
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,47 @@
|
||||||
|
--cpu Cortex-M0+
|
||||||
|
"motor\startup_stm32l072xx.o"
|
||||||
|
"motor\main.o"
|
||||||
|
"motor\gpio.o"
|
||||||
|
"motor\adc.o"
|
||||||
|
"motor\dma.o"
|
||||||
|
"motor\tim.o"
|
||||||
|
"motor\usart.o"
|
||||||
|
"motor\stm32l0xx_it.o"
|
||||||
|
"motor\stm32l0xx_ll_gpio.o"
|
||||||
|
"motor\stm32l0xx_ll_adc.o"
|
||||||
|
"motor\stm32l0xx_ll_dma.o"
|
||||||
|
"motor\stm32l0xx_ll_rcc.o"
|
||||||
|
"motor\stm32l0xx_ll_utils.o"
|
||||||
|
"motor\stm32l0xx_ll_exti.o"
|
||||||
|
"motor\stm32l0xx_ll_pwr.o"
|
||||||
|
"motor\stm32l0xx_ll_tim.o"
|
||||||
|
"motor\stm32l0xx_ll_usart.o"
|
||||||
|
"motor\system_stm32l0xx.o"
|
||||||
|
"motor\app.o"
|
||||||
|
"motor\app_flow.o"
|
||||||
|
"motor\aes.o"
|
||||||
|
"motor\clist.o"
|
||||||
|
"motor\cmac.o"
|
||||||
|
"motor\cmd.o"
|
||||||
|
"motor\data_analysis.o"
|
||||||
|
"motor\debug.o"
|
||||||
|
"motor\filter.o"
|
||||||
|
"motor\lib.o"
|
||||||
|
"motor\malloc.o"
|
||||||
|
"motor\mlist.o"
|
||||||
|
"motor\pbuf.o"
|
||||||
|
"motor\sqqueue.o"
|
||||||
|
"motor\flow_core.o"
|
||||||
|
"motor\btn.o"
|
||||||
|
"motor\delay.o"
|
||||||
|
"motor\sys.o"
|
||||||
|
"motor\adcs.o"
|
||||||
|
"motor\gpios.o"
|
||||||
|
"motor\pwms.o"
|
||||||
|
"motor\uarts.o"
|
||||||
|
"motor\board.o"
|
||||||
|
"motor\motor.o"
|
||||||
|
--strict --scatter "motor\motor.sct"
|
||||||
|
--summary_stderr --info summarysizes --map --load_addr_map_info --xref --callgraph --symbols
|
||||||
|
--info sizes --info totals --info unused --info veneers
|
||||||
|
--list "motor.map" -o motor\motor.axf
|
|
@ -28,7 +28,8 @@ static uint8_t systom_inspection(struct flow *fl)
|
||||||
FL_HEAD(fl);
|
FL_HEAD(fl);
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
FL_LOCK_DELAY(fl, FL_CLOCK_100MSEC); /* 延时100毫秒 */
|
host_data_deal();
|
||||||
|
FL_LOCK_DELAY(fl, FL_CLOCK_10MSEC); /* 延时100毫秒 */
|
||||||
}
|
}
|
||||||
FL_TAIL(fl);
|
FL_TAIL(fl);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ void sensor_procss(frame_msg_t *rx, frame_msg_t *bk);
|
||||||
|
|
||||||
/************************************* 串口通讯 *************************************/
|
/************************************* 串口通讯 *************************************/
|
||||||
uart_t *uarts[UART_NUM_MAX];
|
uart_t *uarts[UART_NUM_MAX];
|
||||||
__IO static BOOL deal_done_flag = FALSE; // 数据处理标志
|
__IO static BOOL deal_done_flag = 0; // 数据处理标志
|
||||||
__IO static frame_msg_t rx_frame;
|
__IO static frame_msg_t rx_frame;
|
||||||
__IO static frame_msg_t bk_frame;
|
__IO static frame_msg_t bk_frame;
|
||||||
__IO static uint8_t send_buffer[UART_TXSIZE];
|
__IO static uint8_t send_buffer[UART_TXSIZE];
|
||||||
|
@ -65,7 +65,7 @@ static void send_data_encode(frame_msg_t *msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 数据处理
|
// 数据处理
|
||||||
void host_data_deal(uint8_t *data, uint16_t len)
|
void host_data_deal(void)
|
||||||
{
|
{
|
||||||
frame_msg_t *rx_msg = (frame_msg_t *)&rx_frame;
|
frame_msg_t *rx_msg = (frame_msg_t *)&rx_frame;
|
||||||
frame_msg_t *bk_msg = (frame_msg_t *)&bk_frame;
|
frame_msg_t *bk_msg = (frame_msg_t *)&bk_frame;
|
||||||
|
@ -74,8 +74,7 @@ void host_data_deal(uint8_t *data, uint16_t len)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 解析
|
|
||||||
host_data_decode(data, len, rx_msg);
|
|
||||||
// 执行
|
// 执行
|
||||||
switch (rx_msg->dev_no)
|
switch (rx_msg->dev_no)
|
||||||
{
|
{
|
||||||
|
@ -139,6 +138,7 @@ static void host_rx_cb(uint8_t uart_index, uint8_t *data, uint16_t len)
|
||||||
// 数据处理
|
// 数据处理
|
||||||
if (ret == TRUE && deal_done_flag == TRUE)
|
if (ret == TRUE && deal_done_flag == TRUE)
|
||||||
{
|
{
|
||||||
|
host_data_decode(data, len, (frame_msg_t *)&rx_frame);
|
||||||
deal_done_flag = FALSE;
|
deal_done_flag = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -243,10 +243,10 @@ void sensor_procss(frame_msg_t *rx, frame_msg_t *bk)
|
||||||
void board_init(void)
|
void board_init(void)
|
||||||
{
|
{
|
||||||
motor = NULL;
|
motor = NULL;
|
||||||
osel_memset((uint8_t *)uarts, 0, sizeof(uarts));
|
|
||||||
my_mem_init(SRAMIN);
|
my_mem_init(SRAMIN);
|
||||||
|
|
||||||
motor_init(); // 电机初始化
|
motor_init(); // 电机初始化
|
||||||
adc_init(adc1); // 初始化ADC1通道,默认采集AD
|
adc_init(adc1); // 初始化ADC1通道,默认采集AD
|
||||||
|
host_uart_init(); // 串口初始化
|
||||||
ENABLE_TIM(TIM6); // 任务流程定时器使能
|
ENABLE_TIM(TIM6); // 任务流程定时器使能
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,8 @@ typedef struct
|
||||||
|
|
||||||
} frame_msg_t;
|
} frame_msg_t;
|
||||||
|
|
||||||
|
extern void host_uart_init(void);
|
||||||
extern void board_init(void);
|
extern void board_init(void);
|
||||||
void host_data_deal(uint8_t *data, uint16_t len);
|
extern void host_data_deal(void);
|
||||||
|
|
||||||
#endif // __BOARD_H__
|
#endif // __BOARD_H__
|
||||||
|
|
|
@ -24,4 +24,31 @@
|
||||||
} while (__LINE__ == -1);
|
} while (__LINE__ == -1);
|
||||||
|
|
||||||
#define WATCHDOG_RESET() LL_IWDG_ReloadCounter(IWDG)
|
#define WATCHDOG_RESET() LL_IWDG_ReloadCounter(IWDG)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Clears the flags of a DMA channel
|
||||||
|
* @param DMAX DMAx register base
|
||||||
|
* @param CHx DMA channel number
|
||||||
|
* @param Flag a boolean variable that indicates if the transfer is complete
|
||||||
|
* @note This function should be called within the interrupt service routine of the DMA channel
|
||||||
|
*/
|
||||||
|
#define DMA_ClEAR_FLAG(DMAX, CHx, Flag) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
if (LL_DMA_IsActiveFlag_TC##CHx(DMAX)) \
|
||||||
|
{ \
|
||||||
|
LL_DMA_ClearFlag_TC##CHx(DMAX); \
|
||||||
|
LL_DMA_ClearFlag_GI##CHx(DMAX); \
|
||||||
|
Flag = TRUE; \
|
||||||
|
} \
|
||||||
|
if (LL_DMA_IsActiveFlag_TE##CHx(DMAX)) \
|
||||||
|
{ \
|
||||||
|
LL_DMA_ClearFlag_TE##CHx(DMAX); \
|
||||||
|
} \
|
||||||
|
if (LL_DMA_IsActiveFlag_GI##CHx(DMAX)) \
|
||||||
|
{ \
|
||||||
|
LL_DMA_ClearFlag_GI##CHx(DMAX); \
|
||||||
|
} \
|
||||||
|
} while (__LINE__ == -1)
|
||||||
|
|
||||||
#endif // __BSP_H__
|
#endif // __BSP_H__
|
||||||
|
|
|
@ -365,12 +365,12 @@ void uart_dma_reception_callback(uart_t *uart)
|
||||||
LL_DMA_DisableChannel(uart->dma, uart->dma_tx_channel);
|
LL_DMA_DisableChannel(uart->dma, uart->dma_tx_channel);
|
||||||
|
|
||||||
// 清除发送中断标志位
|
// 清除发送中断标志位
|
||||||
DMA_CLEAR_FLAG_TC_CHANNEL(uart->dma, uart->dma_tx_channel + 1);
|
DMA_CLEAR_FLAG_TC_CHANNEL(uart->dma, uart->dma_tx_channel);
|
||||||
|
|
||||||
// 使能发送中断,用于关闭发送使能引脚
|
// 使能发送中断,用于关闭发送使能引脚
|
||||||
LL_USART_EnableIT_TC(uart->huart); // 使能发送中断,用于关闭发送使能引脚
|
LL_USART_EnableIT_TC(uart->huart); // 使能发送中断,用于关闭发送使能引脚
|
||||||
uart->tx_dma_ok = TRUE;
|
uart->tx_dma_ok = TRUE;
|
||||||
|
|
||||||
// 清除传输错误标志
|
// 清除传输错误标志
|
||||||
DMA_CLEAR_FLAG_TE_CHANNEL(uart->dma, uart->dma_tx_channel + 1);
|
DMA_CLEAR_FLAG_TE_CHANNEL(uart->dma, uart->dma_tx_channel);
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue