smallembedded

Integrated board

 
Overview
Graduation ProjectVision_Stand
page editingAPP
interface
settingspageControl
picture displays the current camera positionpageRememberEx

different
object position

memorypageRollEx
bottom turntable rotation
can set speedpageOtherbrightness

settingsomething
I
wanna to say to this universityAbout

saving settingsOriginally planned to use keyboard components, but the control area is too small to be applicable, so use BTN button to save directlySITE1~4
stepper motor controlPA11
(zStep)_PA12(zDir)
PA8(xStep)_PB15(xDdir)
==The joystick control is controlled according to the size of the screen==
Stepper motor menu page settingsCAL
: Encoder calibrationClosed-
loop calibration for the first timeMotType

: Motor type selection
0.9/1.8

Mode: Control mode selectionCR_OPEN
: Open-loop control mode, no encoder is required to run.CR_LOOP
: Vector closed-loop control mode, with encoder feedback to prevent lost steps;
CR_UART: Serial port direct control mode, TTL serial port sends commands to control position/forward and reverse rotation.

Ma: Set current range
Open-loop mode Set current limit / Closed-loop mode Automatically set

MStep: Set subdivision steps (default 16 subdivisions)
Supports 1 to 256 arbitrary subdivisions, among which the conventional subdivisions 1, 2, 4, 8, 16, 32, 64, 128,
256 can be set on the screen. Other subdivisions such as 67 subdivisions need to be
set . Please refer to the "Serial Port Communication" section for operation.
256 (check)

En: Set the effective level of the En pin
H: High level is effective, and an external high level input (above 3.3V) can enable the closed-loop driver board. (check)
L: Low level is effective, and an external low level input (0V) can enable the closed-loop driver board.
Hold: Always remain effective, and the En pin is not controlled externally.
Note: If the driver board is not enabled, the motor will be like no power is connected. You can
turn the motor shaft lightly with your hand, but it will not rotate even if you send pulses.

Dir: Set the positive direction of the motor rotation
CW: Clockwise rotation is the positive direction
CCW: Counterclockwise rotation is the positive direction

AutoSDD: Set the automatic screen off function
Disable: Disable
Enable: Enable (check)
Note: After enabling this option, the OLED
display key to relight the screen.

Protect: Set the stall protection function
Disable: Disable
Enable: Enable (check)
Note: After enabling this option, if the driver board detects that the motor is stalled, it will trigger the stall
protection, automatically shut down the driver, and display "Wrong Protect Enter.." on the screen.

MPlyer: Set the internal 256 subdivision interpolation function
Disable: Disable
Enable: Enable (check)
Note: After enabling this option, it can effectively reduce the vibration and noise of the motor when it moves at low speed,
which is equivalent to running your current subdivision internal interpolation to the maximum 256 subdivisions.

UartBaud: Set the baud rate of serial port
communicationUartAddr: Set the serial port communication addressO_Mode
: Set the single-turn power-on automatic return to zero
modeDisable: Turn off the single-turn power-on automatic return to zero
functionDirMode: Direction mode (the return to zero direction is set on the O_Dir menu)
NearMode: Nearby mode (return to zero in the direction closest to the zero point)

Set O: Set the origin of the single-turn power-on automatic return to zero (the O_Mode mode needs to be set first).
Place it at the point and press

itO_Speed: Set the single-turn power-on automatic return to zero speed gear 0
~4 from fast to slow
0 (check) O_Dir: Set the return to zero direction CW CCW

for single-turn power-on automatic return to zero ACC: Set the acceleration value inside the closed-loop driver boardDisable 286 412 538 (check) 664 790 916 1042Note : This option is reserved and expanded, keep the default value 'Disable'. Exit: Exit parameter setting menu. Stepper motor pulse counting method. For each pulse sent, an interrupt count is performed. It is better for low-rate pulses. It can be said that it is the first choice for low-speed pulse sending, such as below 10Khz. Otherwise, the interrupt will occupy too much CPU. This method should pay attention to improving the interrupt priority, otherwise the count will be lost. According to the sending frequency × the sending time, the number of pulses is obtained. For variable-speed pulses, the total pulse can be obtained by the cumulative integral method. The timing used for timing is highly accurate and pulse count loss can be allowed. One timer is used as the master to send pulses, and the other timer is used as the slave. For the master-slave method of counting the sent pulses , an additional timer is required to count. For example, tim1 sends pulses and tim2 counts. It is the most convenient way, regardless of high speed or low speed, and occupies the lowest CPU, but it takes up one more timer.

























Use DMA mode, for example, send 1000 pulses in total, then define u16 per [1001], each time a pulse is sent, DMA will update the next duty cycle word from the array, the last word of the array is 0, indicating that the pulse is stopped.
DMA mode is also a very certain method, and pulses will not be lost. However, at high speeds, it will occupy more internal buses and use a redundant DMA controller. It also has a disadvantage that it is more complicated to use and does not meet the KISS principle.

Finally, PWM + DMA is used to control the pulses of the stepper motor.
The 32HAL library has a bug in the code here.
The input capture method is used
to control the diagonal direction of the joystick
to cancel a 32. It is impossible to track the 2-way PWM. The frequency is too close to the interrupt function.
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-05-12 09:12:41

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号