diff --git a/app/Core/Src/spi.c b/app/Core/Src/spi.c index 74d69c4..9f9c242 100644 --- a/app/Core/Src/spi.c +++ b/app/Core/Src/spi.c @@ -79,13 +79,20 @@ void HAL_SPI_MspInit(SPI_HandleTypeDef* spiHandle) PA6 ------> SPI1_MISO PA7 ------> SPI1_MOSI */ - GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_6|GPIO_PIN_7; + GPIO_InitStruct.Pin = GPIO_PIN_1|GPIO_PIN_6; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = GPIO_AF5_SPI1; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + GPIO_InitStruct.Pin = GPIO_PIN_7; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Pull = GPIO_PULLUP; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.Alternate = GPIO_AF5_SPI1; + HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); + /* USER CODE BEGIN SPI1_MspInit 1 */ /* USER CODE END SPI1_MspInit 1 */ diff --git a/app/MDK-ARM/app.uvoptx b/app/MDK-ARM/app.uvoptx index 56bc6a9..776c4cc 100644 --- a/app/MDK-ARM/app.uvoptx +++ b/app/MDK-ARM/app.uvoptx @@ -1,4 +1,4 @@ - + 1.0 @@ -45,7 +45,7 @@ 79 66 8 - + 1 @@ -104,16 +104,16 @@ 0 0 3 - - - - - - - - - - + + + + + + + + + + BIN\CMSIS_AGDI.dll @@ -147,8 +147,8 @@ 0 0 ../Core/Src/main.c - - + + 1 @@ -163,8 +163,8 @@ 0 0 ../Core/Src/main.c - - + + 2 @@ -179,8 +179,8 @@ 0 0 ../Core/Src/main.c - - + + @@ -212,19 +212,19 @@ 0 0 - - + + 0 0 0 - - - - - - - - + + + + + + + + 1 0 diff --git a/app/MDK-ARM/app.uvprojx b/app/MDK-ARM/app.uvprojx index 90ad399..f945685 100644 --- a/app/MDK-ARM/app.uvprojx +++ b/app/MDK-ARM/app.uvprojx @@ -1,7 +1,10 @@ - - + + + 2.1 +
### uVision Project, (C) Keil Software
+ app @@ -16,28 +19,28 @@ Keil.STM32L4xx_DFP.2.6.1 http://www.keil.com/pack/ IRAM(0x20000000-0x2000BFFF) IRAM2(0x10000000-0x10003FFF) IROM(0x8000000-0x801FFFF) CLOCK(8000000) FPU2 CPUTYPE("Cortex-M4") TZ - - - + + + 0 - - - - - - - - - - + + + + + + + + + + $$Device:STM32L432KBUx$CMSIS\SVD\STM32L4x2.svd 0 0 - - - - - + + + + + 0 0 @@ -52,15 +55,15 @@ 1 1 1 - + 1 0 0 0 0 - - + + 0 0 0 @@ -69,8 +72,8 @@ 0 0 - - + + 0 0 0 @@ -79,15 +82,15 @@ 0 0 - - + + 0 0 0 0 1 - + 0 @@ -101,8 +104,8 @@ 0 0 3 - - + + 0 @@ -135,11 +138,11 @@ 1 BIN\UL2V8M.DLL - - - - - + + + + + 0 @@ -172,7 +175,7 @@ 0 0 "Cortex-M4" - + 0 0 0 @@ -306,7 +309,7 @@ 0x4000 - + 1 @@ -333,9 +336,9 @@ 0 0 - + USE_HAL_DRIVER,STM32L432xx - + ../Core/Inc;../Drivers/STM32L4xx_HAL_Driver/Inc;../Drivers/STM32L4xx_HAL_Driver/Inc/Legacy;../Drivers/CMSIS/Device/ST/STM32L4xx/Include;../Drivers/CMSIS/Include @@ -351,10 +354,10 @@ 0 1 - - - - + + + + @@ -364,15 +367,15 @@ 0 1 0 - - - - - - - - - + + + + + + + + + @@ -558,17 +561,18 @@ + - + - + - + - + -
+
diff --git a/app/app.ioc b/app/app.ioc index b63f9ee..64ec943 100644 --- a/app/app.ioc +++ b/app/app.ioc @@ -62,6 +62,8 @@ PA3.Mode=Asynchronous PA3.Signal=USART2_RX PA6.Mode=Full_Duplex_Master PA6.Signal=SPI1_MISO +PA7.GPIOParameters=GPIO_PuPd +PA7.GPIO_PuPd=GPIO_PULLUP PA7.Mode=Full_Duplex_Master PA7.Signal=SPI1_MOSI PA9.Mode=Asynchronous diff --git a/usersrc/usermain.c b/usersrc/usermain.c index 2249b62..2bc1ee4 100644 --- a/usersrc/usermain.c +++ b/usersrc/usermain.c @@ -19,7 +19,7 @@ bool BSP_Read(uint8_t *pData, uint8_t register_address, uint32_t Size) { cmd += register_address; } - + HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, GPIO_PIN_SET); SPI_CS_Enable(); HAL_SPI_Transmit(&hspi1, &cmd, 1, SPI_TIMEOUT_VALUE); // if (HAL_SPI_Receive(&hspi1, pData, Size, SPI_TIMEOUT_VALUE) != HAL_OK) @@ -27,6 +27,7 @@ bool BSP_Read(uint8_t *pData, uint8_t register_address, uint32_t Size) // return false; // } SPI_CS_Disable(); + HAL_GPIO_WritePin(GPIOB, GPIO_PIN_7, GPIO_PIN_SET); return true; }