STM32 configuration on several input modes and external interrupts

  Requirements: Connect button IO port configured as a pull-input, a termination key IO port, one end grounded, i.e., when the button is pressed, the IO port generates a falling edge, falling edge triggered interrupt.

  Question: After the corresponding IO port configured, the measured voltage pin, not about 3.3V, but about 0.1V. So I guess:

  1. The peripheral circuit of the IO port impact.

  2. STM32 internal pull weak, can only pull on a IO port.

  From these two ideas began to tackle. First First, it is easy to exclude. The peripheral circuit removed, I use Dupont line, just pull the voltage on the measuring pin is still about 0.1V, then a first guess negative.

  Second, the reference manual universal view, each of the IO port is found to have a separate driving circuit, so that the first two are also excluded.

  Finally, a variety of tangled, then found: when the beginning of the main function of the initialization, I put that function to initialize commented out. Stupid mistake, she laughed.

  To summarize:

  STM32 input 4 input modes:

  Analog input GPIO_AIN

  For AD conversion

  Floating input GPIO_IN_FLOAtiNG

  The pin is in floating mode, level status is uncertain. What external signal input, IO mouth is what state.

  Pull-input GPIO_IPU

  IO port to prevent occurrence of the undefined states, for example, when the IO port vacant, will pass on the inside of the pull-up resistors point clamped at the high level.

  Pull-down input GPIO_IPD

  Pull-up resistor similar functions to prevent an indefinite state of the IO port, for example, when the IO port vacant, will be clamped at the low point of the interior of the pull-down resistor.

  STM32 hollow I / O pin is high or low depending on the situation.

  1, the IO port reset in a floating state, i.e. its state is determined by the level of the peripheral circuit.

  2, the reset moment STM32 I / O port level state is the default floating input, therefore high impedance. Achieve low power consumption.

  3, STM32 IO pin configuration of floating input port by default, the option left to the user, which is a great advantage: on the one hand floating input will not ensure that the default level users do not want (in this case electricity a peripheral circuit depending on the user level); on the other hand reduces power consumption, because either a pullup or pulldown current will be consumed. From another point of view, regardless of the default I / O pins to configure how, still need to pull down or pull-out of the output pin, this pin is to ensure that when the output power during a chip reset and is always known Level.

  4, without any operation, the push-pull output pin universal default mode STM32 low, there is a state of electricity. So often first pulled the pin level is set at configuration time, so that the circuit does not produce current. There is no electricity to power the process that is pin level from low to high in the process.

  5, STM32 of I / O pins, there are two: TTL and CMOS, all pins are compatible with TTL and CMOS levels. That point of view from an input voltage identification, all pins either TTL or CMOS pin pin can be identified by TTL or CMOS level.

 

The last hope to share with you some information to help you be more

(STM32 interrupt system)
http://www.makeru.com.cn/live/1392_1124.html?s=45051

(Stm32 serial application)
http://www.makeru.com.cn/live/1392_1164.html?s=45051

(STM32 DC motor with speed)
http://www.makeru.com.cn/live/1392_1218.html?s=45051

Guess you like

Origin www.cnblogs.com/QianD/p/11302923.html