Analysis and Solutions of Common Working Abnormal Phenomenon of STM32 Single Chip Microcomputer

I posted two samples and burned the same firmware. One of the pieces works normally, but the other piece has a very strange phenomenon: online debugging is normal; it works normally after each programming; sometimes it works normally after power-on again, sometimes it works abnormally; when it works abnormally, press reset Press the key to return to normal.

Analysis and Solutions of Common Working Abnormal Phenomenon of STM32 Single Chip Microcomputer

Abnormal work phenomenon: The system running indicator in the main function does not flash, but a light on during the initialization process is on! It means that the program doesn't work after running for a period of time.

Due to the online debugging mode, the board works normally, and the abnormal state of the program operation cannot be judged by online debugging.

Analyze the possible reasons:

1. During the initialization process, the program falls into an endless loop. But in the process of program initialization, there is no code of while(1) infinite loop.

2. After the board is powered on, it is constantly reset, resulting in the inability to enter the while (1) loop in the main function.

Problem finding:

hardware:

1. Make sure that the BOOT0 pin is connected to a 10kΩ resistor and pulled down to the ground;

2. In the RC power-on delay reset circuit, R is 10kΩ, and C is changed from 0.1uF to 10uF, the phenomenon remains the same;

3. The MCU 3.3V power supply ripple is very small, eliminating power supply problems.

It seems that there is nothing wrong with the hardware. You can only start from the only light on the board.

software:

1. It seems to have nothing to do with hardware reset. In order to confirm whether the board is resetting continuously, a 100ms delay is added before the light that is on. If it is resetting, the light should keep flashing. But the light is still on, indicating that the program is running incorrectly and is not running.

2. Constantly modify the position of the led light in the initialization code, and finally locate the code that caused the operation error: configure a GPIO as an external interrupt, trigger on the transition edge, and pull up. Change the pull-up to NOPULL, everything works fine.

Problem location: The GPIO configured as an external interrupt is left floating. The model that worked normally before was always connected to the external module of that IO pin. The abnormal operation was not connected, resulting in an uncertain IO pin level. Due to the uncertainty of the level, there is a transition edge at the moment of initialization, which causes the program to enter the external interrupt service function. In the interrupt service function, it is necessary to read the value of a timer register, but the timer to be read may not be initialized yet, causing the reading to fail and the program to run abnormally.

Solution: 1. PULLRISING is changed to NOPULL in PULL mode;

2. The timer is initialized before this external interrupt.

Stator Interlocking

Progressive Punching is an efficient self-riveting process of fixed rotor, which can realize large-scale and precise riveting operation and is suitable for mass manufacturing production line. The following is the introduction of progressive rotor self-riveting process:
First, determine the type and specification of the stator and rotor required for riveting, and prepare the rivets and riveting machines required for riveting. Rivet size should match the hole size of stator and rotor to ensure tight fit and firmness.
According to the size and riveting requirements of stator and rotor, the rivet is machined into the corresponding length and shape. Progressive punch riveting machine also needs to adjust, set, calibrate the position of the riveting head, pressure, speed and other parameters.
Insert the rivet into the stator hole, and start the progressive punching riveting machine with electricity. The rivet will exert force on the rivet head according to the set parameters, and form a large number of threaded processes on the inner wall of the stator hole, so that the rivet deformation is firmly connected with the stator.
Wait for the rivet deformation, riveting process is complete. The remaining rivet tail should be cut off and inspected after riveting is completed to ensure that the riveting is firm and reliable and the transmission system runs smoothly.
In general, the process of progressive impact fixed rotor self-riveting can improve the production efficiency, but also ensure the precision and stability of riveting. However, riveting machine adjustment requires specialized skills, so an operator familiar with the riveting process is required.

Motor stator riveting, beraring stator riveting, generator stator riveting

Henan Yongrong Power Co., Ltd , https://www.hnyongrongglobal.com

Posted on