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.

  • Resolved

DRV8312 Kit Example Code and Code Composer Studio Compatibility

Prodigy 200 points

Replies: 9

Views: 4175


Hi Guys,

I recently purchased your DRV8312 Kit and am stepping through the PM_Sensorless project example code using Code Composer Studio  Version: (Free version limited to emulators) From what I can see this code/documentation was written with/for Code Composer Studio v4. Although I am able to translate the instructions for v5,  I am a little bit concerned with compatibility especially while using Code Composer studio to control the MCU while I step through the various build levels. I seem to be running into some problems. I received an error while trying to step through build level1. Here is a list of the instructions that i followed:

  1. assure all jumper settings are in correct position on DRV8312 board and F28035 control card SW3 (JTAG emulation) set to DOWN (ON), SW2 both UP(ON), JP1 set to VR1, M1 set to H, switches RSTA RSTB RSTC set to middle position.
  2. connected USB cable with drivers all preloaded and apparently working since i can run the GUIs with the provided .out files with no problem.
  3. connected 24 volt power supply,(with provided AC->DC convertor) to PVDD and GND. All LEDs light up in correct order.
  4. open code composer studio, load PM_Sensorless project for DRV8312 Kit that came on the usb stick.
  5. assure build level is defined as build level 1 within PM_Sensorless-Settings.h  "#define   BUILDLEVEL LEVEL1"
  6. Right click on PM_Sensorless project and Set Active Build configuration to F2803x_RAM (although it seems to have been this configuration by default)
  7. Right click on PM_Sensorless project and Build Project.
  8. Go to View Tab and then Target Configurations, Right Click on Projects and select New Target Configuration , name configuration and click finish.
  9. According to Instructions with included documentation I selected the Texas Instruments XDS100v1 USB Emulator (really unsure about this step as there is a v2 and v3 option)
  10. Searched for my Device , TMS320F28035, checked the box, saved and tested connection, it passed successfully.  ("The JTAG DR Integrity scan-test has succeeded.")
  11. Launched Debug Session, opened up scripting console and added list of variables i should watch using the javascript file. "AddWatchWindowVars_F2803x.js" (note i had to modify this file as i found that CCv5 does not support the following :"AddExpression command does not support explicit expression formatting") thus i modified the js file as follows:  from   expAdd "EnableFlag" getNatural() to  expAdd "EnableFlag" and followed the same scheme throughout, it worked but then i had to one by one change the Q values to match the current project. Is there a better way to do this, ie once i finish setting the correct Q values can i import and export this information so i do not have to do it everytime  i open code composer studio?
  12. Then i reset the CPU, restarted, enabled real time silicon mode and real time polite mode.
  13. This is where specific directions for this project started (Sensorless FOC of PMSM.pdf , the doc file under PM_Sensorless Project)
  14. Set expression in watch window  EnableFlag to 1, I should see expression IsrTicker increasing as this would verify that the system interrupt is working properly if the code was running.
  15. Now i try to run the program by pressing the Resume/Run button in the debug tab.
  16. This is where i see the problem, program does not run, it stops immediately.


I have a feeling I did not restart the CPU properly when i did this the first time as it did happen to work and the isrTicker variable was increasing initially. When I ran this the first time i looked at the expressions in my watch window and they all had the proper values as shown in the project documentation pdf. Now when I look at values of the expressions in my watch window there very odd values especially for expressions that only have a few logical states like enableflag (0 or 1) DRV_Reset and lsw, for instance lsw value is reported as 55091. However, even if i attempt to change them in the watch window the code will still not run, it just stops as before. I have tried reseting the cpu restarting and power cycling the board following the same instructions i listed above a few times now and i am still getting the same values for my expressions as i saw when the problem initially came up, (note that these values seem extremely wrong considering i reset numerous times and the code should rewrite the registers to its' original values, like i mentioned before they also do not match the values shown in this projects documentation)

Can anybody tell me how to reset the registers to their original values and the proper way to reset the CPU and code as it seems i did not do them correctly.

Also will having CCS v5 be a problem while stepping through the various build levels of this project? I assumed it was backwards compatible so i downloaded the newer version since the version of CCS v4 that came on my usb stick had a corrupted installer. Should I use CCS v4 if so I couldn't seem to find where to download the latest version of CCS v4.

Which version of the Texas Instruments XDS100 USB emulator should i use? there are three i see available in the target configuration tab.




  • Hello,

    I just installed CCSv5 for the first time. So far, I like it, but I haven't tried all the features.

    11. Well, I just verified that this is the case. Very frustrating. I'll have to check with the CCS team on why this feature doesn't work as expected....

    14. You need to run before you try changing a variable.  So do 15 first, then make sure IsR ticker is running, then try to change the EnableFlag


    For reset, you can use the Icons or the Run menu: Reset, then restart.  I always do both when trying to start "fresh"

    I think your main issue is that you aren't running the program first.

    All of these projects should work with CCSv5 (but you've already shown that the scripting isn't compatible)....

    The F28035 controlCARD that comes with the DRV8312 kit has XDS100v1



  • In reply to ChrisClearman:

    [Can you verify which emulator version i should be using, does it matter, the documentation states v1 but i understand it could be a little outdated.

    Texas Instruments XDS100v1

    Texas Instruments XDS100v2

    Texas Instruments XDS100v3] //;)


    sorry did not see the very bottom of your initial reply.


    As per step 11 i found that out through


    Yea i agree since the program is not running the enableflag does not seem to matter, but my problem at the moment is that i can't seem to get the program to run anymore.


    I am going to try clearing my workspace, re-copying the project folder over and redoing all of the instructions from scratch. Just to verify the procedure for a " fresh start" so i hopefully do not get a bunch of debug errors and see this problem again, i understand i should do the following while the code is running.

    1. In the debug window click on reset, then restart.
    2. After this setup graphs and then click Resume and the program should start up again from the beginning? 


  • In reply to Ariel Faynerman:

    use XDS100v1

    I'll hook up the kit and look at your specific issue later today.

  • In reply to ChrisClearman:

    I recreated the original problem, when i attempt to reset , to do a "fresh start" i get the following message:

    "Trouble Reading PC Register:
    (Error -1142 @ 0x0)
    Device blocked debug access because it is currently executing non-debuggable code. Choose 'Rude Retry' to disable polite mode and force the operation.
    (Emulation package 5.0.520.0)"

  • In reply to Ariel Faynerman:


    Are you loading your program?

    1. Launch Selected Target Configuration

    2. Connect Target (if not set to Auto Connect)

    3. Load Program C:\ti\controlSUITE\development_kits\DRV8312-C2-KIT_v124\PM_Sensorless\F2803x_RAM\PM_Sensorless_F2803x.out

    this should open and halt at main

    4. Run/Resume

  • Guru 136410 points

    In reply to ChrisClearman:

    Moving from CCSv4 to CCSv5 we switched from a heavily TI modified version of Eclipse to stock Eclipse.  Moving to stock Eclipse had a lot of advantages as we picked up 5 years worth of fixes and features but we did lose a couple of things.  We got most of our changes into the Eclipse open source stream but one thing we lost was the that the stock expressions view doesn't have an API for expression formatting so our scripting console command can no longer control the format.




    If my reply answers your question please click the "This resolved my issue" button

  • In reply to ChrisClearman:

    It auto loads the program when i press the debug button if i have my target configuration setup for the current project. It does open that file and halts @ main. Let me do some more testing as I have had some success today although it does seem to give me that error occasionally. Unfortunately another project that i must address came up really quick so i will probably be able to work on this sometime late tomorrow. I will notify you if i continue to see the problem, thanks for the help.


  • In reply to Ariel Faynerman:

    I just ran through using the watch window (now called "expressions" in v5) and it all worked fine.


  • In reply to ChrisClearman:

    I think i figured out what my problem was. I was resetting the CPU while the real time silicon mode and Polite mode were enabled. I guess that is not allowed.

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.