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.

3 Bugs Found in motorware_1_01_00_11

Other Parts Discussed in Thread: DRV8312, MOTORWARE

I am porting instaspin to run on my own board. It uses a TI320F28069M. I found and fixed the following three bugs in instaspin reference code. You may want to include them in future release if I am right.

1- For the topology shown in section 5.2.2.2 in the User's guide (SPRUHJ1C) for current feedback. In addition to the changes stated in the manual, you also need to edit the code in the function DRV_readAdcData() in drv.h file. You need to replace:

pAdcData->I.value[x] =  -value; 

with

pAdcData->I.value[x] = value;

for all the currents A, B and C reads (x above = 0,1,2).

2-  Function ADC_disableInt() in adc.c has a serious error. It actually does not work. You need to replace the line:

(ADC_INTSELxNy_NUMBITS_PER_REG - ((intNumber & 0x1) << ADC_INTSELxNy_LOG2_NUMBITS_PER_REG));

with

(ADC_INTSELxNy_NUMBITS_PER_REG - (((intNumber+1) & 0x1) << ADC_INTSELxNy_LOG2_NUMBITS_PER_REG));

makeing calculation the same and correct as like  in function ADC_enableInt() and  ADC_setIntMode() in the same file.

3- Function DRV_setupAdcs() in drv.c is missing the following lines:

ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_x, ADC_NoIntTriggersSOC);

for x = {0 through 15)

This is needed in order for the following calls  to ADC_setSocTrigSrc() in the DRV_Adcs() function to have an effect. The code currently work on TI boards because bug (2) and bug (3) interact in a fortuitous way. Code fails if you  use more than 8 ADC conversions.


  • 1. I think our code in _11 and _12 is correct.

    Positive feedback (5.2.2.1) - for example the DRV8312 based kits:

    bias -= OFFSET_getOffset(obj->offsetHandle_I[cnt]);

      pAdcData->I.value[0] = -value;

    Negative feedback (5.2.2.2) - for example the HVMTR kit:

    bias += OFFSET_getOffset(obj->offsetHandle_I[cnt]);

    pAdcData->I.value[0] = value;

     

    2. Let me look into this one

    3. I think this is accomplished by the NonIntTriggersSOC being set in the AdcCalConversion, but let me double check.

     

     

  • Criss,

    Since I am using DRV8312 chips in my board, I used the reference code for the DRV8312 Kit as the starting point for my code.

    1- Since the code is right for the HVRMTR Kit, I think you should update the manual to the additional required difference if running 5.2.2.2 as done inside the HVRMTR code. I would save people like me running our hardware a a little time.

    For (2) and  (3) reported above,  please assume that I am using the code for the DRV8312 as basis of my ported code.

    Thanks

    Saed

  • Saed,

    1. the code is correct for all inverters. I do agree that in 5.2.2 we need to mention that if you use the bias -= you also need to use the -value when you save the current.  We do this in the DRV8312 code.  This has been captured to update next opportunity.

    2 & 3 I have our ADC guys looking at it....

     

  • Saed,

    Thanks for pointing these out.  Still looking at #3.

    We have confirmed #2.

    ADC_disableInt() in adc.c error 
    Saed's fix will work, or replace the giant compound statement with something simpler like:
     
    uint16_t clearValue = (intNumber & 0x1) ? (1 << 13) : (1 << 5); //different bit cleared if high or low interrupt in register
  • Saed,

    On #3 I don't think there is an error.

    There may be code missing to do what YOU want to do (add more ADC SOC channels), but what we have done is fine.

    The SOCs are all all initialized in the HAL_AdcCalConversion, with the last section clearing the SOC trigger on each channel:

    ADC_setupSocTrigSrc(obj->adcHandle, ADC_SocNumber_15, ADC_NoIntTriggersSOC);

    And then in HAL_setupAdcs we configure the ADC SOCs we want to use...in this case just the currents and voltages for the motor control.

    If you want to add additional ADC SOCs here, with different trigger sources, you can.

     

    Am I misunderstanding what you want to do?

     

  • When I saw you mention HAL_AdcCalConversion() I suspected you are talking about motorware_1_01_00_12. I am porting from motorware_1_01_00_11. In the earlier version, the same function was called DRV_AdcCalConversion() and that one did not have the additional lines to cleanup the INT's. So it was a bug in motorware_1_01_00_11 that has been fixed in motorware_1_01_00_12.

    Before I reported the error, I looked for a document that shows the difference between xxxxxx_11 and xxxxx_12 to see if these bugs are listed and if there are any others reported but I was unable to find such a document. Is there a document that shows the difference among versions and if it does exist can you point me to it. This is a little more critical for the guys like me that are developing on their own hardware, since moving to a newer version requires some porting of the DRV (now HAL) every time and is not as simple as downloading the latest version and immediately running on the development kits.

    Thanks for addressing the issue in a timely manner,

    Saed 

  • Saed,

    You're right, it looks like that was cleaned up in _12.

    If you run MotorWare.exe there is a Revision History, but it doesn't mention this one specifically.  I believe starting in _13 we are going to post a more thorough listing of changes.

    We need to look more at this topic though, it looks lke there are some things we can/should do to clean up the HAL (DRV) usage of the ADC drivers.  Hopefully you'll see an update in _13.

     

  • Saed,

    here is a complete list for _12, we should start providing this in _13

    clarke float extra files
    drv.c  / hal.c update for PWM initial pulse
    LED Toggle function needs to be updated
    First PWM pulse wrong generate in offset calibration stage in LAB02a
    ADC Cal and Setup
    boostxldrv8301 LED doesn't blink
    27F + DRV8312 projects are not functioning correctly
    Change updateGlobalVariables_motor function
    Add local variable calculation to minimum width on labs 10a, 10b and 10c
    Change API names to remove things like 8301, etc
    Change all DRV references to HAL
    All object definitions need to be fixed
    cap drivers, 6x needs cap.c
    clk.h bug
    Pie.h bug, includes LIN incorrectly
    sci.c
    type in est_states.h
    improvement to PWM setup and sync
    Torque value incorrect
    ACIM Motor ID
    USER_IQ_FULL_SCALE_FREQ_Hz <  4 * USER_VOLTAGE_FILTER_POLE_Hz
    Floating point interface on 2806x with fpu32 enabled (MISRA compliance)
    Update the old floating point modules with new floating point modules
    LineStream. Added position labs for 5x devices
    LineStream. Updated proj_lab05c.js file to allow for motor parameter identification
    LineStream. Support for sensored ACIM projects
    LineStream. Bug in logic for SpinTAC Velocity/Position Move
    LineStream. SpinTAC Position Move will generate a more optimal profile for not equal acceleration and deceleration
    LineStream. Allowing a faster maximum speed in position control (expanding configuration range)
    LineStream. SpinTAC Move will always generate a profile if limit is in error
    LineStream. Bug: ProfileTime in SpinTAC Position Move is not being reset
    Setup for PWM_setActionQual_CntUp_CmpA_PwmB()