
发现初始化时在图形界面设置输出为置位(就是高电平),不能成功,必须在后面重新置位才行,使用时需要当心。; V: Z8 r" Z) J( [1 c8 a 详细看下文2 B! Y* h- g/ J9 h. b static void MX_GPIO_Init(void) { Z1 P% g+ C0 \) E; x& ^4 m LL_GPIO_InitTypeDef GPIO_InitStruct = {0};% C& B; ]- k" E) B4 ?. f D ; w* ]9 ~6 j7 X. Q& Y+ O% B /* GPIO Ports Clock Enable */ LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOC);& o2 Y) J4 X7 ^- a LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOD);# F8 q. w7 ?; Q5 l/ Q! t9 ^, `. A LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOA); LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOB);8 g% g9 i: ~% f, S7 ?% ]2 ^ /**/2 e: ~( {; { Y# q2 c LL_GPIO_SetOutputPin(Pow_Con_GPIO_Port, Pow_Con_Pin);$ w8 \" T& J* e, }. Y2 F0 L. J6 s/ M /**/ LL_GPIO_SetOutputPin(SPI2_NSS_GPIO_Port, SPI2_NSS_Pin);4 n# B- @" s6 l# B6 e$ R /**/8 Z! e7 w- L! x. [ LL_GPIO_ResetOutputPin(GPIOB, Dis_Led0_Pin|Dis_Led1_Pin|Dis_Led2_Pin|Dis_Led3_Pin);; i+ e' A& s* b+ Y' n5 X6 n1 _ " V* O* I( r5 v3 \ /**/ LL_GPIO_ResetOutputPin(GPIOA, Dis_Led5_Pin|Dis_Led6_Pin|Dis_Led7_Pin); : l. x! q* @$ [* A /**/8 q+ L3 G/ m, `" o1 T, W GPIO_InitStruct.Pin = Pow_Con_Pin;0 t8 S& y! _* I0 N! ?/ g( W GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;& F: q/ c; W$ {* j( ~5 w: F GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;2 o K7 } y& V4 ?* e GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; {/ i9 \; M2 C) d! T3 I& D LL_GPIO_Init(Pow_Con_GPIO_Port, &GPIO_InitStruct); 1 H) C2 d3 T" b* a /**/ GPIO_InitStruct.Pin = LL_GPIO_PIN_14|LL_GPIO_PIN_15;2 g) t$ p+ E: x% R8 o5 l' W GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG;, W4 f }) {% S LL_GPIO_Init(GPIOC, &GPIO_InitStruct);0 i0 b5 W4 I/ K2 o0 Z* P% g: k /**/ GPIO_InitStruct.Pin = Dis_Led0_Pin|Dis_Led1_Pin|Dis_Led2_Pin|Dis_Led3_Pin; GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_MEDIUM;8 s$ H9 q) g) y4 s" S s+ d! l GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_OPENDRAIN;' @ A! `5 l" t' n- X8 p LL_GPIO_Init(GPIOB, &GPIO_InitStruct); /**/' P" N! I/ k+ c) K" m- u6 t, M GPIO_InitStruct.Pin = SPI2_NSS_Pin; GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;( A/ y6 K1 p& N) m3 Q) z6 m0 O GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;8 s3 c+ |& U% I/ Q& g" \ GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL; LL_GPIO_Init(SPI2_NSS_GPIO_Port, &GPIO_InitStruct); 9 x4 f7 O: I. N /**/ GPIO_InitStruct.Pin = Dis_Led5_Pin|Dis_Led6_Pin|Dis_Led7_Pin;) g" m+ E* {0 c0 E0 e" X7 M5 B2 _ GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT; GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_MEDIUM; GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_OPENDRAIN; LL_GPIO_Init(GPIOA, &GPIO_InitStruct);; K/ |6 }8 `1 I" S: l( T g0 G* z4 _: C) V+ z /**/ GPIO_InitStruct.Pin = LL_GPIO_PIN_15;& M, [% T& ?( e* Z2 W8 ? GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG; LL_GPIO_Init(GPIOA, &GPIO_InitStruct); # |. q3 `, T/ f i7 n- e /**/ GPIO_InitStruct.Pin = LL_GPIO_PIN_3|LL_GPIO_PIN_4|LL_GPIO_PIN_5|LL_GPIO_PIN_6 |LL_GPIO_PIN_7|LL_GPIO_PIN_8;8 O& p; ~9 N t GPIO_InitStruct.Mode = LL_GPIO_MODE_ANALOG;* T+ L3 m% ~5 o1 Y4 l LL_GPIO_Init(GPIOB, &GPIO_InitStruct); $ R$ E- i) c$ f' y+ f3 H /**/ GPIO_InitStruct.Pin = Pow_Key_Pin; GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT; GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;$ f3 e& p! g: J* L! k+ | LL_GPIO_Init(Pow_Key_GPIO_Port, &GPIO_InitStruct);! H. n* r( J, N# ?1 z ) g7 u6 c7 a5 R p8 G, R$ Y9 v //必须添加下列代码,否则口初始化默认置位不成功' b' B$ X% E. A) u$ s' g /**/ LL_GPIO_SetOutputPin(Pow_Con_GPIO_Port, Pow_Con_Pin);/ ^' }2 S! L7 D/ U /**/% `0 h: X( H* {. f, u" x LL_GPIO_SetOutputPin(SPI2_NSS_GPIO_Port, SPI2_NSS_Pin); } % g- B# y# z5 | |
![]() ![]() ![]() ![]() ![]() |
不知道HAL库有没有这个问题。 |
经验分享常被误解的开、关总中断
【STM32C0测评】Nucleo-C092开发板功耗测试
【STM32C0测评】Nucleo-C092开发板IIC通信测试(硬件IIC)
【STM32C0测评】Nucleo-C092开发板IIC通信测试(软件IIC)
【STM32C0测评】Nucleo-C092开发板IIC通信测试(硬件软件IIC一网打尽)
【STM32N6570-DK评测】3.CubeMX关于DCMIPP和CSI的BUG整理及摄像头使用
【STM32C0测评】Nucleo-C092开发板USART串口测试
【STM32C0测评】Nucleo-C092开发板使用PWM控制板载LED呼吸灯
【STM32C0测评】Nucleo-C092板卡外部中断控制板载LED灯
拷打cubemx【002】——自定义还需基于芯片的工程