Bartosz Jakubski 1 месяц назад
Родитель
Сommit
75eb6912da

+ 2 - 2
OZE_Sensor/Core/Inc/adc_buffers.h

@@ -40,8 +40,8 @@ enum _ADC2_DataInfo { IL1 = 0, IL2, IL3, ADC2LastData };
 typedef enum _ADC2_DataInfo ADC2_DataInfo;
 
 struct _ADC2_Data {
-    uint16_t adcDataBuffer[ADC2LastData];
-    uint16_t dummy[(__SCB_DCACHE_LINE_SIZE / sizeof (uint16_t)) - ADC2LastData];
+    uint32_t adcDataBuffer[ADC2LastData];
+    uint32_t dummy[(__SCB_DCACHE_LINE_SIZE / sizeof (uint32_t)) - ADC2LastData];
 };
 
 enum _ADC3_DataInfo { pvTemp1 = 0, pvTemp2, motorXSense, motorYSense, VrefInt, ADC3LastData };

+ 4 - 2
OZE_Sensor/Core/Src/main.c

@@ -33,6 +33,8 @@
 #include "peripherial.h"
 #include "measurements.h"
 #include "position_task.h"
+
+#include "stm32h7xx_hal_adc_ex.h"
 /* USER CODE END Includes */
 
 /* Private typedef -----------------------------------------------------------*/
@@ -1263,7 +1265,7 @@ void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef *hadc)
 		{
 			osMessageQueuePut(adc1MeasDataQueue, &adc1Data, 0, 0);
 		}
-		if(HAL_ADCEx_MultiModeStart_DMA(&hadc1, (uint32_t *)adc1Data.adcDataBuffer, ADC1LastData*sizeof(uint32_t)) != HAL_OK)
+		if(HAL_ADCEx_MultiModeStart_DMA(&hadc1, (uint32_t *)adc1Data.adcDataBuffer, ADC1LastData) != HAL_OK)
 		{
 			Error_Handler();
 		}
@@ -1310,7 +1312,7 @@ void StartDefaultTask(void *argument)
   {
 	  Error_Handler();
   }
-  if(HAL_ADCEx_MultiModeStart_DMA(&hadc1, (uint32_t *)adc1Data.adcDataBuffer, ADC1LastData*sizeof(uint32_t)) != HAL_OK)
+  if(HAL_ADCEx_MultiModeStart_DMA(&hadc1, (uint32_t *)adc1Data.adcDataBuffer, ADC1LastData) != HAL_OK)
   {
 	  Error_Handler();
   }

+ 4 - 4
OZE_Sensor/Core/Src/stm32h7xx_hal_msp.c

@@ -181,8 +181,8 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc)
     hdma_adc1.Init.Direction = DMA_PERIPH_TO_MEMORY;
     hdma_adc1.Init.PeriphInc = DMA_PINC_DISABLE;
     hdma_adc1.Init.MemInc = DMA_MINC_ENABLE;
-    hdma_adc1.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD;
-    hdma_adc1.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;
+    hdma_adc1.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
+    hdma_adc1.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;
     hdma_adc1.Init.Mode = DMA_NORMAL;
     hdma_adc1.Init.Priority = DMA_PRIORITY_LOW;
     hdma_adc1.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
@@ -238,8 +238,8 @@ void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc)
     hdma_adc2.Init.Direction = DMA_PERIPH_TO_MEMORY;
     hdma_adc2.Init.PeriphInc = DMA_PINC_DISABLE;
     hdma_adc2.Init.MemInc = DMA_MINC_ENABLE;
-    hdma_adc2.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD;
-    hdma_adc2.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;
+    hdma_adc2.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;
+    hdma_adc2.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;
     hdma_adc2.Init.Mode = DMA_NORMAL;
     hdma_adc2.Init.Priority = DMA_PRIORITY_LOW;
     hdma_adc2.Init.FIFOMode = DMA_FIFOMODE_DISABLE;

Разница между файлами не показана из-за своего большого размера
+ 13 - 14
OZE_Sensor/OZE_Sensor.ioc