基于MSPM0L1306 LaunchPad的点灯控制
<div class='showpostmsg'><p> MSPM0L1306 LaunchPad开发套件主控为MSPM0L1306器件,提供高达64KB的嵌入式闪存程序存储器和高达4KB的SRAM。它们包含精度为±1%的高速片上振荡器,无需外部晶体。其他特性包括3通道DMA、16位和32位CRC加速器,以及各种高性能模拟外设。如何入手MSPM0L1306 LaunchPad开发套件呢?官方提供了参考短视频。</p><p> 按照官方推荐的说明文档,①、首先需要准备好TI的官方IDE,即CCS。②、其次下载安装好基于MSPM0L1306的SDK。③、然后需要下载安装好图形化代码生成工具SysConfig。</p>
<p> 登录TI官方论坛网站,下载好软件安装包,安装CCS编译工具,具体步骤如下:</p>
<div style="text-align: left;"></div>
<div style="text-align: center;">
<div style="text-align: left;"></div>
<div style="text-align: left;"></div>
<div style="text-align: left;"></div>
<div style="text-align: left;"> 下载好基于windows平台下的“mspm0_sdk_1_30_00_03”软件包,并安装好。</div>
<div style="text-align: left;">
<div style="text-align: left;"></div>
<div style="text-align: left;"></div>
<div style="text-align: left;"> 下载好“sysconfig-1.19.0_3426-setup”,安装MSPM0的图形化代码生成工具SysConfig。</div>
<div style="text-align: left;">
<div style="text-align: left;"></div>
<div style="text-align: center;">
<div style="text-align: left;"></div>
<div style="text-align: left;"> 以上3个必备软件都安装好了,等于基本环境已经构建好,接着需要将SDK与SysConfig导入到CCS工具中。</div>
<div style="text-align: left;">
<div style="text-align: left;"></div>
<div style="text-align: center;">
<div style="text-align: left;"></div>
<div style="text-align: left;"> 导入SDK中基于TI官方交叉编译器的点灯例程,点击编译。编译通过,然后使用Micro USB数据线与电脑相连接,如是首次连接,电脑的右下角会弹出提示安装XDS110驱动的对话框。</div>
<div style="text-align: left;">
<div style="text-align: left;"></div>
<div style="text-align: left;">安装完成后,设备管理器中会自动出现两个串口端口。</div>
<div style="text-align: left;">
<div style="text-align: left;"></div>
<div style="text-align: left;">此时直接点击CCS中的Debug按钮图标,会弹出XDS110 USB Debug需要升级的提示。</div>
<div style="text-align: left;">
<div style="text-align: left;"></div>
<div style="text-align: left;">选择update后,进入到自动升级状态,升级完成后再给开发板重新上电。</div>
<div style="text-align: left;"></div>
<div style="text-align: left;"> 在CCS中执行debug步骤,开发板进入调试阶段。点击全速运行,则会发现板上的LED1红色指示灯会一定频率闪烁。</div>
<div style="text-align: left;">
<pre>
<code class="language-cpp">void main_blinky(void)
{
/* Create the queue. */
xQueue = xQueueCreate(mainQUEUE_LENGTH, sizeof(uint32_t));
if (xQueue != NULL) {
/*
* Start the two tasks as described in the comments at the top of this
* file.
*/
xTaskCreate(
prvQueueReceiveTask, /* The function that implements the task. */
"Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
configMINIMAL_STACK_SIZE, /* The size of the stack to allocate to the task. */
(void *)
mainQUEUE_RECEIVE_PARAMETER, /* The parameter passed to the task - just to check the functionality. */
mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
NULL); /* The task handle is not required, so NULL is passed. */
xTaskCreate(prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE,
(void *) mainQUEUE_SEND_PARAMETER, mainQUEUE_SEND_TASK_PRIORITY,
NULL);
/* Start the tasks. */
vTaskStartScheduler();
}
/*
* If all is well, the scheduler will now be running, and the following
* line will never be reached.If the following line does execute, then
* there was insufficient FreeRTOS heap memory available for the idle
* and/or timer tasks to be created.See the memory management section on
* the FreeRTOS web site for more details.
*/
for (;;)
;
}
/*-----------------------------------------------------------*/
static void prvQueueSendTask(void *pvParameters)
{
TickType_t xNextWakeTime;
const unsigned long ulValueToSend = 100UL;
/* Check the task parameter is as expected. */
configASSERT(((unsigned long) pvParameters) == mainQUEUE_SEND_PARAMETER);
/* Initialize xNextWakeTime - this only needs to be done once. */
xNextWakeTime = xTaskGetTickCount();
for (;;) {
/*
* Place this task in the blocked state until it is time to run again.
* The block time is specified in ticks, the constant used converts
* ticks to ms.While in the Blocked state this task will not consume
* any CPU time.
*/
vTaskDelayUntil(&xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS);
/*
* Send to the queue - causing the queue receive task to unblock and
* toggle the LED.0 is used as the block time so the sending operation
* will not block - it shouldn't need to block as the queue should always
* be empty at this point in the code.
*/
xQueueSend(xQueue, &ulValueToSend, 0U);
}
}
/*-----------------------------------------------------------*/
static void prvQueueReceiveTask(void *pvParameters)
{
unsigned long ulReceivedValue;
static const TickType_t xShortBlock = pdMS_TO_TICKS(50);
/* Check the task parameter is as expected. */
configASSERT(
((unsigned long) pvParameters) == mainQUEUE_RECEIVE_PARAMETER);
for (;;) {
/*
* Wait until something arrives in the queue - this task will block
* indefinitely provided INCLUDE_vTaskSuspend is set to 1 in
* FreeRTOSConfig.h.
*/
xQueueReceive(xQueue, &ulReceivedValue, portMAX_DELAY);
/*
* To get here something must have been received from the queue, but
* is it the expected value?If it is, toggle the LED.
*/
if (ulReceivedValue == 100UL) {
/*
* Blip the LED for a short while so as not to use too much
* power.
*/
DL_GPIO_togglePins(GPIO_LEDS_PORT, GPIO_LEDS_USER_LED_1_PIN);
vTaskDelay(xShortBlock);
DL_GPIO_togglePins(GPIO_LEDS_PORT, GPIO_LEDS_USER_LED_1_PIN);
ulReceivedValue = 0U;
}
}
}</code></pre>
<p> </p>
</div>
<div style="text-align: left;">
<div style="text-align: left;"></div>
<div style="text-align: left;"> 允许Debug后,编译完成后的程序通过XDS110调试器下载到开发板中,此时板上的LED显示状态如下图所示,LED1红灯闪烁。</div>
<div style="text-align: left;">
<div style="text-align: left;"></div>
<div style="text-align: left;">硬件连接只需一个Micro USB即可实现板子的在线调试。</div>
<div style="text-align: left;"></div>
<p> 此次分享到处结束,参考MSPM0L1306入门指南手册可以快速搭建开发环境,熟悉官方主推的CCS集成开发工具,后续再细究MSPM0L1306外设驱动性能。</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div><script> var loginstr = '<div class="locked">查看本帖全部内容,请<a href="javascript:;" style="color:#e60000" class="loginf">登录</a>或者<a href="https://bbs.eeworld.com.cn/member.php?mod=register_eeworld.php&action=wechat" style="color:#e60000" target="_blank">注册</a></div>';
if(parseInt(discuz_uid)==0){
(function($){
var postHeight = getTextHeight(400);
$(".showpostmsg").html($(".showpostmsg").html());
$(".showpostmsg").after(loginstr);
$(".showpostmsg").css({height:postHeight,overflow:"hidden"});
})(jQuery);
} </script><script type="text/javascript">(function(d,c){var a=d.createElement("script"),m=d.getElementsByTagName("script"),eewurl="//counter.eeworld.com.cn/pv/count/";a.src=eewurl+c;m.parentNode.insertBefore(a,m)})(document,523)</script> <p>我只喜欢TI的分离式配置文件,随工程走不用多于的软件</p>
<p>第一眼看那个视频,我还以为是短路打火了呢。。。。。吓死我了</p>
页:
[1]