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.

[参考译文] MSPM0C1104:添加了热传感器的 ADC 设置、但无法正常工作

Guru**** 2465890 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1474350/mspm0c1104-add-adc-settings-for-thermal-sensor-but-not-working

器件型号:MSPM0C1104

工具与软件:

根据"adc12_single_conversion"示例、我将 ADC 设置(PA27)添加到我的项目中。  

但我无法接收到任何 ADC12_0_INST_IRQHandler 事件、因此我无法从热传感器获得任何数据。

int main(void) {

    /* Get calibrated ADC offset - workaround for ADC_ERR_06 */
    gADCOffset = DL_ADC12_getADCOffsetCalibration(ADC12_0_ADCMEM_0_REF_VOLTAGE_V);
    NVIC_EnableIRQ(ADC12_0_INST_INT_IRQN);
    gCheckADC = false;

    ...
}


void ADC12_0_INST_IRQHandler(void) {
    switch (DL_ADC12_getPendingInterrupt(ADC12_0_INST)) {
        case DL_ADC12_IIDX_MEM0_RESULT_LOADED:
        gCheckADC = true;
        break;
    default:
        break;
    }
}

我尝试更改 syscfg、但仍然无法正常使用、您能帮助我解决这个问题吗? 谢谢你。

(我无法上传.syscfg、因此我要将内容粘贴到此处。)

/**
 * These arguments were used when this file was generated. They will be automatically applied on subsequent loads
 * via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments.
 * @cliArgs --device "MSPM0C110X" --part "Default" --package "WQFN-20(RUK)" --product "mspm0_sdk@2.02.00.05"
 * @v2CliArgs --device "MSPM0C1104" --package "WQFN-20(RUK)" --product "mspm0_sdk@2.02.00.05"
 * @versions {"tool":"1.22.0+3893"}
 */

/**
 * Import the modules used in this configuration.
 */
const ADC12  = scripting.addModule("/ti/driverlib/ADC12", {}, false);
const ADC121 = ADC12.addInstance();
const Board  = scripting.addModule("/ti/driverlib/Board");
const GPIO   = scripting.addModule("/ti/driverlib/GPIO", {}, false);
const GPIO1  = GPIO.addInstance();
const GPIO2  = GPIO.addInstance();
const I2C    = scripting.addModule("/ti/driverlib/I2C", {}, false);
const I2C1   = I2C.addInstance();
const PWM    = scripting.addModule("/ti/driverlib/PWM", {}, false);
const PWM1   = PWM.addInstance();
const SYSCTL = scripting.addModule("/ti/driverlib/SYSCTL");
const VREF   = scripting.addModule("/ti/driverlib/VREF");

/**
 * Write custom configuration values to the imported modules.
 */
ADC121.$name               = "ADC12_0";
ADC121.sampClkSrc          = "DL_ADC12_CLOCK_ULPCLK";
ADC121.sampClkDiv          = "DL_ADC12_CLOCK_DIVIDE_8";
ADC121.adcPin0Config.$name = "ti_driverlib_gpio_GPIOPinGeneric4";

Board.peripheral.$assign          = "DEBUGSS";
Board.peripheral.swclkPin.$assign = "PA20";
Board.peripheral.swdioPin.$assign = "PA19";

GPIO1.$name                          = "GPIO_LEDS";
GPIO1.associatedPins.create(2);
GPIO1.associatedPins[0].$name        = "USER_LED_1";
GPIO1.associatedPins[0].initialValue = "SET";
GPIO1.associatedPins[0].assignedPin  = "22";
GPIO1.associatedPins[1].assignedPort = "PORTA";
GPIO1.associatedPins[1].$name        = "USER_ERROR";
GPIO1.associatedPins[1].assignedPin  = "17";
GPIO1.associatedPins[1].pin.$assign  = "PA17";

GPIO2.$name                         = "I2C_IRQ";
GPIO2.associatedPins[0].$name       = "PIN_0";
GPIO2.associatedPins[0].direction   = "INPUT";
GPIO2.associatedPins[0].interruptEn = true;
GPIO2.associatedPins[0].polarity    = "FALL";
GPIO2.associatedPins[0].pin.$assign = "PA16";

I2C1.$name                             = "I2C";
I2C1.basicEnableController             = true;
I2C1.advControllerTXFIFOTRIG           = "BYTES_1";
I2C1.advAnalogGlitchFilter             = "DISABLED";
I2C1.intController                     = ["NACK","RXFIFO_TRIGGER","RX_DONE","TX_DONE"];
I2C1.peripheral.$assign                = "I2C0";
I2C1.peripheral.sdaPin.$assign         = "PA0";
I2C1.peripheral.sclPin.$assign         = "PA11";
I2C1.sdaPinConfig.hideOutputInversion  = scripting.forceWrite(false);
I2C1.sdaPinConfig.onlyInternalResistor = scripting.forceWrite(false);
I2C1.sdaPinConfig.passedPeripheralType = scripting.forceWrite("Digital");
I2C1.sdaPinConfig.$name                = "ti_driverlib_gpio_GPIOPinGeneric0";
I2C1.sclPinConfig.hideOutputInversion  = scripting.forceWrite(false);
I2C1.sclPinConfig.onlyInternalResistor = scripting.forceWrite(false);
I2C1.sclPinConfig.passedPeripheralType = scripting.forceWrite("Digital");
I2C1.sclPinConfig.$name                = "ti_driverlib_gpio_GPIOPinGeneric1";

PWM1.$name                      = "PWM_0";
PWM1.clockPrescale              = 256;
PWM1.peripheral.$assign         = "TIMG14";
PWM1.peripheral.ccp0Pin.$assign = "PA23";
PWM1.peripheral.ccp1Pin.$assign = "PA24";
PWM1.PWM_CHANNEL_0.$name        = "ti_driverlib_pwm_PWMTimerCC0";
PWM1.PWM_CHANNEL_1.$name        = "ti_driverlib_pwm_PWMTimerCC1";
PWM1.ccp0PinConfig.$name        = "ti_driverlib_gpio_GPIOPinGeneric2";
PWM1.ccp1PinConfig.$name        = "ti_driverlib_gpio_GPIOPinGeneric3";

SYSCTL.clockTreeEn = true;

VREF.profile = "INT_1_4_V";

const ProjectConfig              = scripting.addModule("/ti/project_config/ProjectConfig", {}, false);
ProjectConfig.migrationCondition = true;

/**
 * Pinmux solution for unlocked pins/peripherals. This ensures that minor changes to the automatic solver in a future
 * version of the tool will not impact the pinmux you originally saw.  These lines can be completely deleted in order to
 * re-solve from scratch.
 */
ADC121.peripheral.$suggestSolution           = "ADC0";
ADC121.peripheral.adcPin0.$suggestSolution   = "PA27";
GPIO1.associatedPins[0].pin.$suggestSolution = "PA22";


  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我使用 "adc12_single_conversion"示例并将 ADC 引脚从 PA25更改为 PA27 (连接到热传感器)。

     也没有任何 ADC12_0_INST_IRQHandler 事件。  

    我的 HW 布局是这样的

    (MCU) PA27/20)--- [1.5V]<--[热敏传感器]-->[0V]

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Cecilia:

    我们已向现场团队提供了完整的代码。 他们会为您发送代码。

    此致、

    Zoey