主题中讨论的其他器件: BOOSTXL-DRV8320RS、 LAUNCHXL-F280049C、 MOTORWARE
您好!
我正在尝试开始使用 BOOSTXL-DRV8320RS 开发套件、它具有 LAUNCHXL-F28069M 板/处理器。 我在 InstaSPIN 项目和实验室用户指南(1830.instaspin_labs.pdf)文档中了解了实验1 (proj_lab01)的大部分内容。 版本1.0.14。
但我的 LED 不闪烁。 复位电路板只会将调试器发送到地址空间的空洞中。 单步执行 CCS 中的代码、寄存器似乎不会更新? 在 GPIO 寄存器 GPACTRL 中、我得到0x00050000。 我有一条成功打印到控制台的 print 语句、但我不确定这只是调试器的仿真行为还是实际来自 MCU。 我不仅把这个品牌从盒子里取出来、而且它已经在实验室里躺了几个月、所以任何基本的故障排除想法都可以确认它的工作方式就像开箱即用一样、这也会很有帮助。 电路板确实会运行、电路板上有3个低电平、高电平、高电平的开关。 LED 的 D1和 D9分别呈绿色和红色。 D4也是绿色的。 除了打印的内容之外、我的代码应该是原始的实验代码、但可能是在它到达我之前对它进行了更改。
proj_lab01.c
/* --COPYRIGHT--,BSD * Copyright (c) 2012, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * --/COPYRIGHT--*/ //! \file solutions/instaspin_foc/src/proj_lab01.c //! \brief CPU and Inverter Set-up and introduction to interfacing to the ROM library //! //! (C) Copyright 2011, Texas Instruments, Inc. //! \defgroup PROJ_LAB01 PROJ_LAB01 //@{ //! \defgroup PROJ_LAB01_OVERVIEW Project Overview //! //! CPU and Inverter Set-up and introduction to interfacing to the ROM library //! // // ************************************************************************** // the includes // system includes #include <math.h> // modules #include "sw/modules/math/src/32b/math.h" #include "sw/modules/memCopy/src/memCopy.h" // drivers // platforms #include "main.h" // RANDOMS #include <stdio.h> #include <stdlib.h> // ************************************************************************** // the defines #define LED_BLINK_FREQ_Hz 5 // ************************************************************************** // the globals uint_least32_t gLEDcnt = 0; // Counter used to divide down the ISR rate for visually blinking an LED #ifdef CSM_ENABLE #pragma DATA_SECTION(halHandle,"rom_accessed_data"); #endif HAL_Handle halHandle; // Handle to the Inverter hardware abstraction layer #ifdef CSM_ENABLE #pragma DATA_SECTION(gUserParams,"rom_accessed_data"); #endif USER_Params gUserParams; // Contains the user.h settings HAL_PwmData_t gPwmData = {0,0,0}; // Contains PWM duty cycles in global Q format HAL_AdcData_t gAdcData = {0,0,0,0,0,0,0}; // Contains Current and Voltage ADC readings in global Q format volatile MOTOR_Vars_t gMotorVars = MOTOR_Vars_INIT; #ifdef FLASH // Used for running BackGround in flash, and ISR in RAM extern uint16_t *RamfuncsLoadStart, *RamfuncsLoadEnd, *RamfuncsRunStart; #ifdef CSM_ENABLE extern uint16_t *econst_start, *econst_end, *econst_ram_load; extern uint16_t *switch_start, *switch_end, *switch_ram_load; #endif #endif #ifdef DRV8301_SPI // Watch window interface to the 8301 SPI DRV_SPI_8301_Vars_t gDrvSpi8301Vars; #endif #ifdef DRV8305_SPI // Watch window interface to the 8305 SPI DRV_SPI_8305_Vars_t gDrvSpi8305Vars; #endif // ************************************************************************** // the functions void main(void) { // Only used if running from FLASH // Note that the variable FLASH is defined by the project #ifdef FLASH // Copy time critical code and Flash setup code to RAM // The RamfuncsLoadStart, RamfuncsLoadEnd, and RamfuncsRunStart // symbols are created by the linker. Refer to the linker files. memCopy((uint16_t *)&RamfuncsLoadStart,(uint16_t *)&RamfuncsLoadEnd,(uint16_t *)&RamfuncsRunStart); #ifdef CSM_ENABLE //copy .econst to unsecure RAM if(*econst_end - *econst_start) { memCopy((uint16_t *)&econst_start,(uint16_t *)&econst_end,(uint16_t *)&econst_ram_load); } //copy .switch ot unsecure RAM if(*switch_end - *switch_start) { memCopy((uint16_t *)&switch_start,(uint16_t *)&switch_end,(uint16_t *)&switch_ram_load); } #endif #endif // initialize the hardware abstraction layer halHandle = HAL_init(&hal,sizeof(hal)); // check for errors in user parameters USER_checkForErrors(&gUserParams); // store user parameter error in global variable gMotorVars.UserErrorCode = USER_getErrorCode(&gUserParams); // do not allow code execution if there is a user parameter error if(gMotorVars.UserErrorCode != USER_ErrorCode_NoError) { for(;;) { gMotorVars.Flag_enableSys = false; } } // initialize the user parameters USER_setParams(&gUserParams); // set the hardware abstraction layer parameters HAL_setParams(halHandle,&gUserParams); #ifdef LAUNCHPAD // Setup GPIOs 0 and 1 as outputs for use in project lab1 only. // This is specific to the launchpad because its LEDs are also used by the PWM channels. HAL_setupLaunchPadGpio0and1(halHandle); #endif // setup faults HAL_setupFaults(halHandle); // initialize the interrupt vector table HAL_initIntVectorTable(halHandle); // enable the ADC interrupts HAL_enableAdcInts(halHandle); // enable global interrupts HAL_enableGlobalInts(halHandle); // enable debug interrupts HAL_enableDebugInt(halHandle); // disable the PWM HAL_disablePwm(halHandle); #ifdef DRV8301_SPI // turn on the DRV8301 if present HAL_enableDrv(halHandle); // initialize the DRV8301 interface HAL_setupDrvSpi(halHandle,&gDrvSpi8301Vars); #endif #ifdef DRV8305_SPI // turn on the DRV8305 if present HAL_enableDrv(halHandle); // initialize the DRV8305 interface HAL_setupDrvSpi(halHandle,&gDrvSpi8305Vars); #endif printf("Cats!\n"); // For ever loop while(true) { }; } // end of main() function interrupt void mainISR(void) { // toggle status LED if(++gLEDcnt >= (uint_least32_t)(USER_ISR_FREQ_Hz / LED_BLINK_FREQ_Hz)) { HAL_toggleLed(halHandle,(GPIO_Number_e)HAL_Gpio_LED2); //HAL_toggleLed(halHandle,(GPIO_Number_e)GPIO_Number_39); gLEDcnt = 0; } // acknowledge the ADC interrupt HAL_acqAdcInt(halHandle,ADC_IntNumber_1); // convert the ADC data HAL_readAdcData(halHandle,&gAdcData); // ADC processing and pwm result code goes here // write the PWM compare values HAL_writePwmData(halHandle,&gPwmData); return; } // end of mainISR() function //@} //defgroup // end of file