Browse Source

【神奇的问题】解决DMA访问内存导致的发送失败

master
Lizongdi 1 week ago
parent
commit
40a3cccacd
  1. 10
      project_old/paint_robot_old/BASE/Src/BSP/bsp_UART.c
  2. 4
      project_old/paint_robot_old/paint_robot_old.c

10
project_old/paint_robot_old/BASE/Src/BSP/bsp_UART.c

@ -19,6 +19,8 @@ uint8_t RS485_4_RxDMA_buf[UART_Receive_MAX_NUM];
uint8_t Debug_RxDMA_buf[UART_Receive_MAX_NUM];
uint8_t ExternSerial_RxDMA_buf[UART_Receive_MAX_NUM];
__attribute__((section(".dma_buffer"), aligned(32)))
uint8_t MyRS485_TxDMA_buf[UART_Transmit_MAX_NUM];
uint8_t RS485_1_TxDMA_buf[UART_Transmit_MAX_NUM];
uint8_t RS485_2_TxDMA_buf[UART_Transmit_MAX_NUM];
uint8_t RS485_3_TxDMA_buf[UART_Transmit_MAX_NUM];
@ -231,10 +233,10 @@ void UARTHandlerTx(struct UARTHandler *uartHandler)
}
SCB_CleanInvalidateDCache_by_Addr((uint32_t*) uartHandler->Tx_Buf,
uartHandler->TxCount);
HAL_UART_Transmit_DMA(uartHandler->uart, uartHandler->Tx_Buf,
// SCB_CleanInvalidateDCache_by_Addr((uint32_t*) uartHandler->Tx_Buf,
// uartHandler->TxCount);
memcpy(MyRS485_TxDMA_buf, uartHandler->Tx_Buf, uartHandler->TxCount);
HAL_UART_Transmit_DMA(uartHandler->uart, MyRS485_TxDMA_buf,
uartHandler->TxCount);
#if defined (hlpuart1Exit)
}

4
project_old/paint_robot_old/paint_robot_old.c

@ -100,10 +100,10 @@ void GF_Robot_Init()
is_upper_computer_take_over_control = 0;
DLT_LOG_ENABLE_LEVEL = 7; //7 send all information //0 send nothing
//dLT_Log_intialize(&InterCall_DEBUG_UART_Handler); //huart4
//dLT_Log_intialize(&RS_485_4_UART_Handler);
dLT_Log_intialize(&RS_485_4_UART_Handler);
udp_client_init();
tcp_server_init(3490);
dLT_Log_intialize_udp_tcp();
//dLT_Log_intialize_udp_tcp();
upper_Computer_UART_Handler_intialize(&RS_485_4_UART_Handler);//send to computer to 485
TL720D_intialize(&RS_485_1_UART_Handler);
MK32_Sbus_UART_Handler_intialize(&E28_SBUS_UART_Handler); //huart5

Loading…
Cancel
Save