主题中讨论的其他器件:TMS320F28027、 DRV8301、 MOTORWARE
工具与软件:
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
工具与软件:
"我的工作是使用 UART 命令运行电机。 我已经添加并写入了 SCI (串行通信接口)函数的逻辑、但无法输入任何命令、因为它会自动运行。 引导我任何人。
你好、Allison Nguyen
我已连接到 main.c 文件下面。 请 检查代码对 main.c 文件的任何修改、请告诉我
尊敬的 Kishor:
感谢您的支持。 请注意、最好根据问题的症状进行调试、而不是扫描整个代码。 我首先真正想知道的是、您看到的问题所带来的影响是什么。 您是否仔细检查了 SCI 引脚、并能够确认信号 TX/RX 是否按预期进行通信? 您是否能够在 CCS 中连接到器件并在检查 SCI 寄存器时逐步执行? 如果我在 SCI 外设方面遇到问题、可以从这些地方开始。
您还可以为 SCI 启用环回模式(在内部将 RX 和 TX 连接在一起)、以仔细检查 SCI 是否正常工作、并根据预期回显字符-独立于系统验证功能。
一般来说、环境和所需环境是什么(正在传输的数据是什么)? 所有这些问题都可以帮助我们深入了解。
此致。
Allison
尊敬的 Kishor:
对反应延迟深表歉意。 您的调试进度有任何更新吗?
从上面的帖子中可以 看出、在没有进一步了解您所看到问题的背景情况下、很难开始评估您的项目。 一项关于电机未正常运行的一般性声明(很遗憾、未能为我提供足够的信息来指示问题可能出在何处(软件、外设配置、通信速度/格式、硬件连接)。 这就是为什么我要求提供更多详细信息:
[报价 userid="568270" url="~/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1441044/tms320f28027f-tms320f28027with-drv8301/5530004 #5530004"]我首先真正想知道的是、您看到的问题所带来的影响是什么。 您是否仔细检查了 SCI 引脚、并能够确认信号 TX/RX 是否按预期进行通信? 您是否能够在 CCS 中连接到器件并在检查 SCI 寄存器时逐步执行? 如果我在 SCI 外设方面遇到问题、可以从这些地方开始。
您还可以为 SCI 启用环回模式(在内部将 RX 和 TX 连接在一起)、以仔细检查 SCI 是否正常工作、并根据预期回显字符-独立于系统验证功能。
[报价]如果您首先提供这些选项、则可以缩小导致问题的范围并采取进一步的有针对性的调试步骤。
此致、
Allison
尊敬的 Kishor:
对反应延迟深表歉意。 您的调试进度有任何更新吗?
从上面的帖子中可以 看出、在没有进一步了解您所看到问题的背景情况下、很难开始评估您的项目。 一项关于电机未正常运行的一般性声明(很遗憾、未能为我提供足够的信息来指示问题可能出在何处(软件、外设配置、通信速度/格式、硬件连接)。 这就是为什么我要求提供更多详细信息:
[报价 userid="568270" url="~/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1441044/tms320f28027f-tms320f28027with-drv8301/5530004 #5530004"]我首先真正想知道的是、您看到的问题所带来的影响是什么。 您是否仔细检查了 SCI 引脚、并能够确认信号 TX/RX 是否按预期进行通信? 您是否能够在 CCS 中连接到器件并在检查 SCI 寄存器时逐步执行? 如果我在 SCI 外设方面遇到问题、可以从这些地方开始。
您还可以为 SCI 启用环回模式(在内部将 RX 和 TX 连接在一起)、以仔细检查 SCI 是否正常工作、并根据预期回显字符-独立于系统验证功能。
[报价]如果您首先提供这些选项、则可以缩小导致问题的范围并采取进一步的有针对性的调试步骤。
此致、
Allison
你好、 Allison Nguyen
"我已经编写了以下逻辑来运行电机的开启命令。 如何连接硬件? 「我知道了。」
//Added // UART Rx ISR interrupt void sciARxISR(void) { HAL_Obj *obj = (HAL_Obj *)halHandle; while (SCI_rxDataReady(obj->sciAHandle)) { char c = SCI_read(obj->sciAHandle); if (counter < BUF_SIZE - 1) // -1 to leave space for null terminator { buf[counter++] = c; if (c == '>') // End of command { buf[counter] = '\0'; // Null-terminate the command string processCommand(buf); counter = 0; // Reset buffer index } } else { // Buffer overflow, reset counter counter = 0; } } // Clear SCI interrupt flag PIE_clearInt(obj->pieHandle, PIE_GroupNumber_9); } // Process received command void processCommand(char *command) { if (strcmp(command, CMD_RX_ON) == 0) { isMotorOn = true; sendResponse("Motor ON"); } else if (strcmp(command, CMD_RX_OFF) == 0) { isMotorOn = false; sendResponse("Motor OFF"); } else { sendResponse("Unknown Command"); } } // Send response to UART void sendResponse(const char *message) { int length = strlen(message); returnBuf[0] = '<'; strncpy(&returnBuf[1], message, length); returnBuf[length + 1] = '>'; serialWrite(returnBuf, length + 2); } // Write data to UART void serialWrite(const char *sendData, int length) { int i = 0; while (i < length) { if (SCI_txReady(halHandle->sciAHandle)) { SCI_write(halHandle->sciAHandle, sendData[i]); i++; } } isWaitingTxFifoEmpty = true; }
尊敬的 Kishor:
调试(单步) SCI ISR 处理程序观察从读取数据寄存器的 C 代码缓冲的字符将大有帮助。 您至少必须通过 CCS 调试来验证 RX 数据是否从连接的输入设备进入 UART。 或者、通过虚拟 COM 连接 Putty 监视器串行输入设置 XDS110 xml 文件。 此外、检查 SCI 处于阻塞模式或 FIFO 模式16字、还监测 RX ISR 处理程序内的 UART 错误标志寄存器。
请阅读有关 SCI 电路分析的 x27F TRM 部分、以便更好地了解开发和配置点的预期。
此致、
UART 引脚连接到 PC
尊敬的 Kishor:
SCI 是如何连接到 PC 串行端口的? LaunchPad 的 USB 电缆可以轻松地提供虚拟 COM 端口提供的交换机、存在 GPIO 和 C 配置、请查看 x27F LaunchPad 的 PDF 以及原理图。 两个 SCI-A/B 都通过(hal.c)使用默认 GPIO 端口通过通用电机控制 SDK 进行配置。 SCI 配置使用 FIFO 中断时有点紧张、电机 ISR 循环可能在 SCIRXISR 功能内需要最高外设内核优先级、并至少使用默认优先级使 EINT 生效。 最近还发布了另一篇论坛文章、介绍了将 DINT/EINT 与 TM0和 ADC 内核优先级顺序默认使用的情况。
您好、Genatco
//Added // UART Rx ISR interrupt void sciARxISR(void) { HAL_Obj *obj = (HAL_Obj *)halHandle; while (SCI_rxDataReady(obj->sciAHandle)) { char c = SCI_read(obj->sciAHandle); if (counter < BUF_SIZE - 1) // -1 to leave space for null terminator { buf[counter++] = c; if (c == '>') // End of command { buf[counter] = '\0'; // Null-terminate the command string processCommand(buf); counter = 0; // Reset buffer index } } else { // Buffer overflow, reset counter counter = 0; } } // Clear SCI interrupt flag PIE_clearInt(obj->pieHandle, PIE_GroupNumber_9); } // Process received command void processCommand(char *command) { if (strcmp(command, CMD_RX_ON) == 0) { isMotorOn = true; sendResponse("Motor ON"); } else if (strcmp(command, CMD_RX_OFF) == 0) { isMotorOn = false; sendResponse("Motor OFF"); } else { sendResponse("Unknown Command"); } } // Send response to UART void sendResponse(const char *message) { int length = strlen(message); returnBuf[0] = '<'; strncpy(&returnBuf[1], message, length); returnBuf[length + 1] = '>'; serialWrite(returnBuf, length + 2); } // Write data to UART void serialWrite(const char *sendData, int length) { int i = 0; while (i < length) { if (SCI_txReady(halHandle->sciAHandle)) { SCI_write(halHandle->sciAHandle, sendData[i]); i++; } } isWaitingTxFifoEmpty = true; } /////////////////// in main.h void handleMotorCommands(void) { // Start/Stop the motor based on isMotorOn flag if (isMotorOn) { gMotorVars.Flag_Run_Identify = true; printf("Motor is ON\n"); // Debug: Print motor state } else { gMotorVars.Flag_Run_Identify = false; printf("Motor is OFF\n"); // Debug: Print motor state } // Set the target running speed gMotorVars.SpeedRef_krpm = targetSpeed; printf("Target speed set to %ld krpm\n", gMotorVars.SpeedRef_krpm); // Debug: Print target speed }
我已附加了代码、需要进行任何修改。 请告诉我
你好、Allison Nguyen
"我遇到了链接器命令问题。 你能建议如何解决它吗?"
说明资源路径位置类型
#10010链接过程中遇到错误;"proj_lab11.out"未构建 proj_lab11 C/C++问题
#10099-D F28027F.cmd /proj_lab11行127 C/C++问题
#10099-D F28027F.cmd /proj_lab11行130 C/C++问题
gmake:***[proj_lab11.out]错误1 proj_lab11 C/C++问题
gmake:由于错误、未重制目标"all"。 proj_lab11 C/C++问题
#10210-D 创建默认大小为0x400的".esysmem"段;使用 proj_lab11 C/C++问题
#10247-D 创建没有段 proj_lab11 C/C++问题的输出段".cio"
尊敬的 Kishor:
[报价 userid="600288" url="~/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1447937/tms320f28027f-tms320f28027with-drv8301-to-run-bldc-motor/5589446 #5589446"]#10210-D 创建默认大小为0x400的".esysmem"段;使用 proj_lab11 C/C++问题为了避免此错误、请在"Project Properties"->"C2000 Linker"->"Basic Options"下配置堆大小
#10247-D 创建不含段 proj_lab11 C/C++问题的输出段".cio"
为了避免此错误、请在链接器 cmd 文件中添加.cio、并将其分配到可用的存储器区域。 例如: .cio :> RAMLS0
此致、
Veena.
您好、Veena Kamath
我添加了.cio cmd、如上屏幕截图所示。 仍然出现错误。
Description Resource Path Location Type #10010 errors encountered during linking; "proj_lab11.out" not built proj_lab11 C/C++ Problem #10099-D program will not fit into available F28027.cmd /proj_lab11 line 117 C/C++ Problem #10099-D program will not fit into available F28027.cmd /proj_lab11 line 144 C/C++ Problem gmake: *** [proj_lab11.out] Error 1 proj_lab11 C/C++ Problem gmake: Target 'all' not remade because of errors. proj_lab11 C/C++ Problem #10210-D creating ".esysmem" section with default size of 0x400; use proj_lab11 C/C++ Problem #10247-D creating output section "ramfuncs" without a SECTIONS proj_lab11 C/C++ Problem #10247-D creating output section "rom_accessed_data" without a proj_lab11 C/C++ Problem
尊敬的 Kishor:
"#10099-D 程序无法装入可用的 F28027.cmd /proj_lab11行117 C/C++问题"
链接器无法分配内存。 如果有任何其他区域具有未使用的存储器区域、请使用它们。
[报价 userid="600288" url="~/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1447937/tms320f28027f-tms320f28027with-drv8301-to-run-bldc-motor/5601451 #5601451"]我添加了.cio cmd、如上屏幕截图所示。 仍然出现错误。
[报价]对于错误中列出的其他输出段、添加了相同的内容
此致、
Veena.
您好、Veena Kamath
我尝试了数次但仍然错误未解决。 我已经附加了 F28027.cmd 文件。 修改并重新发送我。
/* // TI File $Revision: /main/7 $ // Checkin $Date: July 6, 2009 17:25:36 $ //########################################################################### // // FILE: F28027.cmd // // TITLE: Linker Command File For F28027 Device // //########################################################################### // $TI Release: $ // $Release Date: $ //########################################################################### */ /* ====================================================== // For Code Composer Studio V2.2 and later // --------------------------------------- // In addition to this memory linker command file, // add the header linker command file directly to the project. // The header linker command file is required to link the // peripheral structures to the proper locations within // the memory map. // // The header linker files are found in <base>\DSP2802_Headers\cmd // // For BIOS applications add: DSP2802x_Headers_BIOS.cmd // For nonBIOS applications add: DSP2802x_Headers_nonBIOS.cmd ========================================================= */ /* ====================================================== // For Code Composer Studio prior to V2.2 // -------------------------------------- // 1) Use one of the following -l statements to include the // header linker command file in the project. The header linker // file is required to link the peripheral structures to the proper // locations within the memory map */ /* Uncomment this line to include file only for non-BIOS applications */ /* -l DSP2802x_Headers_nonBIOS.cmd */ /* Uncomment this line to include file only for BIOS applications */ /* -l DSP2802x_Headers_BIOS.cmd */ /* 2) In your project add the path to <base>\DSP2802x_headers\cmd to the library search path under project->build options, linker tab, library search path (-i). /*========================================================= */ /* Define the memory block start/length for the F28027 PAGE 0 will be used to organize program sections PAGE 1 will be used to organize data sections Notes: Memory blocks on F2802x are uniform (ie same physical memory) in both PAGE 0 and PAGE 1. That is the same memory region should not be defined for both PAGE 0 and PAGE 1. Doing so will result in corruption of program and/or data. The L0 memory block is mirrored - that is it can be accessed in high memory or low memory. For simplicity only one instance is used in this linker file. Contiguous SARAM memory blocks or flash sectors can be be combined if required to create a larger memory block. */ MEMORY { PAGE 0: /* Program Memory */ /* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE1 for data allocation */ PRAML0 : origin = 0x008000, length = 0x000800 /* on-chip RAM block L0 */ OTP : origin = 0x3D7800, length = 0x000400 /* on-chip OTP */ FLASHD : origin = 0x3F0000, length = 0x002000 /* on-chip FLASH */ FLASHC : origin = 0x3F2000, length = 0x002000 /* on-chip FLASH */ FLASHA : origin = 0x3F6000, length = 0x001F80 /* on-chip FLASH */ CSM_RSVD : origin = 0x3F7F80, length = 0x000076 /* Part of FLASHA. Program with all 0x0000 when CSM is in use. */ BEGIN : origin = 0x3F7FF6, length = 0x000002 /* Part of FLASHA. Used for "boot to Flash" bootloader mode. */ CSM_PWL_P0 : origin = 0x3F7FF8, length = 0x000008 /* Part of FLASHA. CSM password locations in FLASHA */ IQTABLES : origin = 0x3FE000, length = 0x000B50 /* IQ Math Tables in Boot ROM */ IQTABLES2 : origin = 0x3FEB50, length = 0x00008C /* IQ Math Tables in Boot ROM */ IQTABLES3 : origin = 0x3FEBDC, length = 0x0000AA /* IQ Math Tables in Boot ROM */ ROM : origin = 0x3FF27C, length = 0x000D44 /* Boot ROM */ RESET : origin = 0x3FFFC0, length = 0x000002 /* part of boot ROM */ VECTORS : origin = 0x3FFFC2, length = 0x00003E /* part of boot ROM */ PAGE 1 : /* Data Memory */ /* Memory (RAM/FLASH/OTP) blocks can be moved to PAGE0 for program allocation */ /* Registers remain on PAGE1 */ BOOT_RSVD : origin = 0x000000, length = 0x000050 /* Part of M0, BOOT rom will use this for stack */ RAMM0 : origin = 0x000050, length = 0x0003B0 /* on-chip RAM block M0 */ RAMM1 : origin = 0x000400, length = 0x000400 /* on-chip RAM block M1 */ DRAML0 : origin = 0x008800, length = 0x000800 /* on-chip RAM block L0 */ FLASHB : origin = 0x3F4000, length = 0x002000 /* on-chip FLASH */ } /* Allocate sections to memory blocks. Note: codestart user defined section in DSP28_CodeStartBranch.asm used to redirect code execution when booting to flash ramfuncs user defined section to store functions that will be copied from Flash into RAM */ SECTIONS { /* Allocate program areas: */ .cinit : > FLASHA PAGE = 0 .pinit : > FLASHA, PAGE = 0 .text : > FLASHA PAGE = 0 codestart : > BEGIN PAGE = 0 #ifdef __TI_COMPILER_VERSION__ #if __TI_COMPILER_VERSION__ >= 15009000 .TI.ramfunc : {} LOAD = FLASHA, RUN = PRAML0, LOAD_START(_RamfuncsLoadStart), LOAD_END(_RamfuncsLoadEnd), RUN_START(_RamfuncsRunStart), PAGE = 0 #else ramfuncs : LOAD = FLASHA, RUN = PRAML0, LOAD_START(_RamfuncsLoadStart), LOAD_END(_RamfuncsLoadEnd), RUN_START(_RamfuncsRunStart), PAGE = 0 #endif #endif csmpasswds : > CSM_PWL_P0 PAGE = 0 csm_rsvd : > CSM_RSVD PAGE = 0 /* Allocate uninitalized data sections: */ .stack : > RAMM0 PAGE = 1 .ebss : > DRAML0 PAGE = 1 .esysmem : > DRAML0 PAGE = 1 .cio : > RAMM0 PAGE = 1 /* Initalized sections go in Flash */ /* For SDFlash to program these, they must be allocated to page 0 */ .econst : > FLASHA PAGE = 0 .switch : > FLASHA PAGE = 0 /* Allocate IQ math areas: */ IQmath : > FLASHA PAGE = 0 /* Math Code */ IQmathTables : > IQTABLES, PAGE = 0, TYPE = NOLOAD /* Uncomment the section below if calling the IQNexp() or IQexp() functions from the IQMath.lib library in order to utilize the relevant IQ Math table in Boot ROM (This saves space and Boot ROM is 1 wait-state). If this section is not uncommented, IQmathTables2 will be loaded into other memory (SARAM, Flash, etc.) and will take up space, but 0 wait-state is possible. */ /* IQmathTables2 : > IQTABLES2, PAGE = 0, TYPE = NOLOAD { IQmath.lib<IQNexpTable.obj> (IQmathTablesRam) } */ /* Uncomment the section below if calling the IQNasin() or IQasin() functions from the IQMath.lib library in order to utilize the relevant IQ Math table in Boot ROM (This saves space and Boot ROM is 1 wait-state). If this section is not uncommented, IQmathTables2 will be loaded into other memory (SARAM, Flash, etc.) and will take up space, but 0 wait-state is possible. */ /* IQmathTables3 : > IQTABLES3, PAGE = 0, TYPE = NOLOAD { IQmath.lib<IQNasinTable.obj> (IQmathTablesRam) } */ ramfuncs : LOAD = FLASHA, RUN = PRAML0, LOAD_START(_RamfuncsLoadStart), LOAD_END(_RamfuncsLoadEnd), RUN_START(_RamfuncsRunStart), PAGE = 0 /* .reset is a standard section used by the compiler. It contains the */ /* the address of the start of _c_int00 for C Code. /* /* When using the boot ROM this section and the CPU vector */ /* table is not needed. Thus the default type is set here to */ /* DSECT */ .reset : > RESET, PAGE = 0, TYPE = DSECT vectors : > VECTORS PAGE = 0, TYPE = DSECT } /* //=========================================================================== // End of file. //=========================================================================== */
您好!
请查看内存分配(视图中提供)、以了解哪些存储器区域未分配。 对于无法拟合的段、可改用这些区域
在 CSS IDE 中、我导入了"Project 11"文件
Project 11 -您能告诉我您在这里指的是哪个项目(或哪个 SDK)吗?
此致、
Veena.
当我尝试导入项目11实验示例时、内存不支持此操作。"
您的意思是说、如果没有内存分配错误、工程就无法编译、但 CCS 可以按预期导入工程。 上述文章中提到的部分区域可能需要将(.esysmem)放置在另一个 LLS 可用内存空间中。 您必须编辑(.cmd)文件、将(.text)段移动到具有更多可用空间的闪存段(C 或 D)中。
您好、Genatco
//已添加
.text :> FLASHC page = 0
//添加
.esysmem :> RAMM1 page = 1.
Description Resource Path Location Type #10010 errors encountered during linking; "proj_lab11.out" not built proj_lab11 C/C++ Problem #10099-D program will not fit into available F28027.cmd /proj_lab11 line 124 C/C++ Problem gmake: *** [proj_lab11.out] Error 1 proj_lab11 C/C++ Problem gmake: Target 'all' not remade because of errors. proj_lab11 C/C++ Problem #10210-D creating ".esysmem" section with default size of 0x400; use proj_lab11 C/C++ Problem #10247-D creating output section ".cio" without a SECTIONS proj_lab11 C/C++ Problem #10247-D creating output section "ramfuncs" without a SECTIONS proj_lab11 C/C++ Problem #10247-D creating output section "rom_accessed_data" without a proj_lab11 C/C++ Problem