发现初始化时在图形界面设置输出为置位(就是高电平),不能成功,必须在后面重新置位才行,使用时需要当心。 详细看下文0 Z C% ]8 n/ v4 d$ t static void MX_GPIO_Init(void)$ G2 E% ^* X1 R6 x {- q% \% q7 Y2 \7 J5 H4 }9 z D. o LL_GPIO_InitTypeDef GPIO_InitStruct = {0}; /* GPIO Ports Clock Enable */ LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOC); 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' e. H; U- |5 y8 D5 n 1 s/ D$ u( ?& A& K( ]3 A /**/ LL_GPIO_SetOutputPin(Pow_Con_GPIO_Port, Pow_Con_Pin);3 O7 l, ^6 @% k* U G V /**/ LL_GPIO_SetOutputPin(SPI2_NSS_GPIO_Port, SPI2_NSS_Pin); /**/# F0 x8 w8 _; Z$ ?- ^3 F LL_GPIO_ResetOutputPin(GPIOB, Dis_Led0_Pin|Dis_Led1_Pin|Dis_Led2_Pin|Dis_Led3_Pin); /**/1 N/ _; b- e! n4 P' }+ B LL_GPIO_ResetOutputPin(GPIOA, Dis_Led5_Pin|Dis_Led6_Pin|Dis_Led7_Pin); 6 _9 b6 [" @6 Q O /**/* A2 {' Z3 U. G- Y& i. ? GPIO_InitStruct.Pin = Pow_Con_Pin; GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;+ O# X; Q: B. S# Q; ~5 | GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;/ S4 n+ x# p/ F. Q3 W5 I GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; LL_GPIO_Init(Pow_Con_GPIO_Port, &GPIO_InitStruct);$ W5 z$ i. u( d! D /**/- m. Q- a3 \9 Z1 E/ P. h GPIO_InitStruct.Pin = LL_GPIO_PIN_14|LL_GPIO_PIN_15;7 z/ R. \) O# D9 @2 X: Z GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG; LL_GPIO_Init(GPIOC, &GPIO_InitStruct); /**/ GPIO_InitStruct.Pin = Dis_Led0_Pin|Dis_Led1_Pin|Dis_Led2_Pin|Dis_Led3_Pin; o! r; E: S7 `# N+ M& y GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;4 [* l8 K! L4 x0 ]8 ~& w5 d- G GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_MEDIUM;' w4 K8 d7 [6 \+ n$ t& W+ U5 y GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_OPENDRAIN; LL_GPIO_Init(GPIOB, &GPIO_InitStruct);9 l* _5 ?# ^) J/ n& P /**/ GPIO_InitStruct.Pin = SPI2_NSS_Pin;4 r( M! \* \+ P: V6 [6 R0 @ GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;% V1 k0 t2 S4 w2 h1 b5 t GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH; GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; LL_GPIO_Init(SPI2_NSS_GPIO_Port, &GPIO_InitStruct);8 M% v0 q& |! z( M, H( p7 [ /**/" a8 V& Q3 z6 p9 w, u, Q GPIO_InitStruct.Pin = Dis_Led5_Pin|Dis_Led6_Pin|Dis_Led7_Pin;6 T( I0 d% A0 B8 G# _4 T% J GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;- ]" L" Q' k( ^0 } a. f GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_MEDIUM;) L& h1 Q( s! |; W* b |# l0 K% J GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_OPENDRAIN;! B- R; i' e9 l8 m! L8 K4 O4 p& u LL_GPIO_Init(GPIOA, &GPIO_InitStruct);$ k4 Q" d# l8 y$ N/ T! y. ^ /**/+ E% j9 m( w- z7 a GPIO_InitStruct.Pin = LL_GPIO_PIN_15; GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG; LL_GPIO_Init(GPIOA, &GPIO_InitStruct);1 M5 T. M7 Q! A5 _* c _ ; ], c; `* {6 B5 u" h% `. x' E3 a /**/' r0 s9 `0 q- t/ k6 p; g GPIO_InitStruct.Pin = LL_GPIO_PIN_3|LL_GPIO_PIN_4|LL_GPIO_PIN_5|LL_GPIO_PIN_6 3 M9 f8 H# J# d0 [9 }. | |LL_GPIO_PIN_7|LL_GPIO_PIN_8;( [: t; ~. x% ~7 ], k4 o+ h GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG; LL_GPIO_Init(GPIOB, &GPIO_InitStruct);$ q1 c6 @, H5 N /**// A5 l) _9 B3 l9 V5 ~# j2 @& A GPIO_InitStruct.Pin = Pow_Key_Pin; GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;1 b; G5 S, \! a$ Z GPIO_InitStruct.Pull = LL_GPIO_PULL_UP; LL_GPIO_Init(Pow_Key_GPIO_Port, &GPIO_InitStruct);( F3 u) @% z4 y# }: z % e6 R* Z0 Q3 `7 \ //必须添加下列代码,否则口初始化默认置位不成功8 Q: b3 V9 t2 d4 _/ o /**/ LL_GPIO_SetOutputPin(Pow_Con_GPIO_Port, Pow_Con_Pin); /**/ LL_GPIO_SetOutputPin(SPI2_NSS_GPIO_Port, SPI2_NSS_Pin);; l6 U E) q3 d }( b. i+ c" i2 e( a/ N' R( v `3 w ; L5 _3 i& n3 t d |
不知道HAL库有没有这个问题。 |
意法半导体最具性价比、速度最快的单核MPU STM32MP13现已支持运行RTOS
【NUCLEO-U083RC评测】移植TouchGFX并实现无接触翻页
[NUCLEO-C031C6评测] 驱动LCD 第三步 显示颜色块
[NUCLEO-C031C6评测] 驱动LCD 第二步 初始化屏幕
[NUCLEO-C031C6评测] 驱动LCD第一步
【STM32MP135-DK】裸机开发
STM32MP135F-DK 开箱&开发环境搭建&硬件设计分析
【STM32U599】4.引入RTC与MVP开发
基于STM32CUBEMX驱动TMOS模块STHS34PF80之获取状态数据(5)
基于STM32CUBEMX驱动TMOS模块STHS34PF80之中断获取信号(4)