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.

  • Resolved

LAUNCHXL-CC2640R2: access comparators

Prodigy 180 points

Replies: 5

Views: 93

Part Number: LAUNCHXL-CC2640R2

Are there any examples out there of how to access and use the comparators on the LAUNCHXL-CC2640R2? I have read the technical documents and looked at the CC2640R2-LAUNCHXL.c file in driver examples and cannot make sense of how to access the comparators. I was only able to find data on COMPB, there is a way to access COMPA?

  • Hello David,

    Apologize for the delay! I have asked my colleague to look into this. Give us couple of days time to get back as Monday is a holiday.

    Thanks,

    Sai

  • Genius 9590 points

    In reply to Sai Reddy:

    Hi,

    Here is a low-level driver for Comp-A (interrupt driven). You can find the documentation for APIs and register fields here:

    http://dev.ti.com/tirex/explore/node?node=ACPe.y.AhNA4diU86GpL3w__krol.2c__LATEST

    Interrupt callback: 

    void AUXCompAIntHandler(void){

    //
    // Clear the interrupt
        HWREG(AUX_EVCTL_BASE + EVTOMCUFLAGSCLR) |= AUX_COMPA;
    //
    // Set an interrupt flag to indicate an interrupt has occurred.
    //
        g_bGPIOIntFlag = true;
    }

    CompA_setup(void){

    //
    // Turn on clock for AUX_ADI and SOC_AUXCTRL
    //
    // Enable clock for required AUX modules

    AUXWUCClockEnable(AUX_WUC_MODCLKEN0_AUX_ADI4_M);

    // this will not allow latching
    HWREG(AUX_WUC_BASE + AUX_WUC_O_AUXIOLATCH) = AUX_WUC_AUXIOLATCH_EN_TRANSP;


    // Enable COMPA
    //
    HWREG(AUX_ADI4_BASE + ADI_4_AUX_O_COMP) = ADI_4_AUX_COMP_COMPA_EN;
    //
    // Connect external reference and input to COMPA
    //

    HapiSelectCompARef(COMPA_IN_AUXIO2);   //reference - DIO28
    HapiSelectCompAInput(COMPA_IN_AUXIO1); //input - DIO29

    IntEnable(INT_AUX_COMPA); // enable interrupt

    }

  • In reply to FI:

    Thank you for the driver. I'm having trouble figuring out what drivers to add. Whenever I find drivers to add, I get sucked down a black hole of additional drivers to add. 

  • Genius 9590 points

    In reply to David Wood1:

    Hi,

    I think it would be best to add and build the entire driverlib to the project.

    Are you using an example from SDK and adding CompA to it?

    Thanks,

  • Genius 9590 points

    In reply to David Wood1:

    I forgot to mention. Have you tried using Sensor Controller Stuido to configure and use CompA?

    Please see the link here: http://www.ti.com/tool/SENSOR-CONTROLLER-STUDIO 

    You will find code examples inside the Code Language Reference.

    Thanks

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.