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.

TMS320F280049: Reading ADC values and changing PWM values in the CLA

Part Number: TMS320F280049

Hello,

I'm following the examples "cla_ex1_adc_fir" and "cla_ex2_background_task" from the DriverLib f280049 folder in C2000 ware, but even without changing anything (but the Targetconfigs to debug the Launchpad f280049), the ADC values acquired are not consistent. The output value of the filter changes from 35 to -2048 erratically whether the pin ADCINA0 is connected to +3.3V or ground. However, it is possible to read successfully the ADC value from CPU1 using ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER0); 

On the other hand, I haven´t been able to change epwm CMPA value from cla.

I've been trying to use SysCtl_setPeripheralAccessControl(SYSCTL_ACCESS_ADCA,SYSCTL_ACCESS_CLA1,SYSCTL_ACCESS_FULL ) to allow access for the cla to the peripheral but no success

I've added too #include "f28004x_cla_typedefs.h" to the cla file but no success.

Using assembler code for the cla is not an option.

What am I doing wrong? is there another example that successfully reads the ADC / changes CMPA from the cla?

I've spent many hours on a project that uses the CLA, and CPU1 with the DriverLib and this is the only part that doesn't work, I'd thank you very much if you can give me an advice 

  • I successfully use CLA to filter ADC value in F28379 and I suggest you change the code line 105 in "cla_ex2_background_task_cla.cla" to active the pass through mode, then you can check if the value CLA read is correct.

    As I do not have 28049 device, this is only an advice. Maybe someone else can give a better answer.

  • Hello Haizhu,

    Thank you for your answer, I've assigned to filter_out the value in filter_in, i.e. the value in the ADC result register and it stays in -2048 whether I change the  voltage in the ADC port or not,  which i suppose may be a sign that the CLA isn't reading the right register or doesn't have access permission.  I've tried this on another board that uses the F280049 and obtained similar results.

       

  • Ok, I partially solved it, I don't know why the preset register addresses in the header files don't work. During the debug session, I acceded the exact register where the adc result is stored, and used it:

    filter_in=*(uint16_t*)(0xB00);

    instead of

    filter_in  = AdcaResultRegs.ADCRESULT0;

  • Maybe do a check on the link file, I guess.

  • Daniel Bernal Galeano said:
    filter_in  = AdcaResultRegs.ADCRESULT0;

    The mapping of this register is done in the f28004x_headers_nonbios.cmd file.  Make sure this is included in your project. 

    PAGE 1:    /* Data Memory */
    
       ADCA_RESULT   : origin = 0x000B00, length = 0x000020
       ADCB_RESULT   : origin = 0x000B20, length = 0x000020
    
    .....
    
    
       AdcaResultFile        : > ADCA_RESULT,   PAGE = 1
       AdcbResultFile        : > ADCB_RESULT,   PAGE = 1

  • Daniel,

    Please let me know if this thread is resolved?  If not, please provide information on what is not working.  If you have a different, but related question, please use the "ask a related question" button.

    Regards

    Lori