|
发现初始化时在图形界面设置输出为置位(就是高电平),不能成功,必须在后面重新置位才行,使用时需要当心。 详细看下文 static void MX_GPIO_Init(void) { LL_GPIO_InitTypeDef GPIO_InitStruct = {0};# I; p% ? @! e8 `7 {* {5 D. S 2 _ Q O' Q1 h: c# E: S t3 b /* GPIO Ports Clock Enable */ LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOC);; q, K) \2 [$ {% h LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOD); LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOA); LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOB);" o. ?) q0 Q- @- Z: f7 _2 D & t* p# r& t/ w8 @& y: S N0 @2 T /**/, D$ @; L- |3 F5 `4 T% j7 W# [ LL_GPIO_SetOutputPin(Pow_Con_GPIO_Port, Pow_Con_Pin);6 S% F+ p& h& b# F& N. ?, P3 M6 z+ V /**/( N3 O7 \2 p0 W4 C& D2 S1 `# w8 | LL_GPIO_SetOutputPin(SPI2_NSS_GPIO_Port, SPI2_NSS_Pin);/ D; ` l# a/ W) t! p$ e7 [! Y " f {. }7 [2 d, Y% B1 H1 N /**/9 p; l' \$ g$ W0 R- y( L LL_GPIO_ResetOutputPin(GPIOB, Dis_Led0_Pin|Dis_Led1_Pin|Dis_Led2_Pin|Dis_Led3_Pin); 1 a) E$ U, N7 ?$ A4 k- G! a! M /**/ LL_GPIO_ResetOutputPin(GPIOA, Dis_Led5_Pin|Dis_Led6_Pin|Dis_Led7_Pin); /**/ GPIO_InitStruct.Pin = Pow_Con_Pin; GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;: m3 P& @9 y3 _+ x6 S- W1 \% q4 f GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;! u L9 i/ V. C. L! z LL_GPIO_Init(Pow_Con_GPIO_Port, &GPIO_InitStruct);& h+ P0 o' N0 J# {1 C2 u2 W2 {, { 4 } |0 A( B! j, u3 L/ p$ M9 B3 r /**// H0 t5 }% v# R: q# d GPIO_InitStruct.Pin = LL_GPIO_PIN_14|LL_GPIO_PIN_15; GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG; LL_GPIO_Init(GPIOC, &GPIO_InitStruct); 8 G7 ^# w( R1 l u2 | /**/& F8 l8 L. l9 X8 o+ P3 j% X) T+ @ GPIO_InitStruct.Pin = Dis_Led0_Pin|Dis_Led1_Pin|Dis_Led2_Pin|Dis_Led3_Pin;1 o" h6 P) @$ }# t GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_MEDIUM;/ \4 _1 Q" N. h1 g GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_OPENDRAIN;/ O' v, M, W# c LL_GPIO_Init(GPIOB, &GPIO_InitStruct);# r( K h v G) p0 A6 H 0 `: u4 f7 z4 y4 L4 f7 k /**/$ L' i. u( L, G1 a GPIO_InitStruct.Pin = SPI2_NSS_Pin;8 d& l3 ^( r( m. L GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; LL_GPIO_Init(SPI2_NSS_GPIO_Port, &GPIO_InitStruct);0 a+ i$ g+ u7 s2 S2 h /**/8 U3 p- K3 d$ D GPIO_InitStruct.Pin = Dis_Led5_Pin|Dis_Led6_Pin|Dis_Led7_Pin; GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;8 Q& `$ t: ]9 h GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_MEDIUM;( }0 K- x" h; F+ X2 l9 k GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_OPENDRAIN; LL_GPIO_Init(GPIOA, &GPIO_InitStruct);. w: W, L* k. Y5 @/ ~" W+ t- k /**/ GPIO_InitStruct.Pin = LL_GPIO_PIN_15; GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG; LL_GPIO_Init(GPIOA, &GPIO_InitStruct); + q J$ G8 }! S* m, H- z' P /**/+ m3 _7 k" Z, F GPIO_InitStruct.Pin = LL_GPIO_PIN_3|LL_GPIO_PIN_4|LL_GPIO_PIN_5|LL_GPIO_PIN_6 5 c# O4 \8 U. b) |' C |LL_GPIO_PIN_7|LL_GPIO_PIN_8; GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG; LL_GPIO_Init(GPIOB, &GPIO_InitStruct); /**/ GPIO_InitStruct.Pin = Pow_Key_Pin; GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT; GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; LL_GPIO_Init(Pow_Key_GPIO_Port, &GPIO_InitStruct); : ]1 p) n) j$ w, P //必须添加下列代码,否则口初始化默认置位不成功 /**/( Y" k ~; u7 ~. N, }, [4 i C. l LL_GPIO_SetOutputPin(Pow_Con_GPIO_Port, Pow_Con_Pin); /**/, Q# J5 E( L- I1 K {+ j LL_GPIO_SetOutputPin(SPI2_NSS_GPIO_Port, SPI2_NSS_Pin);8 i; w4 m0 w2 V/ V' ?- D } 0 t3 v+ F$ O D( U4 e$ `/ ?; G& I2 Y+ s |
![]() ![]() ![]() ![]() |
| 不知道HAL库有没有这个问题。 |
【STM32H5 评测】7、运行FreeRTOS+TrustZone工程
【STM32H5 评测】NUCLEO-H5E5ZJ 安全启动与安全固件更新性能测试
从 CubeMX 到 MX2:这些关键变化必须知道
【STM32H5 评测】ADC 电压表
STM32Cube嵌入式软件更新(2026年8月)
【STM32H5 评测】基础硬件加密与随机数性能 - STM32H5E5实测硬件AES加解密、HASH运算、TRNG真随机数输出速率与稳定性
【STM32H5 评测】NUCLEO-H5E5ZJ 使用 TrustZone 安全分区系统实践测试
【STM32H5 评测】CPU核心性能 - STM32H5E5跑 RTOS,观察任务切换速度、中断响应快慢
【STM32H5 评测】介绍、环境搭建、工程测试
#双节活动 1.在CubeMX中引用touchGFX出现的问题与解决
微信公众号
手机版