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.

TMS320F28027F: TMS320F28027with DRV8301 to run bldc motor

Part Number: TMS320F28027F
Other Parts Discussed in Thread: TMS320F28027, DRV8301, MOTORWARE

Tool/software:

"My scop of work is to run a motor using UART commands. I have added and written the logic for SCI (Serial Communication Interface) functions, but I cannot enter any commands as it is running automatically. Guide me anyone.

  • Part Number: TMS320F28027F

    Tool/software:

    I am using the TMS320F28027 with the DRV8301 to control a motor via UART commands. However, the motor is not running according to the commands. I have attached the main.c file below. I am working with Project 11. Please let me know what might be the issue .    " main.Png

    Please See the code and verify logic and Let me know

  • Hello,

    It seems the image and .c were not attached. Can you please use the E2E buttons to do so? You can by clicking "Insert" > "Image/Video/File" > "Upload" and select your files to attach.

    Are there specific errors you see when scoping the SCI pins to validate proper communication? Is this project in development or has it already run successfully with proper motor control and this issue has appeared due to some change in software/hardware?

    Best Regards,

    Allison

  • Hi Allison Nguyen

    I have attanched file below main.c file. Please  check code any modification in main.c file please let me know

    main.c

    4401.main.c
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    /* --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.
    *
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hi Kishor,

    Thank you for the attachment. Please note that it is better to debug based on the symptoms of the issue rather than scan through your entire code. What I really want to know here first is what are the effects you are seeing as a result of the issue. Are you scoping the SCI pins and able to confirm the signals TX/RX are communicating as expected? Are you able to connect to the device in CCS and step through while checking the SCI registers? These are all places I would start if I am having issues with the SCI peripheral. 

    What you can also do is enable loopback mode for SCI (ties RX and TX together internally) to double check SCI is working and echoing back characters as expected - verifying functionality independent of the system.

    In general, what is the context and desired environment (what is the data being communicated)? All of these questions can help us get to the bottom of it.

    Best Regards.

    Allison

  • Hi Allison Nguyen

    "My scop of work is to run a motor using UART commands. I have added and written the logic for SCI (Serial Communication Interface) functions, but I cannot enter any commands as it is running automatically. Please check my code to verify if the logic is correct and let me know if any modifications are needed."

  • Hi Kishor,

    Allison is currently out of office until after the holidays. Please expect a delay in response. Thank you for your patience.

    Best Regards,

    Aishwarya

  • Hi Allison Nguyen

    "My scop of work is to run a motor using UART commands. I have added and written the logic for SCI (Serial Communication Interface) functions, but I cannot enter any commands as it is running automatically. Please check my code to verify if the logic is correct and let me know if any modifications are needed."

  • Hi Kishor,

    Apologies for the delay in response. Is there any update on your debug progress?

    From the above posts, it is difficult to begin to assess your project without further context of what issues you are seeing. A general statement that the motor is not running correctly unfortunately does not give enough information to me to indicate what the issue could be (software, peripheral configurations, communication speed/format, hardware connections). This is why I asked for more details:

    What I really want to know here first is what are the effects you are seeing as a result of the issue. Are you scoping the SCI pins and able to confirm the signals TX/RX are communicating as expected? Are you able to connect to the device in CCS and step through while checking the SCI registers? These are all places I would start if I am having issues with the SCI peripheral. 

    What you can also do is enable loopback mode for SCI (ties RX and TX together internally) to double check SCI is working and echoing back characters as expected - verifying functionality independent of the system.

    If you are able to provide these first, that will narrow down the possibilities of what is causing the issue and allow you to take further targeted debug steps. 

    Best Regards,

    Allison

  • Hi  Allison Nguyen

    "I have written the logic below to run the motor on commands. How should I connect the hardware? Please let me know." 

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    //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
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hi Kishor,

    It would greatly help to debug (single step) your SCI ISR handler watch the characters being buffered from C code reading the data register. You must at the very least verify via CCS debug RX data is getting into the UART from your connected input device. Alternatively connect Putty monitor serail input via virtual COM set up XDS110 xml file. Also check SCI is in blocking or FIFO mode 16 words and also monitor the UART error flags register inside RX ISR handler. 

    Please read the x27F TRM section on SCI circuit analysis to gain a better understanding of what is expected from the development and configuration points. 

    Regards,

  • Hi Genatco

    "My hardware connection consists of an F28027F launch pad with 6 PWM signals connected to the DRV8301 board, and UART pins connected to a PC. The power supply is an external 7V source. Despite this setup, the motor is not running. Could you provide any suggestions for the hardware connections?"

  • UART pins connected to a PC

    Hi Kishor,

    How is SCI being connected to PC serial port? The USB cable from launch pad can easily provide virtual COM port provided switches,GPIO and C configuration exist, check PDF for x27F launch pad and schematic. Both SCI-A/B are configured universal motor control SDK via (hal.c) with default GPIO ports. The SCI configuration is bit more intense using FIFO interrupts, the motor ISR loop may require highest peripheral core priority inside SCIRXISR function, at lease assert EINT using default priority. There is another recent forum post explaining default use of DINT/EINT with TM0 and ADC core priority order.     

  • Hi Genatco

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    //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
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    I have attached code, any modifications are needed. Let me know

  • Hi,

    Allison will be out of office until early January, please expect a delayed response if any input is needed from her. 

    Best Regards,

    Ben Collier

  • Hi Kishor,

    Have you been debugging this in CCS as Genatco also suggested? When you step through this code line by line are you able to check the SCI registers and verify the configurations and buffers are being updated as expected?

    Best Regards,

    Allison

  • Hi Allison Nguyen

    "I am facing a linker command issue. Could you suggest how to solve it?"

    Description Resource Path Location Type

    #10010 errors encountered during linking; "proj_lab11.out" not built proj_lab11 C/C++ Problem
    #10099-D F28027F.cmd /proj_lab11 line 127 C/C++ Problem
    #10099-D F28027F.cmd /proj_lab11 line 130 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

  • Hi Kishor, 

    If this is a different category of issue you are having now, please create a new thread so that it can be assigned to the correct expert regarding linker command files. If this is the case and/or the original issue is resolved, please let me know and I will close this thread for us.

    Best Regards,

    Allison

  • Hi Allison

    " I am working on UART commands to control a motor. I wrote the code, but these errors keep coming up. I added the linker command F28027.cmd, but it didn't solve the problem."

  • Hi Kishor,

    I am forwarding this inquiry to colleague to help provide input from linker command file side.

    Best Regards,

    Allison

  • Hi Kishor,

    #10210-D creating ".esysmem" section with default size of 0x400; use proj_lab11 C/C++ Problem

    To avoid this error, configure the heap size under Project properties -> C2000 Linker -> Basic Options

    #10247-D creating output section ".cio" without a SECTIONS proj_lab11 C/C++ Problem

    To avoid this error add .cio in the linker cmd file and allocate that to an available memory region. Eg : .cio : > RAMLS0

    Regards,

    Veena

  • Hi Veena Kamath

     I added .cio cmd as shown above screen shot. Still error is coming.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    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
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • HI Kishor,

    "#10099-D program will not fit into available F28027.cmd /proj_lab11 line 117 C/C++ Problem"

    Looks like linker is unable to allocate the memory. If there are any other regions with unused memory region, please use them.

     I added .cio cmd as shown above screen shot. Still error is coming.

    Add the same for other output sections listed in the error

    Regards,

    Veena

  • Hi Veena Kamath

    I tried number of time but still error not resolved. I have attached F28027.cmd file. Modifies and resend me.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    /*
    // 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
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hi Kishor,

    Perhaps add memory browser allocation tool into CCS view and see where code pieces are being placed. It may help you debug even fix LSS memory overlaps in sections. Also check that CCS did not automatically add another *.cmd file in the project path as it can cause similar sections error issues.

  • Hi Genatco 

    "In CSS IDE, I imported the 'Project 11' file by selecting the 'Import' option, then choosing 'CSS Project,' followed by searching for the directory and clicking 'Finish.' However, errors occurred during the process. I need full information about the errors."

  • Hi,

    Please take a look at Memory Allocation (available under View) to understand which memory regions are left unallocated. For sections which are unable to fit, these regions can be used instead

    In CSS IDE, I imported the 'Project 11' file

    Project 11 - can you point me which project (or which SDK) are you referring to here ?

    Regards,

    Veena

  • Hi Veena Kamath

    I used CCS only not SDK. 

  • I meant when you say Project11, is that project from TI or your own project?

    for the memory allocation issue, where you able to find any unallocated RAM and resolve the issue?

    Regards,

    Veena

  • Hi Veena Kamath

    "I am using only the project lab examples from Motorware. When I try to import the Project 11 lab examples, the memory does not support it."

  • When I try to import the Project 11 lab examples, the memory does not support it."

    You meant to say the project wont compile without memory allocation error but CCS can import the project as expected. The sections area noted above post may need to place (.esysmem) in another LLS free memory space. You have to edit (.cmd) file to move (.text) section into flash memory section (C or D) with more free space. 

  • Hi Genatco

    // Added
    .text : > FLASHC PAGE = 0

    //Added
    .esysmem : > RAMM1 PAGE = 1

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    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
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Have you set the project properties to use Flash memory? The project default is often set to load the program into LSRAM.  If you change the project properties to use Flash memory instead of LSRAM, CCS will create another *.cmd file in the project folder tree.

  • Hi Genatco

    I kindly request give some clarification about what your saying. I didn't understanding. Where to changes in the Project properties. I need explanation .

  • Right click on the project top folder, scroll to properties, click to open all the sections allows to make specific changes on the project.