Browse Source

cubemx配置修改

main
Lizongdi 1 week ago
parent
commit
bb04b8314a
  1. 2
      Core/Src/fdcan.c
  2. 11
      Core/Src/main.c
  3. 8
      Core/Src/usart.c
  4. 5
      LWIP/Target/ethernetif.c
  5. 2
      robot
  6. 24
      robot_old.ioc

2
Core/Src/fdcan.c

@ -95,7 +95,7 @@ void MX_FDCAN2_Init(void)
hfdcan2.Init.NominalPrescaler = 20; hfdcan2.Init.NominalPrescaler = 20;
hfdcan2.Init.NominalSyncJumpWidth = 1; hfdcan2.Init.NominalSyncJumpWidth = 1;
hfdcan2.Init.NominalTimeSeg1 = 5; hfdcan2.Init.NominalTimeSeg1 = 5;
hfdcan2.Init.NominalTimeSeg2 = 1; hfdcan2.Init.NominalTimeSeg2 = 2;
hfdcan2.Init.DataPrescaler = 1; hfdcan2.Init.DataPrescaler = 1;
hfdcan2.Init.DataSyncJumpWidth = 1; hfdcan2.Init.DataSyncJumpWidth = 1;
hfdcan2.Init.DataTimeSeg1 = 1; hfdcan2.Init.DataTimeSeg1 = 1;

11
Core/Src/main.c

@ -252,6 +252,17 @@ void MPU_Config(void)
MPU_InitStruct.IsShareable = MPU_ACCESS_SHAREABLE; MPU_InitStruct.IsShareable = MPU_ACCESS_SHAREABLE;
MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE; MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
HAL_MPU_ConfigRegion(&MPU_InitStruct);
/** Initializes and configures the Region and the memory to be protected
*/
MPU_InitStruct.Number = MPU_REGION_NUMBER3;
MPU_InitStruct.BaseAddress = 0x24000000 ;
MPU_InitStruct.Size = MPU_REGION_SIZE_512KB;
MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE;
MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
HAL_MPU_ConfigRegion(&MPU_InitStruct); HAL_MPU_ConfigRegion(&MPU_InitStruct);
/* Enables the MPU */ /* Enables the MPU */
HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT); HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);

8
Core/Src/usart.c

@ -324,10 +324,10 @@ void MX_USART3_UART_Init(void)
/* USER CODE END USART3_Init 1 */ /* USER CODE END USART3_Init 1 */
huart3.Instance = USART3; huart3.Instance = USART3;
huart3.Init.BaudRate = 921600; huart3.Init.BaudRate = 115200;
huart3.Init.WordLength = UART_WORDLENGTH_9B; huart3.Init.WordLength = UART_WORDLENGTH_8B;
huart3.Init.StopBits = UART_STOPBITS_1; huart3.Init.StopBits = UART_STOPBITS_1;
huart3.Init.Parity = UART_PARITY_EVEN; huart3.Init.Parity = UART_PARITY_NONE;
huart3.Init.Mode = UART_MODE_TX_RX; huart3.Init.Mode = UART_MODE_TX_RX;
huart3.Init.HwFlowCtl = UART_HWCONTROL_NONE; huart3.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart3.Init.OverSampling = UART_OVERSAMPLING_16; huart3.Init.OverSampling = UART_OVERSAMPLING_16;
@ -348,7 +348,7 @@ void MX_USART3_UART_Init(void)
{ {
Error_Handler(); Error_Handler();
} }
if (HAL_UARTEx_EnableFifoMode(&huart3) != HAL_OK) if (HAL_UARTEx_DisableFifoMode(&huart3) != HAL_OK)
{ {
Error_Handler(); Error_Handler();
} }

5
LWIP/Target/ethernetif.c

@ -225,7 +225,10 @@ static void low_level_init(struct netif *netif)
#endif /* LWIP_ARP */ #endif /* LWIP_ARP */
/* USER CODE BEGIN PHY_PRE_CONFIG */ /* USER CODE BEGIN PHY_PRE_CONFIG */
HAL_GPIO_WritePin(ETH_RST_GPIO_Port,ETH_RST_Pin,GPIO_PIN_RESET);
HAL_Delay(1000);
HAL_GPIO_WritePin(ETH_RST_GPIO_Port,ETH_RST_Pin,GPIO_PIN_SET);
HAL_Delay(1000);
/* USER CODE END PHY_PRE_CONFIG */ /* USER CODE END PHY_PRE_CONFIG */
/* Set PHY IO functions */ /* Set PHY IO functions */
LAN8742_RegisterBusIO(&LAN8742, &LAN8742_IOCtx); LAN8742_RegisterBusIO(&LAN8742, &LAN8742_IOCtx);

2
robot

@ -1 +1 @@
Subproject commit 35274be076ac624c61342f01ac755b5ddd324578 Subproject commit 8866fc3e509adecbb1b824c649bb8026c5000240

24
robot_old.ioc

@ -14,18 +14,24 @@ CAD.provider=
CORTEX_M7.AccessPermission-Cortex_Memory_Protection_Unit_Region0_Settings=MPU_REGION_NO_ACCESS CORTEX_M7.AccessPermission-Cortex_Memory_Protection_Unit_Region0_Settings=MPU_REGION_NO_ACCESS
CORTEX_M7.AccessPermission-Cortex_Memory_Protection_Unit_Region1_Settings=MPU_REGION_FULL_ACCESS CORTEX_M7.AccessPermission-Cortex_Memory_Protection_Unit_Region1_Settings=MPU_REGION_FULL_ACCESS
CORTEX_M7.AccessPermission-Cortex_Memory_Protection_Unit_Region2_Settings=MPU_REGION_FULL_ACCESS CORTEX_M7.AccessPermission-Cortex_Memory_Protection_Unit_Region2_Settings=MPU_REGION_FULL_ACCESS
CORTEX_M7.AccessPermission-Cortex_Memory_Protection_Unit_Region3_Settings=MPU_REGION_FULL_ACCESS
CORTEX_M7.BaseAddress-Cortex_Memory_Protection_Unit_Region0_Settings=0 CORTEX_M7.BaseAddress-Cortex_Memory_Protection_Unit_Region0_Settings=0
CORTEX_M7.BaseAddress-Cortex_Memory_Protection_Unit_Region1_Settings=0x30000000 CORTEX_M7.BaseAddress-Cortex_Memory_Protection_Unit_Region1_Settings=0x30000000
CORTEX_M7.BaseAddress-Cortex_Memory_Protection_Unit_Region2_Settings=0x30004000 CORTEX_M7.BaseAddress-Cortex_Memory_Protection_Unit_Region2_Settings=0x30004000
CORTEX_M7.BaseAddress-Cortex_Memory_Protection_Unit_Region3_Settings=0x24000000
CORTEX_M7.CPU_DCache=Enabled CORTEX_M7.CPU_DCache=Enabled
CORTEX_M7.CPU_ICache=Enabled CORTEX_M7.CPU_ICache=Enabled
CORTEX_M7.DisableExec-Cortex_Memory_Protection_Unit_Region3_Settings=MPU_INSTRUCTION_ACCESS_DISABLE
CORTEX_M7.Enable-Cortex_Memory_Protection_Unit_Region0_Settings=MPU_REGION_ENABLE CORTEX_M7.Enable-Cortex_Memory_Protection_Unit_Region0_Settings=MPU_REGION_ENABLE
CORTEX_M7.Enable-Cortex_Memory_Protection_Unit_Region1_Settings=MPU_REGION_ENABLE CORTEX_M7.Enable-Cortex_Memory_Protection_Unit_Region1_Settings=MPU_REGION_ENABLE
CORTEX_M7.Enable-Cortex_Memory_Protection_Unit_Region2_Settings=MPU_REGION_ENABLE CORTEX_M7.Enable-Cortex_Memory_Protection_Unit_Region2_Settings=MPU_REGION_ENABLE
CORTEX_M7.IPParameters=MPU_Control,CPU_ICache,CPU_DCache,Enable-Cortex_Memory_Protection_Unit_Region2_Settings,Enable-Cortex_Memory_Protection_Unit_Region0_Settings,BaseAddress-Cortex_Memory_Protection_Unit_Region0_Settings,Size-Cortex_Memory_Protection_Unit_Region0_Settings,IsBufferable-Cortex_Memory_Protection_Unit_Region0_Settings,AccessPermission-Cortex_Memory_Protection_Unit_Region0_Settings,Enable-Cortex_Memory_Protection_Unit_Region1_Settings,BaseAddress-Cortex_Memory_Protection_Unit_Region1_Settings,Size-Cortex_Memory_Protection_Unit_Region1_Settings,AccessPermission-Cortex_Memory_Protection_Unit_Region1_Settings,IsCacheable-Cortex_Memory_Protection_Unit_Region1_Settings,IsShareable-Cortex_Memory_Protection_Unit_Region1_Settings,TypeExtField-Cortex_Memory_Protection_Unit_Region1_Settings,IsShareable-Cortex_Memory_Protection_Unit_Region0_Settings,SubRegionDisable-Cortex_Memory_Protection_Unit_Region0_Settings,IsBufferable-Cortex_Memory_Protection_Unit_Region1_Settings,TypeExtField-Cortex_Memory_Protection_Unit_Region0_Settings,BaseAddress-Cortex_Memory_Protection_Unit_Region2_Settings,Size-Cortex_Memory_Protection_Unit_Region2_Settings,TypeExtField-Cortex_Memory_Protection_Unit_Region2_Settings,AccessPermission-Cortex_Memory_Protection_Unit_Region2_Settings,IsShareable-Cortex_Memory_Protection_Unit_Region2_Settings CORTEX_M7.Enable-Cortex_Memory_Protection_Unit_Region3_Settings=MPU_REGION_ENABLE
CORTEX_M7.IPParameters=MPU_Control,CPU_ICache,CPU_DCache,Enable-Cortex_Memory_Protection_Unit_Region2_Settings,Enable-Cortex_Memory_Protection_Unit_Region0_Settings,BaseAddress-Cortex_Memory_Protection_Unit_Region0_Settings,Size-Cortex_Memory_Protection_Unit_Region0_Settings,IsBufferable-Cortex_Memory_Protection_Unit_Region0_Settings,AccessPermission-Cortex_Memory_Protection_Unit_Region0_Settings,Enable-Cortex_Memory_Protection_Unit_Region1_Settings,BaseAddress-Cortex_Memory_Protection_Unit_Region1_Settings,Size-Cortex_Memory_Protection_Unit_Region1_Settings,AccessPermission-Cortex_Memory_Protection_Unit_Region1_Settings,IsCacheable-Cortex_Memory_Protection_Unit_Region1_Settings,IsShareable-Cortex_Memory_Protection_Unit_Region1_Settings,TypeExtField-Cortex_Memory_Protection_Unit_Region1_Settings,IsShareable-Cortex_Memory_Protection_Unit_Region0_Settings,SubRegionDisable-Cortex_Memory_Protection_Unit_Region0_Settings,IsBufferable-Cortex_Memory_Protection_Unit_Region1_Settings,TypeExtField-Cortex_Memory_Protection_Unit_Region0_Settings,BaseAddress-Cortex_Memory_Protection_Unit_Region2_Settings,Size-Cortex_Memory_Protection_Unit_Region2_Settings,TypeExtField-Cortex_Memory_Protection_Unit_Region2_Settings,AccessPermission-Cortex_Memory_Protection_Unit_Region2_Settings,IsShareable-Cortex_Memory_Protection_Unit_Region2_Settings,Enable-Cortex_Memory_Protection_Unit_Region3_Settings,BaseAddress-Cortex_Memory_Protection_Unit_Region3_Settings,Size-Cortex_Memory_Protection_Unit_Region3_Settings,AccessPermission-Cortex_Memory_Protection_Unit_Region3_Settings,DisableExec-Cortex_Memory_Protection_Unit_Region3_Settings,IsCacheable-Cortex_Memory_Protection_Unit_Region3_Settings,IsBufferable-Cortex_Memory_Protection_Unit_Region3_Settings
CORTEX_M7.IsBufferable-Cortex_Memory_Protection_Unit_Region0_Settings=MPU_ACCESS_NOT_BUFFERABLE CORTEX_M7.IsBufferable-Cortex_Memory_Protection_Unit_Region0_Settings=MPU_ACCESS_NOT_BUFFERABLE
CORTEX_M7.IsBufferable-Cortex_Memory_Protection_Unit_Region1_Settings=MPU_ACCESS_BUFFERABLE CORTEX_M7.IsBufferable-Cortex_Memory_Protection_Unit_Region1_Settings=MPU_ACCESS_BUFFERABLE
CORTEX_M7.IsBufferable-Cortex_Memory_Protection_Unit_Region3_Settings=MPU_ACCESS_NOT_BUFFERABLE
CORTEX_M7.IsCacheable-Cortex_Memory_Protection_Unit_Region1_Settings=MPU_ACCESS_NOT_CACHEABLE CORTEX_M7.IsCacheable-Cortex_Memory_Protection_Unit_Region1_Settings=MPU_ACCESS_NOT_CACHEABLE
CORTEX_M7.IsCacheable-Cortex_Memory_Protection_Unit_Region3_Settings=MPU_ACCESS_NOT_CACHEABLE
CORTEX_M7.IsShareable-Cortex_Memory_Protection_Unit_Region0_Settings=MPU_ACCESS_SHAREABLE CORTEX_M7.IsShareable-Cortex_Memory_Protection_Unit_Region0_Settings=MPU_ACCESS_SHAREABLE
CORTEX_M7.IsShareable-Cortex_Memory_Protection_Unit_Region1_Settings=MPU_ACCESS_NOT_SHAREABLE CORTEX_M7.IsShareable-Cortex_Memory_Protection_Unit_Region1_Settings=MPU_ACCESS_NOT_SHAREABLE
CORTEX_M7.IsShareable-Cortex_Memory_Protection_Unit_Region2_Settings=MPU_ACCESS_SHAREABLE CORTEX_M7.IsShareable-Cortex_Memory_Protection_Unit_Region2_Settings=MPU_ACCESS_SHAREABLE
@ -33,6 +39,7 @@ CORTEX_M7.MPU_Control=MPU_PRIVILEGED_DEFAULT
CORTEX_M7.Size-Cortex_Memory_Protection_Unit_Region0_Settings=MPU_REGION_SIZE_4GB CORTEX_M7.Size-Cortex_Memory_Protection_Unit_Region0_Settings=MPU_REGION_SIZE_4GB
CORTEX_M7.Size-Cortex_Memory_Protection_Unit_Region1_Settings=MPU_REGION_SIZE_1KB CORTEX_M7.Size-Cortex_Memory_Protection_Unit_Region1_Settings=MPU_REGION_SIZE_1KB
CORTEX_M7.Size-Cortex_Memory_Protection_Unit_Region2_Settings=MPU_REGION_SIZE_16KB CORTEX_M7.Size-Cortex_Memory_Protection_Unit_Region2_Settings=MPU_REGION_SIZE_16KB
CORTEX_M7.Size-Cortex_Memory_Protection_Unit_Region3_Settings=MPU_REGION_SIZE_512KB
CORTEX_M7.SubRegionDisable-Cortex_Memory_Protection_Unit_Region0_Settings=0x87 CORTEX_M7.SubRegionDisable-Cortex_Memory_Protection_Unit_Region0_Settings=0x87
CORTEX_M7.TypeExtField-Cortex_Memory_Protection_Unit_Region0_Settings=MPU_TEX_LEVEL0 CORTEX_M7.TypeExtField-Cortex_Memory_Protection_Unit_Region0_Settings=MPU_TEX_LEVEL0
CORTEX_M7.TypeExtField-Cortex_Memory_Protection_Unit_Region1_Settings=MPU_TEX_LEVEL0 CORTEX_M7.TypeExtField-Cortex_Memory_Protection_Unit_Region1_Settings=MPU_TEX_LEVEL0
@ -192,13 +199,14 @@ FDCAN1.NominalTimeSeg1=5
FDCAN1.NominalTimeSeg2=2 FDCAN1.NominalTimeSeg2=2
FDCAN1.RxFifo0ElmtsNbr=32 FDCAN1.RxFifo0ElmtsNbr=32
FDCAN1.TxFifoQueueElmtsNbr=32 FDCAN1.TxFifoQueueElmtsNbr=32
FDCAN2.CalculateBaudRateNominal=285714 FDCAN2.CalculateBaudRateNominal=250000
FDCAN2.CalculateTimeBitNominal=3500 FDCAN2.CalculateTimeBitNominal=4000
FDCAN2.CalculateTimeQuantumNominal=500.0 FDCAN2.CalculateTimeQuantumNominal=500.0
FDCAN2.IPParameters=NominalPrescaler,NominalTimeSeg1,RxFifo0ElmtsNbr,TxFifoQueueElmtsNbr,CalculateTimeQuantumNominal,CalculateTimeBitNominal,CalculateBaudRateNominal,MessageRAMOffset FDCAN2.IPParameters=NominalPrescaler,NominalTimeSeg1,RxFifo0ElmtsNbr,TxFifoQueueElmtsNbr,CalculateTimeQuantumNominal,CalculateTimeBitNominal,CalculateBaudRateNominal,MessageRAMOffset,NominalTimeSeg2
FDCAN2.MessageRAMOffset=0x500 FDCAN2.MessageRAMOffset=0x500
FDCAN2.NominalPrescaler=20 FDCAN2.NominalPrescaler=20
FDCAN2.NominalTimeSeg1=5 FDCAN2.NominalTimeSeg1=5
FDCAN2.NominalTimeSeg2=2
FDCAN2.RxFifo0ElmtsNbr=32 FDCAN2.RxFifo0ElmtsNbr=32
FDCAN2.TxFifoQueueElmtsNbr=32 FDCAN2.TxFifoQueueElmtsNbr=32
File.Version=6 File.Version=6
@ -886,14 +894,14 @@ USART2.DMADisableonRxErrorParam=ADVFEATURE_DMA_DISABLEONRXERROR
USART2.IPParameters=VirtualMode-Asynchronous,OverrunDisableParam,DMADisableonRxErrorParam USART2.IPParameters=VirtualMode-Asynchronous,OverrunDisableParam,DMADisableonRxErrorParam
USART2.OverrunDisableParam=ADVFEATURE_OVERRUN_DISABLE USART2.OverrunDisableParam=ADVFEATURE_OVERRUN_DISABLE
USART2.VirtualMode-Asynchronous=VM_ASYNC USART2.VirtualMode-Asynchronous=VM_ASYNC
USART3.BaudRate=921600 USART3.BaudRate=115200
USART3.DMADisableonRxErrorParam=ADVFEATURE_DMA_DISABLEONRXERROR USART3.DMADisableonRxErrorParam=ADVFEATURE_DMA_DISABLEONRXERROR
USART3.FIFOMode=FIFOMODE_ENABLE USART3.FIFOMode=FIFOMODE_DISABLE
USART3.IPParameters=VirtualMode-Asynchronous,DMADisableonRxErrorParam,OverrunDisableParam,FIFOMode,BaudRate,WordLength,Parity USART3.IPParameters=VirtualMode-Asynchronous,DMADisableonRxErrorParam,OverrunDisableParam,FIFOMode,BaudRate,WordLength,Parity
USART3.OverrunDisableParam=ADVFEATURE_OVERRUN_DISABLE USART3.OverrunDisableParam=ADVFEATURE_OVERRUN_DISABLE
USART3.Parity=PARITY_EVEN USART3.Parity=PARITY_NONE
USART3.VirtualMode-Asynchronous=VM_ASYNC USART3.VirtualMode-Asynchronous=VM_ASYNC
USART3.WordLength=WORDLENGTH_9B USART3.WordLength=WORDLENGTH_8B
USART6.BaudRate=19200 USART6.BaudRate=19200
USART6.DMADisableonRxErrorParam=ADVFEATURE_DMA_ENABLEONRXERROR USART6.DMADisableonRxErrorParam=ADVFEATURE_DMA_ENABLEONRXERROR
USART6.FIFOMode=FIFOMODE_ENABLE USART6.FIFOMode=FIFOMODE_ENABLE

Loading…
Cancel
Save