-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCpu1_Main.c
130 lines (120 loc) · 4.55 KB
/
Cpu1_Main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
【平 台】北京龙邱智能科技TC2/3xx核心板
【编 写】chiusir
【E-mail】[email protected]
【软件版本】V1.1 版权所有,单位使用请先联系授权
【最后更新】2021年1月18日
【相关信息参考下列地址】
【网 站】http://www.lqist.cn
【淘宝店铺】http://longqiu.taobao.com
------------------------------------------------
【dev.env.】AURIX Development Studio1.2.2及以上版本
【Target 】 TC2/3xx
【Crystal】 20.000Mhz
【SYS PLL】 200/300MHz
________________________________________________________________
基于iLLD_1_0_1_11_0底层程序,
使用例程的时候,建议采用没有空格的英文路径,
=================================================================
程序配套视频地址:https://space.bilibili.com/95313236
=================================================================
摄像头接口 龙邱神眼或者OV7725模块
● 数据端口:P02.0-P02.7口,共8位,接摄像头的数据端口;
● 时钟像素:外部中断第0组:P00_4;
● 场信号: 外部中断第3组:P15_1;
-----------------------------------------------------------------
推荐GPT12模块,共可以实现5路正交解码增量编码器(兼容带方向编码器)信号采集,任意选择四路即可;
P33_7, P33_6 龙邱TC母板编码器1
P02_8, P33_5 龙邱TC母板编码器2
P10_3, P10_1 龙邱TC母板编码器3
P20_3, P20_0 龙邱TC母板编码器4
-----------------------------------------------------------------
电感电压采集模块或者麦克风模块
推荐使用AN0-7,共八路ADC,可以满足chirp声音信号及电磁车电感电压采集;
AN0-3 龙邱TC接四个麦克风模块或者电感
-----------------------------------------------------------------
默认电机接口
使用GTM模块,ATOM四个通道可产生4*8共32路PWM,而且各自频率和占空比可调,推荐使用ATOM0的0-7通道;
第一组双路全桥驱动
P23_1 龙邱TC母板MOTOR1_P
P32_4 龙邱TC母板MOTOR1_N
P21_2 龙邱TC母板MOTOR2_P
P22_3 龙邱TC母板MOTOR2_N
第二组双路全桥驱动
P21_4 龙邱TC母板MOTOR3_P
P21_3 龙邱TC母板MOTOR3_N
P20_8 龙邱TC母板MOTOR4_P
P21_5 龙邱TC母板MOTOR4_N
-----------------------------------------------------------------
默认舵机接口
使用GTM模块,ATOM四个通道可产生4*8共32路PWM,而且各自频率和占空比可调,推荐使用ATOM2;
P33_10 龙邱TC母板舵机1
P33_13 龙邱TC母板舵机2
-----------------------------------------------------------------
默认屏幕显示接口,用户可以使用TFT或者OLED模块
TFTSPI_CS P20_14 龙邱TC母板 CS管脚 默认拉低,可以不用
TFTSPI_SCK P20_11 龙邱TC母板 SPI SCK管脚
TFTSPI_SDI P20_10 龙邱TC母板 SPI MOSI管脚
TFTSPI_DC P20_12 龙邱TC母板 D/C管脚
TFTSPI_RST P20_13 龙邱TC母板 RESET管脚
-----------------------------------------------------------------
OLED_CK P20_14 龙邱TC母板OLED CK管脚
OLED_DI P20_11 龙邱TC母板OLED DI管脚
OLED_RST P20_10 龙邱TC母板OLED RST管脚
OLED_DC P20_12 龙邱TC母板OLED DC管脚
OLED_CS P20_13 龙邱TC母板OLED CS管脚 默认拉低,可以不用
----------------------------------------------------------------
默认按键接口
KEY0p P22_0 龙邱TC母板上按键0
KEY1p P22_1 龙邱TC母板上按键1
KEY2p P22_2 龙邱TC母板上按键2
DSW0p P33_9 龙邱TC母板上拨码开关0
DSW1p P33_11 龙邱TC母板上拨码开关1
-----------------------------------------------------------------
默认LED接口
LED0p P10_6 龙邱TC母板核心板上LED0 翠绿
LED1p P10_5 龙邱TC母板核心板上LED1 蓝灯
LED2p P20_6 龙邱TC母板上LED0
LED3p P20_7 龙邱TC母板上LED1
-----------------------------------------------------------------
定时器
有两个CCU6模块 每个模块有两个独立定时器 触发定时器中断
推荐使用CCU6模块,STM用作系统时钟或者延时;
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ*/
#include <IfxCpu.h>
#include <IfxScuWdt.h>
#include <LQ_CAMERA.h>
#include <LQ_CCU6.h>
#include <LQ_GPIO_KEY.h>
#include <LQ_I2C_VL53.h>
#include <LQ_ImageProcess.h>
#include <LQ_MotorServo.h>
#include <LQ_SOFTI2C.h>
#include <LQ_TFT18.h>
#include <LQ_Inductor.h>
#include <Main.h>
#include <Platform_Types.h>
#include <stdint.h>
#include <stdio.h>
#include <LQ_ADC.h>
// 定时器 5ms和50ms标志位
volatile uint8 cpu1Flage5ms = 0;
volatile uint8 cpu1Flage50ms = 0;
// 期望速度
volatile sint16 targetSpeed = 10;
// 避障标志位
volatile uint8 evadibleFlage = 0;
int core1_main (void)
{
// 开启CPU总中断
IfxCpu_enableInterrupts();
// 关闭看门狗
IfxScuWdt_disableCpuWatchdog(IfxScuWdt_getCpuWatchdogPassword());
// 等待CPU0 初始化完成
while(!IfxCpu_acquireMutex(&mutexCpu0InitIsOk));
// 切记CPU0,CPU1...不可以同时开启屏幕显示,否则冲突不显示
mutexCpu0TFTIsOk=0; // CPU1: 0占用/1释放 TFT
while(1)//主循环
{
}
}