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.

DRV8301-69M-KIT: Output data translation

Part Number: DRV8301-69M-KIT
Other Parts Discussed in Thread: MOTORWARE

I am not clear on using the IQ library but if someone can give me a checkpoint hopefully it will clear it up. I am running the Instaspin FOC and one of the values that is measured in the motor calibration is the series resistance of the BLDC motor I am using. The value comes in for most of the motors at about 0.01479 ohms.  I take this value and:

myvalue = _IQ(gMotorVars.Rs_Ohm)

Which gives me a hex value of 0x0003c322. 

I take this value and put it in an array

mtuResponse[12] = (uint16_t)(offsetRs >> 24) & 0xFF;
mtuResponse[13] = (uint16_t)(offsetRs >> 16) & 0xFF;
mtuResponse[14] = (uint16_t)(offsetRs >> 8) & 0xFF;
mtuResponse[15] = (uint16_t)(offsetRs) & 0xFF;

I then send this out on the serial port to my host laptop. 

The default in the motorware is IQ(24) which means the resolution is 0.000000060

I take the 0x0003c322, convert to decimal and then multiply by 0.000000060 to arrive at a readable display value for our test set. It is very close to the value I can read on the Code Composer Studio display but it is consistently higher value. If I right click in CCS and ask it to display the value by translating the IQ value it is almost perfectly the same value so I am guessing I am missing something in the conversion. Can someone point me to what I am doing wrong?

If I am trying to make this hard for getting values out of the serial port I would love to know a better way also.


  • Thanks for the link but it did not help much. I had looked through that document and have been able to use the IQ library within the TI code. My issue is that I need to get values out of the TI device via a serial link and be able to read them on a display computer. I understand that the global default is for IQ24 so the range is between -128 and 127.999 999 940 with resolution of 0.000 000 060. As I noted above, I am reading the value as a float, converting to the IQ value and then to split that value into bytes that I can send out the serial port, I am doing the shift operations as noted above. All of that is working. On the display end I am converting the 4 bytes back to a 32 bit hex value, converting to decimal and then multiplying that value by the resolution to obtain a decimal value that is human readable on a display. The value is very close, but it seems to be consistently higher, and I am looking to find out why. As a calibration as I explained above, I look at the values displayed in the CCS vars window and by switching the numeric format displayed I can see the float value and the IQ value and using the same IQ value in my display laptop yields a higher float value. My question is simply how do you manually translate an IQ value without being able to use the TI libraries such as in a test setup like I am describing. Is the roundoff buildup to blame - it seems a bit high if so - or is there some other way to obtain a translated IQ value for example in a spreadsheet?

    Alternatively, is there some better way to send values out the serial port that are measured as float values in the TI code? Breaking a hex number into bytes and sending it via serial is fairly standard I think which is why I did this technique. Any help would be greatly appreciated.



  • Seems like this is not related to the IQmath and the example labs of motorWare. You just need to know the data type of the variables, and convert the 32-bit IQ or float vairables to a data format per your own serial communication protocol. You may try to multiply a scalar value to convert the small/large value for sending the data out the serial port.