comparison Small_CPU/Src/baseCPU2.c @ 889:cf3967fe6924 Evo_2_23

GNSS work in progress
author heinrichsweikamp
date Fri, 06 Sep 2024 16:46:22 +0200
parents 17f02ac9da67
children 651d21777b61
comparison
equal deleted inserted replaced
888:07af9efd7c13 889:cf3967fe6924
141 #include "batteryCharger.h" 141 #include "batteryCharger.h"
142 #include "scheduler.h" 142 #include "scheduler.h"
143 #include "tm_stm32f4_otp.h" 143 #include "tm_stm32f4_otp.h"
144 #include "externalInterface.h" 144 #include "externalInterface.h"
145 #include "uart.h" 145 #include "uart.h"
146 #include "GNSS.h"
147
146 148
147 // From Common/Inc: 149 // From Common/Inc:
148 #include "calc_crush.h" 150 #include "calc_crush.h"
149 #include "decom.h" 151 #include "decom.h"
150 #include "FirmwareData.h" 152 #include "FirmwareData.h"
151 153
152 // From Common/Drivers/ 154 // From Common/Drivers/
153 #include "stm32f4xx_hal.h"
154 #include <stdio.h> 155 #include <stdio.h>
156
155 157
156 uint8_t coldstart __attribute__((section (".noinit"))); 158 uint8_t coldstart __attribute__((section (".noinit")));
157 159
158 uint8_t hasExternalClock(void) { 160 uint8_t hasExternalClock(void) {
159 if ((TM_OTP_Read(0, 0) > 0) && (TM_OTP_Read(0, 0) < 0xFF)) 161 if ((TM_OTP_Read(0, 0) > 0) && (TM_OTP_Read(0, 0) < 0xFF))
413 GPIO_Power_MainCPU_ON(); 415 GPIO_Power_MainCPU_ON();
414 416
415 GPIO_LED_GREEN_OFF(); 417 GPIO_LED_GREEN_OFF();
416 418
417 GPIO_LED_RED_ON(); 419 GPIO_LED_RED_ON();
418 GPIO_VIBRATION_ON(); 420 //GPIO_VIBRATION_ON();
419 HAL_Delay(100); 421 HAL_Delay(100);
420 GPIO_LED_RED_OFF(); 422 GPIO_LED_RED_OFF();
421 GPIO_VIBRATION_OFF(); 423 GPIO_VIBRATION_OFF();
422 GPIO_GPS_ON(); 424 GPIO_GPS_ON();
423 GPIO_GPS_BCKP_ON(); 425 GPIO_GPS_BCKP_ON();
425 SPI_synchronize_with_Master(); 427 SPI_synchronize_with_Master();
426 MX_DMA_Init(); 428 MX_DMA_Init();
427 MX_SPI1_Init(); 429 MX_SPI1_Init();
428 SPI_Start_single_TxRx_with_Master(); /* be prepared for the first data exchange */ 430 SPI_Start_single_TxRx_with_Master(); /* be prepared for the first data exchange */
429 Scheduler_Request_sync_with_SPI(SPI_SYNC_METHOD_HARD); 431 Scheduler_Request_sync_with_SPI(SPI_SYNC_METHOD_HARD);
432
433 // GNSS tests
434 GNSS_IO_init();
435 MX_USART6_UART_Init();
436 GNSS_Init(&GNSS_Handle, &huart6);
437 HAL_Delay(1000);
438 GNSS_LoadConfig(&GNSS_Handle);
439 HAL_Delay(10);
440 GNSS_GetUniqID(&GNSS_Handle);
441 GNSS_ParseBuffer(&GNSS_Handle);
442 HAL_Delay(10);
443 GNSS_GetPVTData(&GNSS_Handle);
444 GNSS_ParseBuffer(&GNSS_Handle);
445
446
430 global.mode = MODE_SURFACE; 447 global.mode = MODE_SURFACE;
431 break; 448 break;
432 449
433 case MODE_CALIB: 450 case MODE_CALIB:
434 scheduleCompassCalibrationMode(); 451 scheduleCompassCalibrationMode();