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.
Tool/software:
Hello,
I am currently working on a project that uses COMPDAC8x_OUT and OPA functions. I want to use COMP_DAC as an output and feed it to the OPA as an input. However, no matter how I configure the OPA and write the code, there is no response.
When I use the DAC function as the input for the OPA instead of COMPDAC8, the OPA works correctly. But due to pin requirements, I must use COMP_DAC8.
I found a related function in the sample code called "opa_dac8_output_buffer." However, when I use this example, I still don't see any output from the OPA. I tried modifying the example and wrote a test method using the same approach, but it still doesn't work. The OPA still has no output.
As for the environment settings, I did not make any changes.
Could you please tell me if I made any mistakes in the code or if there are any environment settings that need to be changed?
Thank you.
#include "ti_msp_dl_config.h" /* * DAC8 Reference Voltage in mV * Adjust this value according to the internal VREF configuration. */ #define COMP_0_INST_REF_VOLTAGE_mV (3300) /* * DAC8 static output voltage in mV. * Adjust output as needed. */ #define COMP_0_INST_DAC8_OUTPUT_VOLTAGE_mV (1000) uint32_t list[]={ 2048, 2447, 2831, 3185, 3496, 3750,3940, 4056, 4095, 4056, 3940, 3750, 3496, 3185, 2831, 2447, 2048, 1648,1264, 910, 599, 345, 155, 39, 0,39, 155, 345, 599, 910, 1264, 1648 }; uint16_t count; uint32_t dacValue; int main(void) { // uint32_t dacValue; SYSCFG_DL_init(); /* * Set output voltage: * DAC value (8-bits) = DesiredOutputVoltage x 255 * ----------------------- * ReferenceVoltage */ // dacValue = (COMP_0_INST_DAC8_OUTPUT_VOLTAGE_mV * 255) / // COMP_0_INST_REF_VOLTAGE_mV; while(1){ dacValue = list[count++]>>4; DL_COMP_setDACCode0(COMP_0_INST, dacValue); DL_COMP_enable(COMP_0_INST); DL_OPA_enable(OPA_0_INST); if(count >= 32){ count = 0; } } // while (1) { // __WFI(); // } }
Hello Hsu,
1). Firstly, you can check whether the input channel of OPA is correct.
2). Secondly, if you just download the example code "opa_dac8_output_buffer" into M0 without any modification, can you see the output of OPA? If you used the G3507 LaunchPad, please remember to unplug the jumper cap of PA22 because on LaunchPad, PA22 is connected to a lighter sensor on default.
Best Regards,
Janz Bai
Hi, Janz Bai,
Thank you for your reply. I have successfully overcome the issue. I made a small mistake. It turns out that COMP and OPA are part of the same group. This means that selecting COMP0 corresponds to OPA0, and selecting COMP1 must correspond to OPA1. At least, this is the conclusion I have reached from my current testing. If I am mistaken, please help me correct it. Thank you.
Hello Hsu,
Yes, you are right. In our TRM, you can find this figure and description.
Best Regards,
Janz Bai