--upd
This commit is contained in:
@@ -73,7 +73,7 @@
|
||||
/** \brief Configure number of bytes in the host->target data packet. */
|
||||
#define BOOT_COM_RS232_RX_MAX_DATA (129)
|
||||
/** \brief Select the desired UART peripheral as a zero based index. */
|
||||
#define BOOT_COM_RS232_CHANNEL_INDEX (1)
|
||||
#define BOOT_COM_RS232_CHANNEL_INDEX (0)
|
||||
|
||||
|
||||
/****************************************************************************************
|
||||
|
||||
@@ -11,8 +11,9 @@ Mcu.IP0=CRC
|
||||
Mcu.IP1=NVIC
|
||||
Mcu.IP2=RCC
|
||||
Mcu.IP3=SYS
|
||||
Mcu.IP4=USART2
|
||||
Mcu.IPNb=5
|
||||
Mcu.IP4=USART1
|
||||
Mcu.IP5=USART2
|
||||
Mcu.IPNb=6
|
||||
Mcu.Name=STM32G070CBTx
|
||||
Mcu.Package=LQFP48
|
||||
Mcu.Pin0=PF0-OSC_IN (PF0)
|
||||
@@ -56,8 +57,10 @@ PA5.GPIO_Label=READER_EN
|
||||
PA5.Locked=true
|
||||
PA5.Signal=GPIO_Output
|
||||
PB6.Locked=true
|
||||
PB6.Mode=Asynchronous
|
||||
PB6.Signal=USART1_TX
|
||||
PB7.Locked=true
|
||||
PB7.Mode=Asynchronous
|
||||
PB7.Signal=USART1_RX
|
||||
PF0-OSC_IN\ (PF0).Mode=HSE-External-Oscillator
|
||||
PF0-OSC_IN\ (PF0).Signal=RCC_OSC_IN
|
||||
@@ -92,7 +95,7 @@ ProjectManager.StackSize=0x400
|
||||
ProjectManager.TargetToolchain=STM32CubeIDE
|
||||
ProjectManager.ToolChainLocation=
|
||||
ProjectManager.UnderRoot=true
|
||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-LL-false,2-MX_GPIO_Init-GPIO-false-LL-true,3-MX_USART2_UART_Init-USART2-false-LL-true,4-MX_CRC_Init-CRC-false-HAL-true
|
||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-LL-false,2-MX_GPIO_Init-GPIO-false-LL-true,3-MX_USART2_UART_Init-USART2-false-LL-true,4-MX_CRC_Init-CRC-false-HAL-true,5-MX_USART1_UART_Init-USART1-false-LL-true
|
||||
RCC.ADCFreq_Value=64000000
|
||||
RCC.AHBFreq_Value=64000000
|
||||
RCC.APBFreq_Value=64000000
|
||||
@@ -120,6 +123,9 @@ RCC.USART1Freq_Value=64000000
|
||||
RCC.USART2Freq_Value=64000000
|
||||
RCC.VCOInputFreq_Value=16000000
|
||||
RCC.VCOOutputFreq_Value=128000000
|
||||
USART1.BaudRate=9600
|
||||
USART1.IPParameters=VirtualMode-Asynchronous,BaudRate
|
||||
USART1.VirtualMode-Asynchronous=VM_ASYNC
|
||||
USART2.BaudRate=9600
|
||||
USART2.IPParameters=VirtualMode-Asynchronous,BaudRate
|
||||
USART2.VirtualMode-Asynchronous=VM_ASYNC
|
||||
|
||||
@@ -36,6 +36,7 @@ extern "C" {
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
void MX_USART1_UART_Init(void);
|
||||
void MX_USART2_UART_Init(void);
|
||||
|
||||
/* USER CODE BEGIN Prototypes */
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
|
||||
/* CRC init function */
|
||||
|
||||
void HAL_CRC_MspInit(CRC_HandleTypeDef* crcHandle)
|
||||
{
|
||||
|
||||
|
||||
@@ -39,8 +39,6 @@
|
||||
* EVENT_OUT
|
||||
* EXTI
|
||||
PA11 [PA9] ------> I2C2_SCL
|
||||
PB6 ------> USART1_TX
|
||||
PB7 ------> USART1_RX
|
||||
*/
|
||||
void MX_GPIO_Init(void)
|
||||
{
|
||||
@@ -72,24 +70,6 @@ void MX_GPIO_Init(void)
|
||||
GPIO_InitStruct.Alternate = LL_GPIO_AF_6;
|
||||
LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
/**/
|
||||
GPIO_InitStruct.Pin = LL_GPIO_PIN_6;
|
||||
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||
GPIO_InitStruct.Alternate = LL_GPIO_AF_0;
|
||||
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
/**/
|
||||
GPIO_InitStruct.Pin = LL_GPIO_PIN_7;
|
||||
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||
GPIO_InitStruct.Alternate = LL_GPIO_AF_0;
|
||||
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 2 */
|
||||
|
||||
@@ -89,6 +89,7 @@ int main(void)
|
||||
MX_GPIO_Init();
|
||||
MX_USART2_UART_Init();
|
||||
MX_CRC_Init();
|
||||
MX_USART1_UART_Init();
|
||||
/* USER CODE BEGIN 2 */
|
||||
/* Initialize the bootloader application. */
|
||||
AppInit();
|
||||
|
||||
@@ -24,6 +24,77 @@
|
||||
|
||||
/* USER CODE END 0 */
|
||||
|
||||
/* USART1 init function */
|
||||
|
||||
void MX_USART1_UART_Init(void)
|
||||
{
|
||||
|
||||
/* USER CODE BEGIN USART1_Init 0 */
|
||||
|
||||
/* USER CODE END USART1_Init 0 */
|
||||
|
||||
LL_USART_InitTypeDef USART_InitStruct = {0};
|
||||
|
||||
LL_GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
|
||||
LL_RCC_SetUSARTClockSource(LL_RCC_USART1_CLKSOURCE_PCLK1);
|
||||
|
||||
/* Peripheral clock enable */
|
||||
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_USART1);
|
||||
|
||||
LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOB);
|
||||
/**USART1 GPIO Configuration
|
||||
PB6 ------> USART1_TX
|
||||
PB7 ------> USART1_RX
|
||||
*/
|
||||
GPIO_InitStruct.Pin = LL_GPIO_PIN_6;
|
||||
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||
GPIO_InitStruct.Alternate = LL_GPIO_AF_0;
|
||||
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = LL_GPIO_PIN_7;
|
||||
GPIO_InitStruct.Mode = LL_GPIO_MODE_ALTERNATE;
|
||||
GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
||||
GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
||||
GPIO_InitStruct.Alternate = LL_GPIO_AF_0;
|
||||
LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
|
||||
/* USER CODE BEGIN USART1_Init 1 */
|
||||
|
||||
/* USER CODE END USART1_Init 1 */
|
||||
USART_InitStruct.PrescalerValue = LL_USART_PRESCALER_DIV1;
|
||||
USART_InitStruct.BaudRate = 9600;
|
||||
USART_InitStruct.DataWidth = LL_USART_DATAWIDTH_8B;
|
||||
USART_InitStruct.StopBits = LL_USART_STOPBITS_1;
|
||||
USART_InitStruct.Parity = LL_USART_PARITY_NONE;
|
||||
USART_InitStruct.TransferDirection = LL_USART_DIRECTION_TX_RX;
|
||||
USART_InitStruct.HardwareFlowControl = LL_USART_HWCONTROL_NONE;
|
||||
USART_InitStruct.OverSampling = LL_USART_OVERSAMPLING_16;
|
||||
LL_USART_Init(USART1, &USART_InitStruct);
|
||||
LL_USART_SetTXFIFOThreshold(USART1, LL_USART_FIFOTHRESHOLD_1_8);
|
||||
LL_USART_SetRXFIFOThreshold(USART1, LL_USART_FIFOTHRESHOLD_1_8);
|
||||
LL_USART_DisableFIFO(USART1);
|
||||
LL_USART_ConfigAsyncMode(USART1);
|
||||
|
||||
/* USER CODE BEGIN WKUPType USART1 */
|
||||
|
||||
/* USER CODE END WKUPType USART1 */
|
||||
|
||||
LL_USART_Enable(USART1);
|
||||
|
||||
/* Polling USART1 initialisation */
|
||||
while((!(LL_USART_IsActiveFlag_TEACK(USART1))) || (!(LL_USART_IsActiveFlag_REACK(USART1))))
|
||||
{
|
||||
}
|
||||
/* USER CODE BEGIN USART1_Init 2 */
|
||||
|
||||
/* USER CODE END USART1_Init 2 */
|
||||
|
||||
}
|
||||
/* USART2 init function */
|
||||
|
||||
void MX_USART2_UART_Init(void)
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
* BOOT_BACKDOOR_ENTRY_TIMEOUT_MS to blt_conf.h with your desired backdoor
|
||||
* open time in milliseconds.
|
||||
*/
|
||||
#define BOOT_BACKDOOR_ENTRY_TIMEOUT_MS (500)
|
||||
#define BOOT_BACKDOOR_ENTRY_TIMEOUT_MS (5000)
|
||||
#endif
|
||||
#endif /* BOOT_BACKDOOR_HOOKS_ENABLE == 0 */
|
||||
|
||||
@@ -168,6 +168,7 @@ void BackDoorCheck(void)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
} /*** end of BackDoorCheck ***/
|
||||
|
||||
|
||||
|
||||
@@ -171,6 +171,7 @@ void XcpInit(void)
|
||||
****************************************************************************************/
|
||||
blt_bool XcpIsConnected(void)
|
||||
{
|
||||
|
||||
if (xcpInfo.connected == 0)
|
||||
{
|
||||
return BLT_FALSE;
|
||||
|
||||
Reference in New Issue
Block a user