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.

Debugging control loops

Expert 1570 points

Other Parts Discussed in Thread: MOTORWARE

Hi Chris,

I've been trying to collect data from the current control loop and FAST for offline analysis, i.e matlab.

I've been using so far the PWM DAC outputs, sample them with a scope and saving the data, but it's quit hard because of the filter lag and ripple.

I've been wondering if you have a recomendation for a better method for collecting the data... maybe through CCS ? some other fast digital method ?

since I'm running a high frequency motor, It will be great to collect the data at the loop rate.

Thanks

  • Mojo,

    I was going to recommend you use the dlog module, but it doesn't look like we have the correct headers in MotorWare _11 for this.  I apologize, I'll have to file a bug to get this fixed.

    As an alternative, I recommend you look at the instaspin_motion lab 5f, where CCS graphing features are used to log data.  This same method could be used to write the data out of a serial port to a file on your PC as well. 

    We use this method to dump data out of SPI when testing on our automated test equipment.  I've even posted earlier this year on the forum the SPI software we use.

    If you run into trouble you may want to ask over on the CCS forum as well.

     

  • Thanks Chris,

    I also thought about the SPI but I don't have the hardware to connect to the PC.

    Can you please recommend specific hardware and software for connecting the PC to an SPI port ?

    I think that NI has the required HW and can be used with labview.

    however, no funds at the moment for that :)  can you recommend cheaper solution ?

    By the way, I find it really hard to extract "inner" variables, using the "object oriented coding"... variables like the feedback of Iq, Id and the calculated commands Ud, Uq are really hard to monitor

    Actually, I wasn't able to watch them on the "watch" window in the debugger... can you please advise on how to do that ? I got confused with the handles in the software....

    thanks

  • Mojo,

    Regarding the SPI, we are using Labview for the automated testing.  We have some sort of SPI to USB dongle I believe.  With the F28069M we actually have a Host USB peripheral on the device.  We haven't set this up in MotorWare, but something nice would be to use this USB Host to just dump data to a memory stick or a PC.  Of course, we didn't bring the USB Host out on our 69MISO controlCARD...so this would have to be done on your own PCB.  BTW - the F2806xM and F devices currently show that they do NOT have USB Host on chip. This will be updated shortly to show that USB Host IS actually on-chip and can be brought out.

    Since everything is in structures it actually makes it quite easy to monitor, you just have to know which structures to put into the expressions view.

    gMotorVars

    controller_obj

    drv

    these three will get you most everything you require.

    Recall that some variables are inside the EST, and these aren't accessible at a memory location since it is in ROM. That is why there are the EST_getXXX() and _setXXX functions that must be run in your code to interface to the actual variables.

     

     

  • Thanks Chris,

    Can you please elaborate on the solution with Labview (software/hardwrae) ? Since it is quite hard to debug such a fast control algorithm, working suggestions will be of great usage for all of us users...

    Thanks a lot

  • Mojo,

    I don't have many details I can share.

    We use this for some automated testing that we do of our solutions.

    We built a little UART kernel that organizes and sends variable data back to the PC. 

    The PC is running labview. A labview application was created to send the start-up commands and which variables to log, etc. It also communicates with the serial interface on the dynometer controller.

    The labview application allows batch scripting so we can start the tests and just leave it running.

    It's nothing we can realy share with others....sorry!