116 lines
4.7 KiB
C
116 lines
4.7 KiB
C
/*
|
|
* @Author: DaMing zxm5337@163.com
|
|
* @Date: 2024-03-29 17:02:47
|
|
* @LastEditors: DaMing zxm5337@163.com
|
|
* @LastEditTime: 2024-04-07 14:25:41
|
|
* @FilePath: \Proxi_CheckBoard\User\App\TMC2240_EVAL.h
|
|
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
*/
|
|
#ifndef TMC2240_EVAL_H_
|
|
#define TMC2240_EVAL_H_
|
|
|
|
//#include "Kernel.h"
|
|
|
|
#ifdef TMC2240_EVAL_GLOBALS
|
|
#define TMC2240_EVAL_EXT
|
|
#else
|
|
#define TMC2240_EVAL_EXT extern
|
|
#endif
|
|
|
|
|
|
//#ifdef TMC2240_EVAL_EN
|
|
// ===== TMC2240 register set =====
|
|
|
|
/*
|
|
0x00 = 0x00002108 ;; writing GCONF @ address 0=0x00 with 0x00002108=8456=0.0
|
|
0x03 = 0x00000000 ;; writing SLAVECONF @ address 1=0x03 with 0x00000000=0=0.0
|
|
0x04 = 0x4001682C ;; writing IOIN @ address 2=0x04 with 0x4001682C=1073834028=0.0
|
|
0x0A = 0x00000021 ;; writing DRV_CONF @ address 3=0x0A with 0x00000021=33=0.0
|
|
0x0B = 0x00000000 ;; writing GLOBAL_SCALER @ address 4=0x0B with 0x00000000=0=0.0
|
|
0x10 = 0x00001208 ;; writing IHOLD_IRUN @ address 5=0x10 with 0x00001208=4616=0.0
|
|
0x11 = 0x00000000 ;; writing TPOWERDOWN @ address 6=0x11 with 0x00000000=0=0.0
|
|
0x13 = 0x00000000 ;; writing TPWMTHRS @ address 7=0x13 with 0x00000000=0=0.0
|
|
0x14 = 0x000003BE ;; writing TCOOLTHRS @ address 8=0x14 with 0x000003BE=958=0.0
|
|
0x15 = 0x00000000 ;; writing THIGH @ address 9=0x15 with 0x00000000=0=0.0
|
|
0x2D = 0x00000000 ;; writing DIRECT_MODE @ address 10=0x2D with 0x00000000=0=0.0
|
|
0x38 = 0x00000000 ;; writing ENCMODE @ address 11=0x38 with 0x00000000=0=0.0
|
|
0x39 = 0x00000000 ;; writing X_ENC @ address 12=0x39 with 0x00000000=0=0.0
|
|
0x3A = 0x00010000 ;; writing ENC_CONST @ address 13=0x3A with 0x00010000=65536=0.0
|
|
0x52 = 0x0B920F25 ;; writing OTW_OV_VTH @ address 14=0x52 with 0x0B920F25=194121509=0.0
|
|
0x60 = 0xAAAAB554 ;; writing MSLUT[0] @ address 15=0x60 with 0xAAAAB554=0=0.0
|
|
0x61 = 0x4A9554AA ;; writing MSLUT[1] @ address 16=0x61 with 0x4A9554AA=1251300522=0.0
|
|
0x62 = 0x24492929 ;; writing MSLUT[2] @ address 17=0x62 with 0x24492929=608774441=0.0
|
|
0x63 = 0x10104222 ;; writing MSLUT[3] @ address 18=0x63 with 0x10104222=269500962=0.0
|
|
0x64 = 0xFBFFFFFF ;; writing MSLUT[4] @ address 19=0x64 with 0xFBFFFFFF=0=0.0
|
|
0x65 = 0xB5BB777D ;; writing MSLUT[5] @ address 20=0x65 with 0xB5BB777D=0=0.0
|
|
0x66 = 0x49295556 ;; writing MSLUT[6] @ address 21=0x66 with 0x49295556=1227445590=0.0
|
|
0x67 = 0x00404222 ;; writing MSLUT[7] @ address 22=0x67 with 0x00404222=4211234=0.0
|
|
0x68 = 0xFFFF8056 ;; writing MSLUTSEL @ address 23=0x68 with 0xFFFF8056=0=0.0
|
|
0x69 = 0x00F70000 ;; writing MSLUTSTART @ address 24=0x69 with 0x00F70000=16187392=0.0
|
|
0x6C = 0x00410153 ;; writing CHOPCONF @ address 25=0x6C with 0x00410153=4260179=0.0
|
|
0x6D = 0x00040000 ;; writing COOLCONF @ address 26=0x6D with 0x00040000=262144=0.0
|
|
0x70 = 0xC44C001E ;; writing PWMCONF @ address 27=0x70 with 0xC44C001E=0=0.0
|
|
0x74 = 0x00000000 ;; writing SG4_THRS @ address 28=0x74 with 0x00000000=0=0.0
|
|
*/
|
|
|
|
#define TMC2240_GCONF 0x00
|
|
#define TMC2240_GSTAT 0x01
|
|
#define TMC2240_IFCNT 0x02
|
|
#define TMC2240_SLAVECONF 0x03
|
|
#define TMC2240_IOIN 0x04
|
|
#define TMC2240_DRV_CONF 0x0A
|
|
#define TMC2240_GLOBAL_SCALER 0x0B
|
|
|
|
#define TMC2240_IHOLD_IRUN 0x10
|
|
#define TMC2240_TPOWERDOWN 0x11
|
|
#define TMC2240_TSTEP 0x12
|
|
#define TMC2240_TPWMTHRS 0x13
|
|
#define TMC2240_TCOOLTHRS 0x14
|
|
#define TMC2240_THIGH 0x15
|
|
|
|
#define TMC2240_DIRECT_MODE 0x2D
|
|
|
|
#define TMC2240_ENCMODE 0x38
|
|
#define TMC2240_XENC 0x39
|
|
#define TMC2240_ENC_CONST 0x3A
|
|
#define TMC2240_ENC_STATUS 0x3B
|
|
#define TMC2240_ENC_LATCH 0x3C
|
|
|
|
#define TMC2240_ADC_VSUPPLY_AIN 0x50
|
|
#define TMC2240_ADC_TEMP 0x51
|
|
#define TMC2240_OTW_OV_VTH 0x52
|
|
|
|
#define TMC2240_MSLUT0 0x60
|
|
#define TMC2240_MSLUT1 0x61
|
|
#define TMC2240_MSLUT2 0x62
|
|
#define TMC2240_MSLUT3 0x63
|
|
#define TMC2240_MSLUT4 0x64
|
|
#define TMC2240_MSLUT5 0x65
|
|
#define TMC2240_MSLUT6 0x66
|
|
#define TMC2240_MSLUT7 0x67
|
|
#define TMC2240_MSLUTSEL 0x68
|
|
#define TMC2240_MSLUTSTART 0x69
|
|
#define TMC2240_MSCNT 0x6A
|
|
#define TMC2240_MSCURACT 0x6B
|
|
#define TMC2240_CHOPCONF 0x6C
|
|
#define TMC2240_COOLCONF 0x6D
|
|
#define TMC2240_DCCTRL 0x6E
|
|
#define TMC2240_DRVSTATUS 0x6F
|
|
|
|
#define TMC2240_PWMCONF 0x70
|
|
#define TMC2240_PWMSCALE 0x71
|
|
#define TMC2240_PWM_AUTO 0x72
|
|
#define TMC2240_SG4_THRS 0x74
|
|
#define TMC2240_SG4_RESULT 0x75
|
|
#define TMC2240_SG4_IND 0x76
|
|
|
|
|
|
//void TMC2240_init(u8 motor);
|
|
|
|
//void TIM4_PWM_Init(u16 arr,u16 psc);
|
|
//void TMC_StepFreq(u16 speed);
|
|
|
|
// void TMC_Init(void);
|
|
//#endif
|
|
#endif
|