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.

TMS320F28027F: Configuring low priority ADCs with Instaspin-FOC

Part Number: TMS320F28027F


Hi,

I had a question about how to properly configure the low priority ADC channels in instaspin.

The way the HAL tutorial says to implement lower priority ADCs is to have their start of conversion trigger off the ADCINT that fires after the high priority conversions finish.  This way the conversion of these low priority ADCs does not effect the motor control loop at all.  I think this makes sense, but I am a little worried about what happens in the background (asynchronous) task.

If I am implementing the logic for these ADCs in the main loop, is there anything to stop me from attempting to read a value from the result register as it is being updated?  The example code provided in the HAL tutorial does not appear to check for a conversion complete flag or anything of that sort.

Would it be possible to implement a one shot conversion for all the low priority ADCs I have, then in the background loop could I check to make sure the conversion is complete, read out the data, then enable another conversion to happen after the high priority conversions are complete?

Thanks,
Jim

  • You can change HAL_initIntVectorTable(halHandle) and HAL_enableAdcInts() in hal.c or hal.h to your target ADC interrupt, the interrupt vector and number can refer to device datasheet or reference guide.
  • I am not entirely sure how this will solve the problem, and it could be a non-issue if the micro doesn't allow read access to the result register while it is being updated (or vise versa). I just haven't been able to find this information.
    My concern is the simultaneous read/write that could happen here while maintaining the the SOC for the low priority ADCs to happen after the high priority ADCs have finished. I am trying to prevent the low priority ADCs from delaying the motor control algorithm while also guaranteeing the asynchronous background task does not experience any data corruption from simultaneously reading/writing the result register.

    Thanks,
    Jim