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.

F28M35H52C: How to read ADCRESULT in M3

Part Number: F28M35H52C
Other Parts Discussed in Thread: CONTROLSUITE

Hi,

I understand that the ADC is controlled by C28. I am using the controlSuite example on my C28 side. However when I read ADCRESULT on the M3 side it gives totally different result than what I read on the C28 side. I'm not sure what is wrong here. Adc1 result 0 and 1 on C28 side give me the value of around 4021 for boths, which is reasonable. But when reading ADCRESULT0 and ADCRESULT1 on M3 side give me 2170 and 51976 respectively. 

Any pointers appreciated.

Thanks,

Robert

  • Robert,
    Thanks for reaching out. The M3 ADC Result registers should just be a mirror of ones on the C28x side, so there shouldn't be any difference. Can you elaborate on how you are reading the M3 side ADC results, is it through code, or a watch window in CCS?

    I'm wondering if there is somehow a mis-mapping of the register addresses, because they should match, but also the value of 51976 shouldn't be possible(12-bit ADC), and the upper 4 bits should always read 0.

    If you can share any example code I can take a look at it as well.

    Best,
    Matthew
  • Hi Matthew,

    Basically the same code as in controlSuite for the C28 side, and on the M3 I am just reading the ADCRESULT registers into variables voltage1 and voltage2, using the CCS debug to watch the values.

    This is the code in the main loop of the M3:

    #elif defined(__F28M35H52C1__)
    M3_TimerHandler(); // handle timer related execution
    {
    uint16_t voltage1 = HWREG(ADC1_BASE);
    uint16_t voltage2 = HWREG(ADC1_BASE+1);
    }
    #endif

    Firing Adc1_0 and Adc1_1 on the C28 side:


    __interrupt void adc1_isr(void)
    {
    //Voltage1[ConversionCount] = Adc1Result.ADCRESULT0;
    //Voltage2[ConversionCount] = Adc1Result.ADCRESULT1;

    // If 20 conversions have been logged, start over
    if(ConversionCount == 9)
    {
    ConversionCount = 0;
    }
    else ConversionCount++;

    Adc1Regs.ADCINTFLGCLR.bit.ADCINT1 = 1; //Clear ADCINT1 flag reinitialize
    // for next SOC
    PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Acknowledge interrupt to PIE

    return;
    }

  • Robert,

    Can you verify the version of the Control Suite Support package you have installed?  I believe I have the latest and my path is

    C:\ti\controlSUITE\device_support\f28m35x\v220

    Speaking with a colleague, he recalled that in an early release the ADC results registers on the M3 side were incorrectly mapped, which would cause the behavior you are seeing.  Just want to eliminate any older versions of the SW as the issue.

    Matt

  • Hi Matt,
    I made sure I compiled with v220. Still the same results.
    I wonder if my controlCARD dev kit was the problem. I remember the dip switch setting for the boot of this controlCARD was opposite to the one we have in our Adelaide office because the controlCARD version was different?

    Robert

  • Robert,

    Can you confirm the address of the ADC Result registers that you are reading from M3?

    -Tommy

  • Hi Tommy,

    I changed it to use explicitly 0x50001600 instead of ADC1_BASE. Still quite different from C28 readings.

    Screenshot:

  • Robert,
    Can you change the variables "voltage1/2" to be global rather than local? I want to make sure we aren't dealing with an issue where we are reading the values while they are not in scope.
    Another way would be to make 2 watch windows to both the C28x and M3 ADC results and view them at the same time to confirm they are not the same.
    Best,
    Matthew
  • Robert,
    In addition to what Matt suggested,
    Can you have the watch window in continuous update mode instead of using a break point and keep the program running in a loop?(BTW in the snapshot looks like you hit the break point before the values are read?)

    Also on M3, I cannot tell from the snapshot above if you are waiting for ADC completion correctly or not? How are you synchronizing this or handling this?

    Best Regards
    Santosh Athuru
  •   Hi Matt,

    I changed the voltage scope further. Same results. See attached screenshot.

    On the C28 side , see screen shot.

    The values don't change much. They fluctuate +/- 10 each breakpoint respectively.

    Thanks,

    Robert

  • Hi Santosh,

    How do I do the continuous update mode?

    Yes, I set the breakpoint to watch the values.

    No I do not have any synchronisation. I just need the last value sampled on the M3 side.

    Thanks,
    Robert
  • Robert,
    In the M3 debugger view can you place the literal memory address of the ADC Results vs the variable "voltage1"

    ADC1 Results M3: 5000 1600h - 5000 161Fh

    This will eliminate any issues with the variable, either in scope or otherwise.

    Thanks,
    Matthew
  • Hi Matthew,

    Still the same. See screenshot. I am thinking there is something wrong with the silicon.

  • Robert,
    Thanks for this, do you have any other eval boards or silicon we could look at to confirm this is an issue with this device only. I agree with you based on all the info you have provided there does appear to be an issue with this specific device.

    If you are using a control card, or other eval platform I can look into getting you a replacement as well.

    Best,
    Matthew
  • Matthew,

    Incidentally, I have received the first first of our prototype boards fully loaded. I programmed the same code into the prototype and the ADCs work straight up. C28 side and M3 side are consistent!!

    I went back to the controlCard, programmed it again; still the same result as before. I conclude the controlCARD is faulty. As I mentioned before this controlCARD also had the peculiarity that the DIP switch settings are opposite of the other controlCARD we have in our Adelaide office. Granted that it was both different revisions, we dismissed it before.


    What is the process of getting this replaced?

    Thanks,

    Robert

  • Robert,
    I'll contact you privately through the forum chat to get your shipping info/etc for replacement. Glad to see this was isolated and your protos are working correctly.

    Best,
    Matt