【测评报告 A】CC3200-LAUNCHXL+GPIO+UART+PWM+智能小车控制+循迹+避障+超声测距

CC3200_PWM+智能小车+循迹+臂障+测距离

 

 

Ti公司开发的SimpleLink™ Wi-Fi® CC3200 LaunchPad评估套件具有较小的板卡尺寸,集成WIFI、传感器等配置,并配备大量开发软件、底层程序、例程、技术手册等板卡资料,特适用于嵌入开发相关的科研及工程人员学习、试验等。

以10年新能源电驱动软件开发经历的角度来看这块板子较业内板子尺寸小功能多,并附带WIFI、加速度、温度传感器,如将这种集成于电驱动控制板将大大缩短我们软件开发流程,但同时由于其缺乏专用CAN通道,且软件构架不符合AUTOSAR等标准,因此在基于模块及模型开发的过程中增加大量的人力物力,总而言之在测试版的行业中同一功能层级该开发板具有更佳的性能。

1、    开发环境配置

根据自己项目测试需要可安装Tera Term、UniFlash、CCS Code Composer Studio及网页Ti Pin Mux Tool等工具,上位机安装好相关驱动,并从设备管理器确认该板卡所对应的串口号,详细教程可在TI官网查询,此处不赘述。

2、    PWM波测试

参考Ti官网PWM波配置过程,根据需要在Pin Mux Tool中配置PWM输出端口,配置流程如下图所示,其次将编写好的PWM波代码通过CCS进行编译,并获取可执行烧写入控制板的Bin文件,通过UniFlash刷写程序,在刷写过程中需连接SOP2,若刷写的是自带PWM波程序可通过LED灯观看亮度的变化过程,通过周期改变闪烁快慢,若是自编PWM波代码,若代码计算量过大,可通过中断实现批次计算,然后通过示波器观测波形变化。

 

3、PWM波二次开发

永磁同步电机核心控制为SVPWM矢量控制,将来1年内计划将测试版与电机矢量控制相结合,为了权衡改型板卡成本与全新开发成本及其性能,我将进行控制算法移植。为了适应该小型开发测试版,我们将精简控制算法,并将控制板进行适当更改和阉割,将电机温度传感器、旋转变压器线速以及驱动板连接至该测试板卡,并搭配X型电机测试该板卡是否具备电机控制潜力。

 

--------------------------------源程序------------------------------------------------->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

-----------------------------------------------------------------------------------------

void main()
{
/*
BoardInit();
PinMuxConfig();
InitTerm();
DisplayBanner(APP_NAME);

//接受与发送
MAP_TimerIntRegister(TIMERA2_BASE,TIMER_A,TimerIntHandler);
MAP_TimerIntEnable(TIMERA2_BASE,TIMER_CAPA_EVENT);

//时钟配置
MAP_TimerConfigure(TIMERA2_BASE,
TIMER_CFG_SPLIT_PAIR|TIMER_CFG_A_CAP_TIME|TIMER_CFG_B_PWM);
MAP_TimerConfigure(TIMERA3_BASE,
TIMER_CFG_SPLIT_PAIR|TIMER_CFG_A_PWM|TIMER_CFG_B_PWM);
//预分频设置
MAP_TimerPrescaleSet(TIMERA2_BASE, TIMER_BOTH, 199); // 80000kHZ/80000=1KHZ
MAP_TimerPrescaleSet(TIMERA3_BASE, TIMER_BOTH, 199);

//控制事件类型
MAP_TimerControlEvent(TIMERA2_BASE,TIMER_A,TIMER_EVENT_BOTH_EDGES);

MAP_TimerLoadSet(TIMERA2_BASE, TIMER_A,65535);
MAP_TimerLoadSet(TIMERA2_BASE, TIMER_B,400); //60000/400=150MS
MAP_TimerLoadSet(TIMERA3_BASE, TIMER_A,40000); //40000/400=100
MAP_TimerLoadSet(TIMERA3_BASE, TIMER_B,20000); //20000/400=50

MAP_TimerMatchSet(TIMERA2_BASE, TIMER_B,200); //30000/400=75
MAP_TimerMatchSet(TIMERA3_BASE, TIMER_A,20000); //20000/400=50
MAP_TimerMatchSet(TIMERA3_BASE, TIMER_B,10000); //10000/400=25

MAP_TimerEnable(TIMERA2_BASE, TIMER_BOTH);
MAP_TimerEnable(TIMERA3_BASE, TIMER_BOTH);

while(1)
{
if (g_ulFreq>=3)
{
MAP_TimerDisable(TIMERA2_BASE,TIMER_A);
// Report("g_ulfreq:%03dms",g_ulFreq);
//Report("g_ulSamples:%03dms",g_ulSamples);
Report("period:%03dms",
(65535+g_ulSamples[0]-g_ulSamples[2])/400);
Report("Width:%03dms\r\n",(g_ulSamples[0]-g_ulSamples[1])/400);
g_ulFreq=0;
MAP_UtilsDelay(80000000/5);
MAP_TimerEnable(TIMERA2_BASE, TIMER_A);
}
//else

//Report("g_ulfreq:%03dms",g_ulFreq);
}
//6000/400=150
*/

//int iLoopCnt;

//
// Board Initialisation
//
BoardInit();

//
// Configure the pinmux settings for the peripherals exercised
//
PinMuxConfig();

//GPIOPinWrite(GPIOA3_BASE,GPIO_PIN_0,~GPIO_PIN_0);//CC_GPIO_30
//GPIOPinWrite(GPIOA0_BASE,GPIO_PIN_6,~GPIO_PIN_6);//CC_GPIO_00
//GPIOPinWrite(GPIOA1_BASE,GPIO_PIN_0,~GPIO_PIN_0);//CC_GPIO_08
//
// Initialize the PWMs used for driving the LEDs
//
InitPWMModules();

while(1)
{
//if ((MAP_GPIOPinRead (GPIOA1_BASE,0x10)) && (MAP_GPIOPinRead (GPIOA1_BASE,0x80)))//&& (MAP_GPIOPinRead (GPIOA1_BASE,0X40)==1)) //无障碍--直行
/*
if (((!MAP_GPIOPinRead (GPIOA1_BASE,0x10))
&& (!MAP_GPIOPinRead (GPIOA1_BASE,0x80))
&& (MAP_GPIOPinRead (GPIOA1_BASE,0X40)))
|| ((!MAP_GPIOPinRead (GPIOA1_BASE,0X10))
&& (MAP_GPIOPinRead (GPIOA1_BASE,0x80))
&& (MAP_GPIOPinRead (GPIOA1_BASE,0X40))))
if ((MAP_GPIOPinRead (GPIOA1_BASE,0X10))
&& (MAP_GPIOPinRead (GPIOA1_BASE,0X80))
&& (MAP_GPIOPinRead (GPIOA1_BASE,0X40)))
if (((MAP_GPIOPinRead (GPIOA1_BASE,0x10))
&& (!MAP_GPIOPinRead (GPIOA1_BASE,0x80))
&& (!MAP_GPIOPinRead (GPIOA1_BASE,0X40)))
|| ((MAP_GPIOPinRead (GPIOA1_BASE,0X10))
&& (MAP_GPIOPinRead (GPIOA1_BASE,0x80))
&& (!MAP_GPIOPinRead (GPIOA1_BASE,0X40))))
if ((!MAP_GPIOPinRead (GPIOA1_BASE,0X10))
&& (!MAP_GPIOPinRead (GPIOA1_BASE,0x80))
&& (!MAP_GPIOPinRead (GPIOA1_BASE,0X40)))

{
Veh_Run () ;
MAP_UtilsDelay(800000*5);
}
else

{
Veh_Stop();
}*/


//-------------左边+中间 ||左边 || 后退,右转--------------
if (((!MAP_GPIOPinRead (GPIOA1_BASE,0x10))
&& (!MAP_GPIOPinRead (GPIOA1_BASE,0x80))
&& (MAP_GPIOPinRead (GPIOA1_BASE,0X40)))
|| ((!MAP_GPIOPinRead (GPIOA1_BASE,0X10))
&& (MAP_GPIOPinRead (GPIOA1_BASE,0x80))
&& (MAP_GPIOPinRead (GPIOA1_BASE,0X40))))
{
//后退
Veh_Return_Run ();
MAP_UtilsDelay(800000*8);
//右转
Veh_Rigt_Run ();
MAP_UtilsDelay(800000*10);

//Veh_Run ();

}

else if ((MAP_GPIOPinRead (GPIOA1_BASE,0X10))
&& (MAP_GPIOPinRead (GPIOA1_BASE,0X80))
&& (MAP_GPIOPinRead (GPIOA1_BASE,0X40))) //无障碍--直行
{
Veh_Run () ;
}

//---------//------右边+中间||右边 后退,左转----------------------
else if (((MAP_GPIOPinRead (GPIOA1_BASE,0x10))
&& (!MAP_GPIOPinRead (GPIOA1_BASE,0x80))
&& (!MAP_GPIOPinRead (GPIOA1_BASE,0X40)))
|| ((MAP_GPIOPinRead (GPIOA1_BASE,0X10))
&& (MAP_GPIOPinRead (GPIOA1_BASE,0x80))
&& (!MAP_GPIOPinRead (GPIOA1_BASE,0X40)))
||((MAP_GPIOPinRead (GPIOA1_BASE,0X10))
&& (!MAP_GPIOPinRead (GPIOA1_BASE,0x80))
&& (MAP_GPIOPinRead (GPIOA1_BASE,0X40))))
{
//后退
Veh_Return_Run ();
MAP_UtilsDelay(800000*8);
//左转
Veh_Left_Run ();
MAP_UtilsDelay(800000*10);

//Veh_Run ();
}


else if ((!MAP_GPIOPinRead (GPIOA1_BASE,0X10))
&& (!MAP_GPIOPinRead (GPIOA1_BASE,0x80))
&& (!MAP_GPIOPinRead (GPIOA1_BASE,0X40))) //都有障碍,后退停车
{
//后退
Veh_Return_Run ();
MAP_UtilsDelay(800000*50);
//左转
Veh_Stop ();
MAP_UtilsDelay(800000*500);
}
else
{
Veh_Stop ();
}


//Veh_Stop ();
//MAP_UtilsDelay(800000*5);

//Veh_Left_Run ();
//MAP_UtilsDelay(800000*10);
//Veh_Rigt_Run ();
//MAP_UtilsDelay(800000*5);


//!MAP_GPIOPinRead (GPIOA1_BASE,0X10)||!MAP_GPIOPinRead (GPIOA1_BASE,0X40)


//---------
/*
while (1)
{
// Veh_Run ();
// MAP_UtilsDelay(800000*500);

//Veh_Left_Run ();
//MAP_UtilsDelay(800000*50);

//Veh_Rigt_Run ();
//MAP_UtilsDelay(800000*50);

//Veh_Return_Run ();
//MAP_UtilsDelay(800000*50);

//Veh_Stop ();
//MAP_UtilsDelay(800000*100);
//UpdateDutyCycle(TIMERA0_BASE, TIMER_A, 99); //pin_17 pwm功能使能

//UpdateDutyCycle(TIMERA2_BASE, TIMER_B, 99); //red gpio9 pin64 pwm5

//MAP_UtilsDelay(800);

//UpdateDutyCycle(TIMERA3_BASE, TIMER_B,99); //green gpio11 pin2 pwm7
//MAP_UtilsDelay(800000);

//UpdateDutyCycle(TIMERA3_BASE, TIMER_A, 99);
}
*/

}

}


测试就到这了,有兴趣的朋友欢迎留言联系,gaoj315@163.com

8 个回复