28335 ADC External Reference

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Deal All,

In our board we use Delfino 28335. For ADC we use 2.048V external ADC. 

In solidThinking Embedded is it possible to select external reference for ADC?

 

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited March 2017

    Hi,

     

    Here's a link to the TMS320x2833x Analog-to-Digital Converter Module Technical Reference.

    http://www.ti.com/lit/ug/spru812a/spru812a.pdf

     

    Page 43 describes the ADC Reference Select Register. You should be able to create an external write to this register from within your diagram to set bits 15-14 to 01, selecting an external 2.048V reference.

     

    Use the embedded block Extern Definitions as shown in the attached diagram to write to the ADC reference selection register as shown within the Initialize block. It looks like the base address for the ADC is 0x0B00, but you should verify this yourself and change ADC_BASE to the correct ADC base address the ADC_REF_REGISTER definition block.

     

    Define your own ADC_REF_REGISTER:

    #define ADC_REF_REGISTER *((volatile unsigned short *)(ADC_BASE+0x1C))

     

    Since bits 13-0 must be preserved, we read-modify-write the value of the register to clear bits 15-14 without changing bits 13-0.

    ADC_REF_REGISTER &= 0x3FFF

     

    Then we set the new value (01) of bits 15-14, selecting the external 2.048V reference, into the register with another read-modify-write.

    ADC_REF_REGISTER |= 0x4000

     

    After you Tools->Code Gen, it's often interesting to view the generated C code. You should be able to find the C statements generated from the External Definition blocks described above.

     

    The blocks included in the attached diagram must be copied into your existing F28335 diagram which has a Embedded->Delfino->F28x Config Block.

     

    Tom

     

    Corrected attached diagram

     

     

    <?xml version="1.0" encoding="UTF-8"?>F28335_Peripheral Frame 0 Registers.PNG

    Unable to find an attachment - read this blog