friday code dump
This commit is contained in:
		@ -67,6 +67,8 @@ void Error_Handler(void);
 | 
				
			|||||||
#define PWM_PG_FAN1_GPIO_Port GPIOA
 | 
					#define PWM_PG_FAN1_GPIO_Port GPIOA
 | 
				
			||||||
#define PWM_PG_FAN2_Pin GPIO_PIN_3
 | 
					#define PWM_PG_FAN2_Pin GPIO_PIN_3
 | 
				
			||||||
#define PWM_PG_FAN2_GPIO_Port GPIOA
 | 
					#define PWM_PG_FAN2_GPIO_Port GPIOA
 | 
				
			||||||
 | 
					#define CSB_Pin GPIO_PIN_4
 | 
				
			||||||
 | 
					#define CSB_GPIO_Port GPIOA
 | 
				
			||||||
#define STATUS_LED_R_Pin GPIO_PIN_0
 | 
					#define STATUS_LED_R_Pin GPIO_PIN_0
 | 
				
			||||||
#define STATUS_LED_R_GPIO_Port GPIOB
 | 
					#define STATUS_LED_R_GPIO_Port GPIOB
 | 
				
			||||||
#define STATUS_LED_B_Pin GPIO_PIN_1
 | 
					#define STATUS_LED_B_Pin GPIO_PIN_1
 | 
				
			||||||
 | 
				
			|||||||
@ -267,7 +267,21 @@ uint8 writeCMD(uint16 command, uint8* args, uint8 arglen) {
 | 
				
			|||||||
  return ret;
 | 
					  return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define ITER_COUNT 50
 | 
				
			||||||
 | 
					static uint8_t count = 0;
 | 
				
			||||||
 | 
					static bool isOn = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
uint8 readCMD(uint16 command, uint8* buffer, uint8 buflen) {
 | 
					uint8 readCMD(uint16 command, uint8* buffer, uint8 buflen) {
 | 
				
			||||||
 | 
					  if (count == ITER_COUNT) {
 | 
				
			||||||
 | 
					    HAL_GPIO_WritePin(STATUS_LED_B_GPIO_Port, STATUS_LED_B_Pin, isOn ? GPIO_PIN_SET : GPIO_PIN_RESET);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    count = 0;
 | 
				
			||||||
 | 
					    isOn = !isOn;
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					    count++;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8 txbuffer[6 + buflen] = {};
 | 
					  uint8 txbuffer[6 + buflen] = {};
 | 
				
			||||||
  uint8 rxbuffer[6 + buflen] = {};
 | 
					  uint8 rxbuffer[6 + buflen] = {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -314,11 +328,11 @@ uint8 pollCMD(uint16 command) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void mcuAdbmsCSLow() {
 | 
					void mcuAdbmsCSLow() {
 | 
				
			||||||
  //HAL_GPIO_WritePin(CSB_GPIO_Port, CSB_Pin, GPIO_PIN_RESET);
 | 
					  HAL_GPIO_WritePin(CSB_GPIO_Port, CSB_Pin, GPIO_PIN_RESET);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void mcuAdbmsCSHigh() {
 | 
					void mcuAdbmsCSHigh() {
 | 
				
			||||||
  //HAL_GPIO_WritePin(CSB_GPIO_Port, CSB_Pin, GPIO_PIN_SET);
 | 
					  HAL_GPIO_WritePin(CSB_GPIO_Port, CSB_Pin, GPIO_PIN_SET);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
uint8 mcuSPITransmit(uint8* buffer, uint8 buffersize) {
 | 
					uint8 mcuSPITransmit(uint8* buffer, uint8 buffersize) {
 | 
				
			||||||
 | 
				
			|||||||
@ -38,7 +38,6 @@ static bool isOn = false;
 | 
				
			|||||||
void ams_can_send_status() {
 | 
					void ams_can_send_status() {
 | 
				
			||||||
  if (count == ITER_COUNT) {
 | 
					  if (count == ITER_COUNT) {
 | 
				
			||||||
    HAL_GPIO_WritePin(STATUS_LED_G_GPIO_Port, STATUS_LED_G_Pin, isOn ? GPIO_PIN_SET : GPIO_PIN_RESET);
 | 
					    HAL_GPIO_WritePin(STATUS_LED_G_GPIO_Port, STATUS_LED_G_Pin, isOn ? GPIO_PIN_SET : GPIO_PIN_RESET);
 | 
				
			||||||
    HAL_GPIO_WritePin(STATUS_LED_B_GPIO_Port, STATUS_LED_B_Pin, isOn ? GPIO_PIN_SET : GPIO_PIN_RESET);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    count = 0;
 | 
					    count = 0;
 | 
				
			||||||
    isOn = !isOn;
 | 
					    isOn = !isOn;
 | 
				
			||||||
 | 
				
			|||||||
@ -35,7 +35,7 @@ uint16_t amsov = 0;
 | 
				
			|||||||
uint8_t amserrorcode = 0;
 | 
					uint8_t amserrorcode = 0;
 | 
				
			||||||
uint8_t amswarningcode = 0;
 | 
					uint8_t amswarningcode = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
uint8_t numberofCells = 16;
 | 
					uint8_t numberofCells = 14;
 | 
				
			||||||
uint8_t numberofAux = 0;
 | 
					uint8_t numberofAux = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
uint8_t packetChecksumFails = 0;
 | 
					uint8_t packetChecksumFails = 0;
 | 
				
			||||||
@ -52,7 +52,7 @@ struct pollingTimes {
 | 
				
			|||||||
  uint32_t TMP1075;
 | 
					  uint32_t TMP1075;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct pollingTimes pollingTimes = {0, 0, 0, 0};
 | 
					struct pollingTimes pollingTimes = {0, 0};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void AMS_Init(SPI_HandleTypeDef* hspi) {
 | 
					void AMS_Init(SPI_HandleTypeDef* hspi) {
 | 
				
			||||||
  if (eepromconfigured == 1) {
 | 
					  if (eepromconfigured == 1) {
 | 
				
			||||||
@ -124,8 +124,8 @@ void AMS_Loop() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
uint8_t AMS_Idle_Loop() {
 | 
					uint8_t AMS_Idle_Loop() {
 | 
				
			||||||
  if (!amsWakeUp()) {
 | 
					  if (!amsWakeUp()) {
 | 
				
			||||||
    error_data.data_kind = SEK_INTERNAL_BMS_TIMEOUT;
 | 
					    //error_data.data_kind = SEK_INTERNAL_BMS_TIMEOUT;
 | 
				
			||||||
    set_error_source(ERROR_SOURCE_INTERNAL);
 | 
					    //set_error_source(ERROR_SOURCE_INTERNAL);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  packetChecksumFails += amsAuxAndStatusMeasurement(&module);
 | 
					  packetChecksumFails += amsAuxAndStatusMeasurement(&module);
 | 
				
			||||||
@ -197,34 +197,6 @@ uint8_t AMS_Idle_Loop() {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  mcuDelay(10);
 | 
					  mcuDelay(10);
 | 
				
			||||||
 | 
					 | 
				
			||||||
  //	  static uint32_t channelstobalance = 1;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //	  channelstobalance = 0x1FFFF;
 | 
					 | 
				
			||||||
  /*  if(channelstobalance & 0x20000){
 | 
					 | 
				
			||||||
           channelstobalance = 1;
 | 
					 | 
				
			||||||
    }*/
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  //	  amsConfigBalancing(channelstobalance);
 | 
					 | 
				
			||||||
  //	  amsStartBalancing(100);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  if ((module.overVoltage | module.underVoltage)) {
 | 
					 | 
				
			||||||
    // amsSendWarning();
 | 
					 | 
				
			||||||
    //  currentAMSState = AMSWARNING;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  // AMS_Balancing_Loop();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  /* if(BalancingActive)
 | 
					 | 
				
			||||||
   {
 | 
					 | 
				
			||||||
           amsStartBalancing(100);
 | 
					 | 
				
			||||||
   }
 | 
					 | 
				
			||||||
   else
 | 
					 | 
				
			||||||
   {
 | 
					 | 
				
			||||||
           amsStopBalancing();
 | 
					 | 
				
			||||||
   }*/
 | 
					 | 
				
			||||||
  // amsConfigBalancing(balancedCells);
 | 
					 | 
				
			||||||
  // volatile amscheck = amscheckOpenCellWire(&module);
 | 
					 | 
				
			||||||
  return 0;
 | 
					  return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -29,6 +29,7 @@
 | 
				
			|||||||
#include "eeprom.h"
 | 
					#include "eeprom.h"
 | 
				
			||||||
#include "errors.h"
 | 
					#include "errors.h"
 | 
				
			||||||
#include "stm32f3xx_hal.h"
 | 
					#include "stm32f3xx_hal.h"
 | 
				
			||||||
 | 
					#include "stm32f3xx_hal_gpio.h"
 | 
				
			||||||
/* USER CODE END Includes */
 | 
					/* USER CODE END Includes */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Private typedef -----------------------------------------------------------*/
 | 
					/* Private typedef -----------------------------------------------------------*/
 | 
				
			||||||
@ -118,6 +119,12 @@ int main(void)
 | 
				
			|||||||
  /* USER CODE BEGIN 2 */
 | 
					  /* USER CODE BEGIN 2 */
 | 
				
			||||||
  tmp1075_init(&hi2c1);
 | 
					  tmp1075_init(&hi2c1);
 | 
				
			||||||
  AMS_Init(&hspi1);
 | 
					  AMS_Init(&hspi1);
 | 
				
			||||||
 | 
					  ams_can_init(&hcan);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  bool relay_actual = false;
 | 
				
			||||||
 | 
					  bool relay_target = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  uint32_t target_time = HAL_GetTick() + 10000;
 | 
				
			||||||
  /* USER CODE END 2 */
 | 
					  /* USER CODE END 2 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* Infinite loop */
 | 
					  /* Infinite loop */
 | 
				
			||||||
@ -135,6 +142,13 @@ int main(void)
 | 
				
			|||||||
      ams_can_send_error();
 | 
					      ams_can_send_error();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    ams_can_send_log();
 | 
					    ams_can_send_log();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (HAL_GetTick() >= target_time) {
 | 
				
			||||||
 | 
					      HAL_GPIO_WritePin(RELAY_EN_GPIO_Port, RELAY_EN_Pin, relay_target ? GPIO_PIN_SET : GPIO_PIN_RESET);
 | 
				
			||||||
 | 
					      HAL_GPIO_WritePin(STATUS_LED_R_GPIO_Port, STATUS_LED_R_Pin, relay_target ? GPIO_PIN_RESET : GPIO_PIN_SET);
 | 
				
			||||||
 | 
					      target_time = HAL_GetTick() + 10000;
 | 
				
			||||||
 | 
					      relay_target = !relay_target;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  /* USER CODE END 3 */
 | 
					  /* USER CODE END 3 */
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -294,7 +308,7 @@ static void MX_SPI1_Init(void)
 | 
				
			|||||||
  hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
 | 
					  hspi1.Init.DataSize = SPI_DATASIZE_8BIT;
 | 
				
			||||||
  hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
 | 
					  hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
 | 
				
			||||||
  hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
 | 
					  hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
 | 
				
			||||||
  hspi1.Init.NSS = SPI_NSS_HARD_OUTPUT;
 | 
					  hspi1.Init.NSS = SPI_NSS_SOFT;
 | 
				
			||||||
  hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_32;
 | 
					  hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_32;
 | 
				
			||||||
  hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
 | 
					  hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
 | 
				
			||||||
  hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
 | 
					  hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
 | 
				
			||||||
@ -505,7 +519,10 @@ static void MX_GPIO_Init(void)
 | 
				
			|||||||
  __HAL_RCC_GPIOB_CLK_ENABLE();
 | 
					  __HAL_RCC_GPIOB_CLK_ENABLE();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /*Configure GPIO pin Output Level */
 | 
					  /*Configure GPIO pin Output Level */
 | 
				
			||||||
  HAL_GPIO_WritePin(GPIOA, RELAY_EN_Pin|_60V_EN_Pin, GPIO_PIN_RESET);
 | 
					  HAL_GPIO_WritePin(GPIOA, RELAY_EN_Pin|_60V_EN_Pin|CSB_Pin, GPIO_PIN_RESET);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  /*Configure GPIO pin Output Level */
 | 
				
			||||||
 | 
					  HAL_GPIO_WritePin(GPIOB, STATUS_LED_R_Pin|STATUS_LED_B_Pin|STATUS_LED_G_Pin, GPIO_PIN_SET);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /*Configure GPIO pin Output Level */
 | 
					  /*Configure GPIO pin Output Level */
 | 
				
			||||||
  HAL_GPIO_WritePin(GPIOB, PRECHARGE_EN_Pin|AUX_IN_Pin, GPIO_PIN_RESET);
 | 
					  HAL_GPIO_WritePin(GPIOB, PRECHARGE_EN_Pin|AUX_IN_Pin, GPIO_PIN_RESET);
 | 
				
			||||||
@ -516,17 +533,20 @@ static void MX_GPIO_Init(void)
 | 
				
			|||||||
  GPIO_InitStruct.Pull = GPIO_NOPULL;
 | 
					  GPIO_InitStruct.Pull = GPIO_NOPULL;
 | 
				
			||||||
  HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
 | 
					  HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /*Configure GPIO pins : RELAY_EN_Pin _60V_EN_Pin */
 | 
					  /*Configure GPIO pins : RELAY_EN_Pin _60V_EN_Pin CSB_Pin */
 | 
				
			||||||
  GPIO_InitStruct.Pin = RELAY_EN_Pin|_60V_EN_Pin;
 | 
					  GPIO_InitStruct.Pin = RELAY_EN_Pin|_60V_EN_Pin|CSB_Pin;
 | 
				
			||||||
  GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
 | 
					  GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
 | 
				
			||||||
  GPIO_InitStruct.Pull = GPIO_NOPULL;
 | 
					  GPIO_InitStruct.Pull = GPIO_NOPULL;
 | 
				
			||||||
  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
 | 
					  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
 | 
				
			||||||
  HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
 | 
					  HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /*Configure GPIO pins : STATUS_LED_R_Pin STATUS_LED_B_Pin STATUS_LED_G_Pin AUX_OUT_Pin */
 | 
					  /*Configure GPIO pins : STATUS_LED_R_Pin STATUS_LED_B_Pin STATUS_LED_G_Pin PRECHARGE_EN_Pin
 | 
				
			||||||
  GPIO_InitStruct.Pin = STATUS_LED_R_Pin|STATUS_LED_B_Pin|STATUS_LED_G_Pin|AUX_OUT_Pin;
 | 
					                           AUX_IN_Pin */
 | 
				
			||||||
  GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
 | 
					  GPIO_InitStruct.Pin = STATUS_LED_R_Pin|STATUS_LED_B_Pin|STATUS_LED_G_Pin|PRECHARGE_EN_Pin
 | 
				
			||||||
 | 
					                          |AUX_IN_Pin;
 | 
				
			||||||
 | 
					  GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
 | 
				
			||||||
  GPIO_InitStruct.Pull = GPIO_NOPULL;
 | 
					  GPIO_InitStruct.Pull = GPIO_NOPULL;
 | 
				
			||||||
 | 
					  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
 | 
				
			||||||
  HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
 | 
					  HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /*Configure GPIO pins : PB10 PB12 PB4 PB5
 | 
					  /*Configure GPIO pins : PB10 PB12 PB4 PB5
 | 
				
			||||||
@ -537,12 +557,11 @@ static void MX_GPIO_Init(void)
 | 
				
			|||||||
  GPIO_InitStruct.Pull = GPIO_NOPULL;
 | 
					  GPIO_InitStruct.Pull = GPIO_NOPULL;
 | 
				
			||||||
  HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
 | 
					  HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /*Configure GPIO pins : PRECHARGE_EN_Pin AUX_IN_Pin */
 | 
					  /*Configure GPIO pin : AUX_OUT_Pin */
 | 
				
			||||||
  GPIO_InitStruct.Pin = PRECHARGE_EN_Pin|AUX_IN_Pin;
 | 
					  GPIO_InitStruct.Pin = AUX_OUT_Pin;
 | 
				
			||||||
  GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
 | 
					  GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
 | 
				
			||||||
  GPIO_InitStruct.Pull = GPIO_NOPULL;
 | 
					  GPIO_InitStruct.Pull = GPIO_NOPULL;
 | 
				
			||||||
  GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
 | 
					  HAL_GPIO_Init(AUX_OUT_GPIO_Port, &GPIO_InitStruct);
 | 
				
			||||||
  HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /*Configure GPIO pins : RELAY_BATT_SIDE_ON_Pin RELAY_ESC_SIDE_ON_Pin CURRENT_SENSOR_ON_Pin */
 | 
					  /*Configure GPIO pins : RELAY_BATT_SIDE_ON_Pin RELAY_ESC_SIDE_ON_Pin CURRENT_SENSOR_ON_Pin */
 | 
				
			||||||
  GPIO_InitStruct.Pin = RELAY_BATT_SIDE_ON_Pin|RELAY_ESC_SIDE_ON_Pin|CURRENT_SENSOR_ON_Pin;
 | 
					  GPIO_InitStruct.Pin = RELAY_BATT_SIDE_ON_Pin|RELAY_ESC_SIDE_ON_Pin|CURRENT_SENSOR_ON_Pin;
 | 
				
			||||||
 | 
				
			|||||||
@ -238,12 +238,11 @@ void HAL_SPI_MspInit(SPI_HandleTypeDef* hspi)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    __HAL_RCC_GPIOA_CLK_ENABLE();
 | 
					    __HAL_RCC_GPIOA_CLK_ENABLE();
 | 
				
			||||||
    /**SPI1 GPIO Configuration
 | 
					    /**SPI1 GPIO Configuration
 | 
				
			||||||
    PA4     ------> SPI1_NSS
 | 
					 | 
				
			||||||
    PA5     ------> SPI1_SCK
 | 
					    PA5     ------> SPI1_SCK
 | 
				
			||||||
    PA6     ------> SPI1_MISO
 | 
					    PA6     ------> SPI1_MISO
 | 
				
			||||||
    PA7     ------> SPI1_MOSI
 | 
					    PA7     ------> SPI1_MOSI
 | 
				
			||||||
    */
 | 
					    */
 | 
				
			||||||
    GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7;
 | 
					    GPIO_InitStruct.Pin = GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7;
 | 
				
			||||||
    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
 | 
					    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
 | 
				
			||||||
    GPIO_InitStruct.Pull = GPIO_NOPULL;
 | 
					    GPIO_InitStruct.Pull = GPIO_NOPULL;
 | 
				
			||||||
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
 | 
					    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
 | 
				
			||||||
@ -274,12 +273,11 @@ void HAL_SPI_MspDeInit(SPI_HandleTypeDef* hspi)
 | 
				
			|||||||
    __HAL_RCC_SPI1_CLK_DISABLE();
 | 
					    __HAL_RCC_SPI1_CLK_DISABLE();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**SPI1 GPIO Configuration
 | 
					    /**SPI1 GPIO Configuration
 | 
				
			||||||
    PA4     ------> SPI1_NSS
 | 
					 | 
				
			||||||
    PA5     ------> SPI1_SCK
 | 
					    PA5     ------> SPI1_SCK
 | 
				
			||||||
    PA6     ------> SPI1_MISO
 | 
					    PA6     ------> SPI1_MISO
 | 
				
			||||||
    PA7     ------> SPI1_MOSI
 | 
					    PA7     ------> SPI1_MOSI
 | 
				
			||||||
    */
 | 
					    */
 | 
				
			||||||
    HAL_GPIO_DeInit(GPIOA, GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7);
 | 
					    HAL_GPIO_DeInit(GPIOA, GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /* USER CODE BEGIN SPI1_MspDeInit 1 */
 | 
					  /* USER CODE BEGIN SPI1_MspDeInit 1 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							@ -1,5 +1,5 @@
 | 
				
			|||||||
##########################################################################################################################
 | 
					##########################################################################################################################
 | 
				
			||||||
# File automatically-generated by tool: [projectgenerator] version: [4.3.0-B58] date: [Fri May 10 18:57:11 CEST 2024] 
 | 
					# File automatically-generated by tool: [projectgenerator] version: [4.3.0-B58] date: [Fri May 17 19:29:11 CEST 2024] 
 | 
				
			||||||
##########################################################################################################################
 | 
					##########################################################################################################################
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# ------------------------------------------------
 | 
					# ------------------------------------------------
 | 
				
			||||||
 | 
				
			|||||||
@ -7,7 +7,7 @@ CAN.CalculateTimeBit=3000
 | 
				
			|||||||
CAN.CalculateTimeQuantum=1000.0
 | 
					CAN.CalculateTimeQuantum=1000.0
 | 
				
			||||||
CAN.IPParameters=CalculateTimeQuantum,CalculateTimeBit,CalculateBaudRate
 | 
					CAN.IPParameters=CalculateTimeQuantum,CalculateTimeBit,CalculateBaudRate
 | 
				
			||||||
File.Version=6
 | 
					File.Version=6
 | 
				
			||||||
GPIO.groupedBy=
 | 
					GPIO.groupedBy=Group By Peripherals
 | 
				
			||||||
KeepUserPlacement=true
 | 
					KeepUserPlacement=true
 | 
				
			||||||
Mcu.CPN=STM32F302CBT6
 | 
					Mcu.CPN=STM32F302CBT6
 | 
				
			||||||
Mcu.Family=STM32F3
 | 
					Mcu.Family=STM32F3
 | 
				
			||||||
@ -70,13 +70,15 @@ NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
 | 
				
			|||||||
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
 | 
					NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
 | 
				
			||||||
NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:false\:true\:false
 | 
					NVIC.SysTick_IRQn=true\:15\:0\:false\:false\:true\:false\:true\:false
 | 
				
			||||||
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
 | 
					NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
 | 
				
			||||||
PA0.GPIOParameters=GPIO_Label
 | 
					PA0.GPIOParameters=PinState,GPIO_Label
 | 
				
			||||||
PA0.GPIO_Label=RELAY_EN
 | 
					PA0.GPIO_Label=RELAY_EN
 | 
				
			||||||
PA0.Locked=true
 | 
					PA0.Locked=true
 | 
				
			||||||
 | 
					PA0.PinState=GPIO_PIN_RESET
 | 
				
			||||||
PA0.Signal=GPIO_Output
 | 
					PA0.Signal=GPIO_Output
 | 
				
			||||||
PA1.GPIOParameters=GPIO_Label
 | 
					PA1.GPIOParameters=PinState,GPIO_Label
 | 
				
			||||||
PA1.GPIO_Label=_60V_EN
 | 
					PA1.GPIO_Label=_60V_EN
 | 
				
			||||||
PA1.Locked=true
 | 
					PA1.Locked=true
 | 
				
			||||||
 | 
					PA1.PinState=GPIO_PIN_RESET
 | 
				
			||||||
PA1.Signal=GPIO_Output
 | 
					PA1.Signal=GPIO_Output
 | 
				
			||||||
PA10.GPIOParameters=GPIO_Label
 | 
					PA10.GPIOParameters=GPIO_Label
 | 
				
			||||||
PA10.GPIO_Label=CURRENT_SENSOR_ON
 | 
					PA10.GPIO_Label=CURRENT_SENSOR_ON
 | 
				
			||||||
@ -105,9 +107,10 @@ PA3.GPIOParameters=GPIO_Label
 | 
				
			|||||||
PA3.GPIO_Label=PWM_PG_FAN2
 | 
					PA3.GPIO_Label=PWM_PG_FAN2
 | 
				
			||||||
PA3.Locked=true
 | 
					PA3.Locked=true
 | 
				
			||||||
PA3.Signal=S_TIM15_CH2
 | 
					PA3.Signal=S_TIM15_CH2
 | 
				
			||||||
 | 
					PA4.GPIOParameters=GPIO_Label
 | 
				
			||||||
 | 
					PA4.GPIO_Label=CSB
 | 
				
			||||||
PA4.Locked=true
 | 
					PA4.Locked=true
 | 
				
			||||||
PA4.Mode=NSS_Signal_Hard_Output
 | 
					PA4.Signal=GPIO_Output
 | 
				
			||||||
PA4.Signal=SPI1_NSS
 | 
					 | 
				
			||||||
PA5.Locked=true
 | 
					PA5.Locked=true
 | 
				
			||||||
PA5.Mode=Full_Duplex_Master
 | 
					PA5.Mode=Full_Duplex_Master
 | 
				
			||||||
PA5.Signal=SPI1_SCK
 | 
					PA5.Signal=SPI1_SCK
 | 
				
			||||||
@ -125,17 +128,20 @@ PA9.GPIOParameters=GPIO_Label
 | 
				
			|||||||
PA9.GPIO_Label=RELAY_ESC_SIDE_ON
 | 
					PA9.GPIO_Label=RELAY_ESC_SIDE_ON
 | 
				
			||||||
PA9.Locked=true
 | 
					PA9.Locked=true
 | 
				
			||||||
PA9.Signal=GPIO_Input
 | 
					PA9.Signal=GPIO_Input
 | 
				
			||||||
PB0.GPIOParameters=GPIO_Label
 | 
					PB0.GPIOParameters=PinState,GPIO_Label
 | 
				
			||||||
PB0.GPIO_Label=STATUS_LED_R
 | 
					PB0.GPIO_Label=STATUS_LED_R
 | 
				
			||||||
PB0.Locked=true
 | 
					PB0.Locked=true
 | 
				
			||||||
PB0.Signal=GPIO_Input
 | 
					PB0.PinState=GPIO_PIN_SET
 | 
				
			||||||
PB1.GPIOParameters=GPIO_Label
 | 
					PB0.Signal=GPIO_Output
 | 
				
			||||||
 | 
					PB1.GPIOParameters=PinState,GPIO_Label
 | 
				
			||||||
PB1.GPIO_Label=STATUS_LED_B
 | 
					PB1.GPIO_Label=STATUS_LED_B
 | 
				
			||||||
PB1.Locked=true
 | 
					PB1.Locked=true
 | 
				
			||||||
PB1.Signal=GPIO_Input
 | 
					PB1.PinState=GPIO_PIN_SET
 | 
				
			||||||
PB11.GPIOParameters=GPIO_Label
 | 
					PB1.Signal=GPIO_Output
 | 
				
			||||||
 | 
					PB11.GPIOParameters=PinState,GPIO_Label
 | 
				
			||||||
PB11.GPIO_Label=PRECHARGE_EN
 | 
					PB11.GPIO_Label=PRECHARGE_EN
 | 
				
			||||||
PB11.Locked=true
 | 
					PB11.Locked=true
 | 
				
			||||||
 | 
					PB11.PinState=GPIO_PIN_RESET
 | 
				
			||||||
PB11.Signal=GPIO_Output
 | 
					PB11.Signal=GPIO_Output
 | 
				
			||||||
PB13.GPIOParameters=GPIO_Label
 | 
					PB13.GPIOParameters=GPIO_Label
 | 
				
			||||||
PB13.GPIO_Label=AUX_IN
 | 
					PB13.GPIO_Label=AUX_IN
 | 
				
			||||||
@ -148,10 +154,11 @@ PB14.Signal=GPIO_Input
 | 
				
			|||||||
PB15.Locked=true
 | 
					PB15.Locked=true
 | 
				
			||||||
PB15.Mode=PWM Generation3 CH3N
 | 
					PB15.Mode=PWM Generation3 CH3N
 | 
				
			||||||
PB15.Signal=TIM1_CH3N
 | 
					PB15.Signal=TIM1_CH3N
 | 
				
			||||||
PB2.GPIOParameters=GPIO_Label
 | 
					PB2.GPIOParameters=PinState,GPIO_Label
 | 
				
			||||||
PB2.GPIO_Label=STATUS_LED_G
 | 
					PB2.GPIO_Label=STATUS_LED_G
 | 
				
			||||||
PB2.Locked=true
 | 
					PB2.Locked=true
 | 
				
			||||||
PB2.Signal=GPIO_Input
 | 
					PB2.PinState=GPIO_PIN_SET
 | 
				
			||||||
 | 
					PB2.Signal=GPIO_Output
 | 
				
			||||||
PB3.Locked=true
 | 
					PB3.Locked=true
 | 
				
			||||||
PB3.Mode=Trace_Asynchronous_SW
 | 
					PB3.Mode=Trace_Asynchronous_SW
 | 
				
			||||||
PB3.Signal=SYS_JTDO-TRACESWO
 | 
					PB3.Signal=SYS_JTDO-TRACESWO
 | 
				
			||||||
@ -244,9 +251,8 @@ SPI1.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_32
 | 
				
			|||||||
SPI1.CalculateBaudRate=500.0 KBits/s
 | 
					SPI1.CalculateBaudRate=500.0 KBits/s
 | 
				
			||||||
SPI1.DataSize=SPI_DATASIZE_8BIT
 | 
					SPI1.DataSize=SPI_DATASIZE_8BIT
 | 
				
			||||||
SPI1.Direction=SPI_DIRECTION_2LINES
 | 
					SPI1.Direction=SPI_DIRECTION_2LINES
 | 
				
			||||||
SPI1.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate,VirtualNSS,DataSize,BaudRatePrescaler
 | 
					SPI1.IPParameters=VirtualType,Mode,Direction,CalculateBaudRate,DataSize,BaudRatePrescaler
 | 
				
			||||||
SPI1.Mode=SPI_MODE_MASTER
 | 
					SPI1.Mode=SPI_MODE_MASTER
 | 
				
			||||||
SPI1.VirtualNSS=VM_NSSHARD
 | 
					 | 
				
			||||||
SPI1.VirtualType=VM_MASTER
 | 
					SPI1.VirtualType=VM_MASTER
 | 
				
			||||||
TIM1.Channel-PWM\ Generation3\ CH3N=TIM_CHANNEL_3
 | 
					TIM1.Channel-PWM\ Generation3\ CH3N=TIM_CHANNEL_3
 | 
				
			||||||
TIM1.IPParameters=Channel-PWM Generation3 CH3N
 | 
					TIM1.IPParameters=Channel-PWM Generation3 CH3N
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user