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.

DRV8316R-Q1EVM: Source code for .out file used in the DRV8316xEVM_InstaSPIN_Universal_GUI

Part Number: DRV8316R-Q1EVM

Hi,

I'm looking for the ccs source code used to generate the .out file used in DRV8316xEVM_InstaSPIN_Universal_GUI. 

I found a source code in the E2E FAQ given below
https://e2e.ti.com/support/motor-drivers-group/motor-drivers/f/motor-drivers-forum/1032664/faq-drv8316revm-drv8316revm-source-code-for-motorcontrol-sdk?tisearch=e2e-sitesearch&keymatch=faq%3Atrue

When using the DRV8316xEVM_InstaSPIN_Universal_GUI, I'm able to access the drv8316 registers through SPI.

However, when I create a new GUI using the .out file compiled from the source given in the link above,  I'm unable to access the drv8316 registers.

Thanks
najath

  • Hi Najath,

    Thanks for your question! Which lab did you use for the .out file?

    Regards,

    Anthony Lodi

  • Hi Anthony,

    I have tried lab3, lab5, lab7, and lab13.

    I'm currently using lab13 - is13_fwc_mtpa

    Regards
    najath

  • Anthony Lodi

    Thanks for the information!

    Is it just SPI that is not working? Or are there other parts of the GUI that do not work? I am trying to understand if it is only related to the SPI code or if there could be a different issue.

    Regards,

    Anthony Lodi


  • There was an issue with the "Run" checkbox not always working for lab13. It started working when I changed the connected variable from motorVars.flagRunIdentAndOnLine to motorVars.flagEnableRunAndIdentify


    Now only SPI is not working. I don't see any code that enables SPI communication in the main file - is13_fwc_mtpa.c.

    On a side note: some of the SPI Control register fields in the DRV8316xEVM_InstaSPIN_Universal_GUI have mistakes in them
    Control Register 2: CLR_FLT has blank "values" field in properties. This makes it difficult to clear fault through the GUI.
    Control Register 10: DLY_TARGET has wrong values in the dropdown menu

  • Hi Najath,

    Thanks for the additional details and comments, I will look into this in more detail and follow up either tomorrow or early next week.

    Regards,

    Anthony Lodi

  • Hi Najath,

    It seems that lab 13 doesn't have the same SPI initialization that is done in lab 5. You could try to copy the #ifdef DRV8316_SPI related code from lab 5 and add it to lab 13 to see if that will provide the appropriate variables to bind to the GUI.

    If that doesn't work, you could check in Project --> Properties --> Build --> C2000 Compiler --> Predefined Symbols to see if the DRV8316_SPI define is present. If it is not present, could you try adding that predefine and then try rebuilding the project.

    Regards,

    Anthony Lodi

  • I don't see any #ifdef DRV8316_SPI related code in lab 5.

    I'm using C2000Ware_MotorControl_SDK_4_00_00_00 and the drv8316revm.zip solution from E2E FAQ given above

  • Hi Najath,

    Let me discuss this with my coworker and get back to you by Thursday.

    Regards,

    Anthony Lodi 

  • Hi Najath,

    Sorry for the late reply, after looking over the code it looks like there are a few things that may need to change in order to get SPI to work, but I need to confirm this with my coworker next week (he is currently on vacation) and I will aim to let you know the next steps by Tuesday end of day Dallas time. 

    Sorry for the delay!

    Regards,

    Anthony Lodi

  • Hi Anthony,

    Thank you for the update!

    Looking forward to receiving the details of the required code modifications

    Regards
    najath

  • Hi Najath,

    I discussed this with my coworker and he confirmed that the lab code that is available through C2000Ware_MotorControl_SDK on TI.com does not have some code that is used to set up the SPI for the DRV8316EVM. I plan on providing a zipped file to you with the correct modifications made to each lab file by the end of the week. Thanks for bringing this to our attention and I apologize for the inconvenience! 

    Regards,

    Anthony Lodi

  • Hi Najath,

    My apologies, this week has been particularly busy and I have not had time yet to make the necessary modifications. I plan on working with a coworker on this next week and will aim to provide them middle to end of next week. Sorry for the delay!

    Regards,

    Anthony Lodi 

  • Hi Najath,

    Sorry for the delay, I am unable to provide the zipped files as of right now unless I reach out to a few people which could take some time, so I have included instructions below on how to modify the code:

    If you do a search for "#ifdef DRV8320_SPI" in the .c file for the lab that you are wanting to use (for example, is05_motor_id.c), then you will want to replace every instance of "DRV8320" with "DRV8316" within the #ifdef....#endif sections, or make a copy of the #ifdef DRV8320.....#endif sections of code and rename the DRV8320 instances to DRV8316. Additionally, for the code section initializing the DRV interface, the initial SPI registers need to be changed based on the DRV8316 register map as shown below.

    Code before modification

    Code after DRV8316 modification

    Let me know if you get any issues or errors after making these modifications. 

    Regards,

    Anthony Lodi


  • Hi Anthony,

    Thank you for the instructions, that helped!

    I modified is13_fwc_mtpa.c and now I'm able to access the drv8316 registers through a modified copy of DRV8316xEVM_InstaSPIN_Universal_GUI. 

    I had to make few changes in the GUI to fix drv8316 register bit access issues that I mentioned earlier.

    Regards
    najath

  • Hi Najath,

    Glad to hear that you were able to get it working successfully! Thanks for your patience in working through this.

    Regards,

    Anthony Lodi