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.

[参考译文] MSP430FR2355:MSPFR2355 ADC 触发器出现 Timer1问题

Guru**** 2519150 points


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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1065581/msp430fr2355-mspfr2355-adc-trigger-with-timer1-issues

器件型号:MSP430FR2355

大家好

我们正在开发一个系统、该系统需要 ADC 在比较器触发后的精确周期后启动转换。 这一次在我们中间是很小的。

为此、我们打算设置 Timer1.CC1以触发 ADC。 当 COMP (比较器)触发其中断时、定时器启动。 Timer 1.CC1‘“Form”(表单)信号如下所示:

 

    _________________
_____|            _________________________________

Dly | TRG 脉冲 |到下一个测量的延迟

由于计时器 CC1 (用于触发 ADC)有两个输出(一个 TB1.1A 至 P2.0、一个 TB1.1B 至 ADC)、因此我们已将另一个导向 P2.0 并测量示波器、以确保我们获得预期的正确波形。  

 因此、我们通过计时器的信号确认一切正常、但我们得到以下行为:

  • ADC 仅触发一次、但看起来与脉冲的上升沿不同步
  • ADC 始终保持繁忙状态。

其他注意事项包括:

  • ADC 在定期软件启动(更改粗调触发源)时工作正常。
  • 如果我们设置软件启动并且不进行软件触发、则 ADC 永远不会触发(如预期的那样)
  • 改变正脉冲的长度没有什么不同

我担心的一个问题是 TB1.1A (测量值)与 TB1.1B 相同?

ADC 为何会保持忙碌?

ADC 设置代码如下:

此致

void InitialiseADCConverter(void)
{
    ADCCTL0 &= ~ADCENC;                                       // ADC Disabled to allow setup

    ADCCTL0 = ADCSHT_2;                                       // S&H=16 ADC clks
    ADCCTL0 |= ADCON;                                         // Turn ADC On
    //ADCCTL0 |= ADCMSC;                                      // Multiple conversions

    ADCCTL1 = ADCSHS1;                                        // Sample an hold trigger will come from Timer1 CCR1
    ADCCTL1 |= ADCSHP;                                        // Use the sampling Timer
    // Default is no inversion (bit ADCISSH)
    ADCCTL1 |= ADCDIV0;                                       // We will divide the clock by 2 to get a 4MHz ADC clock (Max 6.6MHz for 10 bit)
    ADCCTL1 |= ADCSSEL0 | ADCSSEL1;                           // Select the SMCLK (8MHz)
    //Default is single channel Conversion (ADCCONSEQ0..1)


    //No clock pre-scaler (ADCPDIV0.1)
    ADCCTL2 |= ADCRES_1;                                      // 10-bit conversion results
    // Unsigned Binary result as default (ADCDF)
    // ADC Buffer support 200Ksps as default(ADCSR)
    ADCMCTL0 |= ADCSREF0;                                      // Internal Reference
    // Default input channel is 0 (ADCINCH0..3)

    ADCIE |= ADCIE0;                                          // Enable ADC conv complete interrupt

    ADCCTL0 |= ADCENC;                                         // Enable Conversions
    //ADCCTL0 |= ADCSC                                          // Start an ADC conversion

    //Now we need to sort the reference or the ADC first start will be delayed
    //whilst the ADC waits for the reference to be ready.
    PMMCTL2 = 0; // this will be the 1.2V reference
    PMMCTL2 |= REFBGEN | REFGEN; // Enable the Internal voltage references
    PMMCTL2 |= TSENSOREN; // Enable the temperature sensor.

}

void InitialiseADCConverter(void)
{
    ADCCTL0 &= ~ADCENC;                                       // ADC Disabled to allow setup

    ADCCTL0 = ADCSHT_2;                                       // S&H=16 ADC clks
    ADCCTL0 |= ADCON;                                         // Turn ADC On
    //ADCCTL0 |= ADCMSC;                                      // Multiple conversions

    ADCCTL1 = ADCSHS1;                                        // Sample an hold trigger will come from Timer1 CCR1
    ADCCTL1 |= ADCSHP;                                        // Use the sampling Timer
    // Default is no inversion (bit ADCISSH)
    ADCCTL1 |= ADCDIV0;                                       // We will divide the clock by 2 to get a 4MHz ADC clock (Max 6.6MHz for 10 bit)
    ADCCTL1 |= ADCSSEL0 | ADCSSEL1;                           // Select the SMCLK (8MHz)
    //Default is single channel Conversion (ADCCONSEQ0..1)


    //No clock pre-scaler (ADCPDIV0.1)
    ADCCTL2 |= ADCRES_1;                                      // 10-bit conversion results
    // Unsigned Binary result as default (ADCDF)
    // ADC Buffer support 200Ksps as default(ADCSR)
    ADCMCTL0 |= ADCSREF0;                                      // Internal Reference
    // Default input channel is 0 (ADCINCH0..3)

    ADCIE |= ADCIE0;                                          // Enable ADC conv complete interrupt

    ADCCTL0 |= ADCENC;                                         // Enable Conversions
    //ADCCTL0 |= ADCSC                                          // Start an ADC conversion

    //Now we need to sort the reference or the ADC first start will be delayed
    //whilst the ADC waits for the reference to be ready.
    PMMCTL2 = 0; // this will be the 1.2V reference
    PMMCTL2 |= REFBGEN | REFGEN; // Enable the Internal voltage references
    PMMCTL2 |= TSENSOREN; // Enable the temperature sensor.

}

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

    更新:

    抱歉、第一个 ADC 测量值与计时器输出同步(我的触发器的测量误差)。

    第一个 ADC 触发脉冲工作、但在第二个脉冲上、ADC 会一直处于繁忙状态、并且永远不会完成转换。

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

    您是否在 ISR 中切换 ADCENC (=0、那么=1)? 即使在 CONSEQ=0时、定时器触发也需要此参数[参考用户指南(SLAU445I)第21.2.7.1节、第2段]。 如果您忘记执行此操作、我很确定您会看到此症状。

    ----------

    >ADCCTL2 |= ADCRES_1;// 10位转换结果

    这会设置 ADCRES=3 ("保留")、因为 ADCRES1是预设的[参考 UG 表21-25]。 我认为这不是您的问题、但 可能会在以后引起问题 、请尝试:

    >ADCCTL2 = ADCRES_1;// 10位转换结果

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

    Bruce:您好!

    你是一个顶级的人!!! 非常感谢,我在阅读中错过了这个!!! 非常感谢!!!

    此致

    Tony