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.

Why cannot I use Timer0 interrupt in lab03b ?

Other Parts Discussed in Thread: MOTORWARE, CONTROLSUITE, TMDSCNCD28069ISO

I want to  alternate LED blink with Timer0 interrupt  in lab03b,so I Write the code According to <motorware_hal_tutorial> .The program compiled with no error messages,but I get  an error message When I run the emulator.

what is wrong with interrupt ?

 

  • chao,

    lab03b is using timer 0 and timer 1 for the FEM and CPU_USAGE modules.  Try using any of the other labs for your LED using timer0.

     

  • Thank you Chris for the reply. But I used Timer0 interrupt  according to <motorware_hal_tutorial> in lab06a,get a same error message.

    when I run some others whitout Timer0 interrupt,  all goes well.

    which lab can use Timer0 interrupt?

    Is these any other conditions for using Timer0 interrupt ?

    CCS: 5.5

    compiler: 6.2.6

    motorware: 13

  • proj 3b and 7 are using timer0 for the frequency of execution module example.

    You can use timer0 in any of the other labs as-is.

     

    Your error doesn't look like an issue with the timer0, or something is set up incorrectly.

     

  • Hello Chris 

    I have solved the problem by re-installing ccs and motorware.but  I was faced with a new problem.

    In lab03a, I can use the potentiometer to control speed of motor well.

    But, I do likewise in lab06a.The motor do not run.I think my parameters of use.h for instaSPINmotion are no problems,because I remove code about potentiometer and use ccs to set gMotorVars.SpeedRef_krpm and the motor run well. So I do not know why...

  • I suppose your potentiometer is providing a value from -1.0 to 1.0 (or something similar) in relation to a per unit value.

    You are setting this equal to your SpeedRef_krpm, which expects a value in KRPM.

    you need to take your pot value and turn it into krpm.

    For example, you could have a maximum krpm for your motor hard coded or from a variable and then do something like

    gMotorVars.SpeedRef_krpm = gPotentiometer * gMax_krpm;

  • I think it is not the case.The format of gPotentiometer and gMotorVars.SpeedRef_krpm is _iq. If  the maximum speed of my motor is 1000 rpm(gMax_krpm equals 1),then I think I can do this:gMotorVars.SpeedRef_krpm = gPotentiometer;

    I did a test,I commented out the code about potentiometer and inserted the code"gMotorVars.SpeedRef_krpm = _IQ(0.5);".

    It can run as intended and my motor spined well.But no mater how much potentiometer equal to,my motor has remained unmovable. 

    So I haven't been able to find out the reason.

     

  •  made some tests again. I found seemed to have a bug in lab06a if users use potentiometer to control the speed.

    because when the motor goes  from a static position into a dynamic motion,you must ensure the value of gMotorVars.SpeedRef_krpm  make no changes! Any slight changes are not  allowed during this period.

    For example:

    I used test3 for counting. the code below can not make motor run :

    Change test3.The code below can make motor run :

    So,this test explains the phenomenon why I cannot use potentiometer to control motor.

    The voltage of potentiometer  is not always conservative results at all.

    Now,I cannot find a good solution.I'm sure I need help and instruction.

    BTW:Can you give me a PCB file about TMDSCNCD28069MISO for Altium designer format ?

     

     

     

  • chao,

    I don't understand what you are trying to show. Using a pot for a speed command can certainly be done, many on here have done so.

    the controlCARD files are given only in the following

    C:\ti\controlSUITE\development_kits\~controlCARDs\TMDSCNCD28069ISO_v1_1\R0_4

    I believe it is done using a free program called Express PCB http://www.expresspcb.com/ 

     

  • Thanks for the reply.I think my statement is not clear.

    Using a pot for a speed command cannot be done in lab06a.I’ve done this many times.So I am trying to show why a pot as a speed command to control motor is failure in lab06a.

    First.when you tell me the reason that I am not setting this equal to my SpeedRef_krpm,so I made a test prove it is not the real reason.I made the value of the pot is 1.65V,it means gPotentiometer is approximately equal to _IQ(0.5).then I made gMotorVars.SpeedRef_krpm = gPotentiometer.But the motor cannot run.After that,I did not use the pot and I made gMotorVars.SpeedRef_krpm = _IQ(0.5).The motor can run.

    Second.I try to find why the motor cannot run.I gave gMotorVars.SpeedRef_krpm two different values(_IQ(0.401001) and _IQ(0.401022)).If two assignment gaps were short,the motor cannot run.If two assignment gaps were long,the motor can run.It means the motor goes from a static position into a dynamic motion,you must ensure the value of gMotorVars.SpeedRef_krpm  make no changes! Any slight changes are not  allowed during this period.this test explains why I use potentiometer to control motor is failure.

    During practical applications,the voltage of potentiometer is not always conservative results at all.So anyone 

    uses potentiometer to control motor is failure in lab06a.So I need help how to use potentiometer to control motor in lab06a.

    If Chris donnot see what I mean,you can do a test in lab06a.

     

     

  • Today, I found it is also ineffective that use potentiometer  to control motor in lab06b,but effective in lab2a~lab05b.

    CCS:5.5

    motorware:13

    compiler:6.2.7

    user.h:8308.user.h

     

  • Chao,

    I believe the reason you are unable to get a potentiometer to be able to control the speed is because the value is continuously changing, which means that the speed reference is continuously changing.

    In the InstaSPIN-MOTION profile generator, you can change the speed setpoint while it is in a transition, but when you do this it goes into the HALT state.  In the HALT state, it will decrease the acceleration to 0 then begin a new profile to your new speed setpoint.  Since the speed setpoint from the potentiometer is continuously changing, this means that the InstaSPIN-MOTION profile generator is continuously in the HALT state.  You should be able to see this via the varaible: gMotorVars.SpinTAC.VelMoveStatus.

    There are a couple of solutions.

    1. Modify the start condition for the InstaSPIN-MOTION profile generator.
      In the ST_runVelMove function there is the following if statement:
      if((EST_getState(ctrlObj->estHandle) == EST_State_OnLine) && (STVELMOVE_getReset(stObj->velMoveHandle) == false) && (_IQmpy(gMotorVars.SpeedRef_krpm, _IQ(ST_SPEED_PU_PER_KRPM)) != STVELMOVE_getVelocityEnd(stObj->velMoveHandle))) {

      This controls when the profile generator is enabled.  If you modify it to the following:

      if((STVELMOVE_getStatus(stObj->velMoveHandle) == ST_MOVE_IDLE) (EST_getState(ctrlObj->estHandle) == EST_State_OnLine) && (STVELMOVE_getReset(stObj->velMoveHandle) == false) && (_IQmpy(gMotorVars.SpeedRef_krpm, _IQ(ST_SPEED_PU_PER_KRPM)) != STVELMOVE_getVelocityEnd(stObj->velMoveHandle))) {

      This will change the behavior to only accept a new setpoint once the previous setpoint has been reached. 

    2. Filter the potentiometer signal
      Because the potentiometer signal is changing continuously, most of those changes are very small amounts of voltage.  This means that it will impact the profile generator and not be representative of a true turn of the knob.  If you have a small filter that will remove the lower bits of the potentiometer signal this will allow only the important bits that impact the speed reference to come through.  You could do something like the following:

      gMotorVars.SpeedRef_krpm = gPotentiometer & 0x00FF0000;
  • hi chris,
    i want to work with FEM and CPU_USAGE modules in proj_lab3b but a bit confused about it. where can i find a document or help about this lab or FEM and CPU_USAGE modules?
    thank you.
  • Hi,

    Unfortunately we have not written a document that describes these modules in detail. However, they simply use a timer to calculate the time that has elapsed, and then that information is used to calculate percentage of CPU usage. Do you have a specific question?

    -Jorge