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.

TMS320F280049C: TMS320F28004x FAST estimator

Part Number: TMS320F280049C
Other Parts Discussed in Thread: TMS320F28069, MOTORWARE, C2000WARE

Hello,

We have some software that makes use of Instaspin for sensorless motor control for the TMS320F28069 microcontroller (which was based on an old motorware example project). We have been recently moving all of the firmware to the newer TMS320F28049C because of the new features and safety libraries. I have so far managed to get most of the code working, however the sensorless estimator seems not to want to work. Not that is not estimating correctly, it's simply that as soon as I uncomment the function "EST_run" the microcontroller crashes and jumps to "Interrupt_illegalOperationHandler". Why would this happen? Could you please specify which are the functions needed to get the FAST observer working? That is the only part that we use from Instaspin (we don't need the motor identification, etc.).

I have included the library "f28004x_fast_rom_symbols_fpu32.lib" and I have had a look to the C2000ware_Motor_Control example projects but I haven't managed to find out the root of the problem. Another interesting effect is that as soon as I include the file "est.h" and try to compile I get the error "identifier CTRL_Handle is undefined" in 2 functions of that file "EST_setupTraj" and "EST_configureCtrl", despite the fact that I have:    #include "ctrl_obj.h" in the includes. If I simply comment out those two functions then I compile fine but as said previously the program crashes when I uncomment "EST_run".

Any ideas?

  • These two versions of InstaSPIN are totally different since most of the function names are similar. You might refer to the example labs in motorControlSDK, and port your own code to these labs. You might use lab07 as a starting project if you just need to spin the motor, the .cmd file must reserve the related RAM (RAMLS0 and RAMLS1) for instaSPIN.

    EST_setupTraj() and EST_configureCtrl() are only used for motor identification that need ctrl object as a arguments.

  • I know they are very different, I've spent quite some time moving everything from _IQ to floating point and so on. I have been using lab07 as reference for the changes needed, I still have the same problem though.

    I have reserved RAMLS0 and RAMLS1 for InstaSPIN and added the statements:

    SECTIONS
    {
    sysctrl_data : > RAMM1 | RAMLS2_3, PAGE = 1
    ctrl_data : > RAMM1 | RAMLS2_3, PAGE = 1
    est_data : > RAMGS0_A, PAGE = 1

    }

    to the .cmd file the same way lab07 does without success.

    When I assemble step through the code, when it reaches function "EST_run" it jumps to memory location 0x3ec9ee. I used the memory browser to look to the content of that memory location and it is all zeroes (the whole memory block is all zeroes), which is why it triggers an ITRAP.

    Any ideas? Is it jumping to the wrong memory location? Have I got the FAST lib linked wrong somehow? Should that memory location have different to zeroes value?

  • I should also say that I have managed to spin a motor using position sensor (encoder) so the controller I believe works. It is the sensorless that I am having problems with.

  • Hello,

    I've made some progress with this. It turns out that if you don't call "EST_setParams" before "EST_run" the program completely crashes and ends up in an ITRAP, which is a bit concerning (I was expecting some sort of error but not this).

    Now, I'm running into another problem. When I run the motor using the encoder and scope the sensorless angle, it turns out that I only get the correct estimated angle if I set "estInputData.speed_ref_Hz" and "estInputData.speed_int_Hz" equal to the motor speed. If I set it to zero I get the estimated stuck at zero and if I set it to any other value I get a number of repetitions of the angle in the range [-pi,+pi] equal to   estInputData.speed_ref_Hz./real_speed    e.g. if I set estInputData.speed_ref_Hz = 200Hz and I run the motor (with the encoder) at 100Hz then I get that the estimated sensorless angle varies from -pi to +pi twice per electrical rev (instead of just one as it should). This means I can only run the motor if I know the motor speed in the first place which is a bit silly. I have managed to run the motor sensorless, however I had to input the estimator ("estInputData.speed_ref_Hz" and "estInputData.speed_int_Hz") the speed calculated from the encoder data.

    The other problem I have which might be related to the previous one is that the estimator doesn't seem to output any value at all for either electrical or mechanical speed.

    This is what the input data looks like:

    Any ideas?

  • anybody can help?

  • Javier - I am not a TI expert but I believe your problem is you need to be looking at estOutputData & estInputData (and not ctrlHandle->estOutputData, etc).  The ctrl structure is not used in lab7. 

    Brett

  • Hi Brett,

    Thanks for you answer. I haven't used the lab7 as a template. I have some inverter firmware working that I want to add the sensorless functionality to (I'm trying to import this functionality from lab7). In this other firwmare I have a controller structure. I have added the structures estOutputData and estInputData to this controller structure and simply pass those pointers to the sensorless functions instead of having them defined separately. I don't see, however, how this would affect the sensorless at all, it shouldn't matter where those structures are defined (I think, maybe I'm wrong).

  • Are you using the F280049C device? Or it's just F280049 without "C" postfix?

    Could you please post the related codes for initializating and calling InstaSPIN-FOC functions?

  • Yes, I'm using the F280049C device.

    I'll post the functions used in the same order that they are called in the firmware:

    Initialize handle. One difference is that I have defined the estHandle and the estInputData/estOutputData inside of a controller structure but I believe that should be ok as long as I initialise the handler properly.

    Setup:

    Main ISR (running at constant 20kHz from a timer interrupt):

    From the last snapshot, if I uncomment the two commented code lines then the sensorless does work. What it does is it feeds the speed signal calculated by other means (using an encoder) to the estInputData structure. This shouldn't be necessary at all, since it would mean that you need an external way of reading angle/speed in order for the estimator to work, which defeats the whole point of having an estimator in the first place.

    Linker file:

    Linked libraries:

    I haven't been able to make much progress on this issue for a very long time, I would very much appreciate some help.

  • could anybody give some support?

  • Don't change and any variables in the USER_Params and  CTRL_Obj objects.

    Both estInputData.speed_ref_Hz and estInputData.speed_int_Hz are set to the fixed target running speed, not a measurement speed.

  • I am not trying to be mean but the support I am receiving in this topic is dreadful. I have given full explanation of my problem with pictures and everything, responding pretty much immediately to your replies and yet I get half responses over a week late that don't solve my problem. Is there somebody at Texas Instruments with a good understanding about how this sensorless FAST algorithm works? The main reason why we are using this processor is because of this algorithm and yet it is not working.

    Is there a comprehensive document or can somebody provide me with the information about what is the bare minimum needed to get this algorithm working? What functions need to be called? in what order? what structures cannot be changed? I am not using any of the motor estimation functionality, just need to get the angle/speed observer working.

    "Both estInputData.speed_ref_Hz and estInputData.speed_int_Hz are set to the fixed target running speed, not a measurement speed." -> As I have said in my previous posts (with pictures and everything), if I don't set this values to the measured speed by the encoder I don't get any values out of the angle/speed estimation (I found out this by lucky trial). The sensorless algorithm should be able to estimate the speed on its own. If I need to have a good speed value in the first place to get this working what is the point of using it? If I set this values to the target speed then it doesn't work at all. Also, what is the target speed if running in torque mode?

  • You might add your own struct object and variables in the example project without changing the FAST related objects. All of the struct objects are called in the EST_<function names> functions can't be changed, such as USER_Params in lab07 that doesn't use the CTRL_Obj object.

    The lab07 should be workable if you only added your own control codes without changing the control flow in lab07, that's why we provided some examples, you must call all of the EST_<function names> functions in ISR and main loop used in lab07 if you want to get the angle and speed from the FAST estimator. 

    InstaSPIN-FOC™ and InstaSPIN-MOTION™ User's Guide http://www.ti.com/lit/ug/spruhj1h/spruhj1h.pdf  has a detailed description of the FAST estimator though it's not the latest document for instaSPIN enabled F28004x.

    Please post the codes you did and tell us what do you want to achieve if you still have further questions. 

  • Javier - ok.  i understand.  You may have already looked down this path but here are my 2 cents:

    1. Are you calling USER_setParms and USER_setParams_priv?  I don't really understand what the 2nd function is doing but i do know it must be called.

    2. Did you setup the speed reference trajectory? I think this is needed so you can control how fast you ramp from 0 to the desired speed.

    3. In the ISR, TRAJ_run() is used to walk the speed reference to the desired value.  Are you using this function to set the estInputData?

    Take a look at Lab7 and you will see how TI sets the speed reference trajectory and how they call TRAJ_run().

    Brett