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.

DRV8312-C2-KIT: F28035 - How to configure ADC pin to give torque input for InstaSPIN_BLDC project.

Part Number: DRV8312-C2-KIT

Hello guys,

I am using InstaSPIN_BLDC lab project to run 48V BLDC motor in torque control mode with the help of DRV8312 C2-kit.

In InstaSPIN_BLDC lab project torque input is given by IRef variable and that is consant.

I want to use ADC peripheral to give torque input to IRef variable via ADC input.

Please help me 

1.In configuring ADC pin and embedding this with InstaSPIN_BLDC  project .

2.Since  data type of IRef is in  _iq format , how to convert normal floating numbers to _iq format.

Sample code would of great help.

Thanks in advance. 

  • 1. Add the ADC channel selection in ADC_MACRO_INIT() in f2803xidc_vemf.h.
    AdcRegs.ADCSOC5CTL.bit.CHSEL = xx; /* ChSelect: ADC A2-> Low Side DC Bus Return Cur.*/ \
    AdcRegs.ADCSOC5CTL.bit.TRIGSEL = 6; \
    AdcRegs.ADCSOC5CTL.bit.ACQPS = 15; \
    2. Read ADC result in MainISR
    ADC_Value = AdcResult.ADCRESULT5.
    3. Convert the ADC result value to torque setting. Torque=_IQ((float)ADC_Value/4096.0)
  • Thank you Yanming for your quick reply.

    As per your suggestions i am able to configure ADC for torque input and its working fine.

     But i am using ADC-B0 (i.e. channel 8) for torque input which is connected to POT input on DRV8312 board.

    1.can i use ADC channel number 8 for torque input??

    2.In InstaSPIN_BLDC lab project Enable_flag is used to run motor, Instead of Enable_flag,I want to use H/W switch to run motor.

    Is there any spare GPIO pin available on DRV8312 board which i can used for switching purpose.

    Thanks in advance.

  • 1. Yes, you can use this ADC channel as torque input setting.
    2. START, STOP or other non-used pin like SPI-A pins on DRV8312.
  • Thank you Yanming for your help.

    I have configured STOP for switching purpose and it works.

    Currently InstaSPIN_BLDC lab project's active build configuration is set to RAM.

    1.I want to dump this program in flash memory so that even if power goes away program will be there in

    controller.

    I have seen this  thread e2e.ti.com/.../538670 but unable to move to Flash memory.

    Please help.

    Thanks in advance.

  • Some projects support the running based Flash, like InstaSPIN_BLDC_GUI_project, you can refer to it to move the code to Flash. And there is a general example also for each device run based flash in device support of ControlSUITE.