Browse Source

Few bugfixes

Dmitry Yu Okunev 3 years ago
parent
commit
b070360f48

+ 2 - 2
collector/firmware/Src/main.c

@@ -249,9 +249,9 @@ int main(void)
 	}
 #endif
 
-	uint8_t   local_mac[] = {0x02, 0x03, 0x04, 0x05, 0x06, 0x08};
+	uint8_t   local_mac[] = {0x02, 0x03, 0x04, 0x05, 0x06, 0x09};
 	uint8_t  remote_mac[] = {0x00, 0x1b, 0x21, 0x39, 0x37, 0x26};
-	uint8_t   local_ip[]  = {10,  4, 33, 124};
+	uint8_t   local_ip[]  = {10,  4, 33, 126};
 	uint8_t  remote_ip[]  = {10,  4, 33, 242};
 
 	ES_enc28j60SpiInit(&hspi1);

File diff suppressed because it is too large
+ 1 - 1
sensor/firmware/SW4STM32/firmware Configuration/.cproject


+ 11 - 2
sensor/firmware/Src/main.c

@@ -43,6 +43,9 @@
 
 typedef uint16_t dataitem_t;
 
+dataitem_t adc_raw[CHANNELS];
+uint32_t adc[CHANNELS];
+
 struct sensorcommand {
 	dataitem_t      command_id;
 	dataitem_t       sensor_id;
@@ -124,6 +127,12 @@ void blink(int times, int delay)
 	return;
 }
 
+/*
+void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)
+{
+}
+*/
+
 /* USER CODE END PFP */
 
 /* USER CODE BEGIN 0 */
@@ -161,7 +170,7 @@ int main(void)
 		//HAL_ADC_Stop_DMA(&hadc);
 		//HAL_ADC_Stop(&hadc);
 		LED_STATUS_GPIO_Port->BSRR = LED_STATUS_Pin;
-		int r = HAL_ADC_Start_DMA(&hadc, (uint32_t *)&scmd.channel, sizeof(scmd.channel)/sizeof(*scmd.channel));
+		int r = HAL_ADC_Start_DMA(&hadc, (uint32_t *)adc_raw, sizeof(adc)/sizeof(*adc));
 		LED_STATUS_GPIO_Port->BSRR = LED_STATUS_Pin << 16;
 
 		(void)r; // anti-warning
@@ -321,7 +330,7 @@ void MX_ADC_Init(void)
     */
   sConfig.Channel = ADC_CHANNEL_0;
   sConfig.Rank = ADC_RANK_CHANNEL_NUMBER;
-  sConfig.SamplingTime = ADC_SAMPLETIME_1CYCLE_5;
+  sConfig.SamplingTime = ADC_SAMPLETIME_71CYCLES_5;
   HAL_ADC_ConfigChannel(&hadc, &sConfig);
 
     /**Configure for the selected ADC regular channel to be converted. 

+ 1 - 1
sensor/firmware/Src/stm32f0xx_hal_msp.c

@@ -159,7 +159,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef* huart)
 
     GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3;
     GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
-    GPIO_InitStruct.Pull = GPIO_NOPULL;
+    GPIO_InitStruct.Pull = GPIO_PULLDOWN;
     GPIO_InitStruct.Speed = GPIO_SPEED_HIGH;
     GPIO_InitStruct.Alternate = GPIO_AF1_USART1;
     HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

+ 1 - 1
sensor/firmware/firmware.ioc

@@ -12,7 +12,7 @@ ADC.LowPowerAutoPowerOff=DISABLE
 ADC.LowPowerAutoWait=DISABLE
 ADC.Overrun=OVR_DATA_PRESERVED
 ADC.Resolution=ADC_RESOLUTION12b
-ADC.SamplingTime=ADC_SAMPLETIME_1CYCLE_5
+ADC.SamplingTime=ADC_SAMPLETIME_71CYCLES_5
 ADC.ScanConvMode=ADC_SCAN_DIRECTION_FORWARD
 Dma.ADC.0.Direction=DMA_PERIPH_TO_MEMORY
 Dma.ADC.0.Instance=DMA1_Channel1