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.

[参考译文] CC2340R5-Q1:如何使用 LGPTimer 生成单个精密低电平脉冲

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

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/1634185/cc2340r5-q1-how-to-generate-a-single-precise-low-pulse-using-lgptimer

器件型号: CC2340R5-Q1

TI 团队大家好、

我们使用的是 SDK 9.14。 我们要做的是在严格控制的持续时间内输出一个低电平脉冲。 根据我们的调查、LGPTimer 驱动程序似乎能够做到这一点、因此我们相应地实施并测试了代码。 但是,当我们调用 LGPTimerLPF3_OPEN() 时,端口级别会立即从高到低意外地改变。

我将附上我们使用的代码。 您能否建议使用 LGPTimer 生成单个精确低脉冲的正确方法、并解释调用 LGPTimerLPF3_OPEN () 时端口电平为什么会变为 H→L? 请提供任何指导。

	/* Initial GPIO.output = H */



    LGPTimerLPF3_Params lp_lgpt0_params;

    // Configure LGPTimer
    LGPTimerLPF3_Params_init(&lp_lgpt0_params);
    lp_lgpt0_params.prescalerDiv = 0;

    // Configure channel 2 action (Count=0[GPIO:L] → Count=4800[GPIO:H])
    lp_lgpt0_params.channelProperty[1].action = LGPTimerLPF3_CH_CLR_ON_0_TOGGLE_ON_COMPARE_ONCE;

    // Open driver (GPIO.output = H → L)
    gh_lgpt0_handle = LGPTimerLPF3_open(CONFIG_LGPTIMER_0, &lp_lgpt0_params);

    // GPIO.output = L → H
    LGPTimerLPF3_setChannelOutputLevel(gh_lgpt0_handle, LGPTimerLPF3_CH_NO_1, LGPT_OUTCTL_SETOUT0);

    // Set channel CounterTarget (no use)
    LGPTimerLPF3_setInitialCounterTarget(gh_lgpt0_handle, 4801, false);

     // Set channel CompVal (GPIO.output "L" Time (100us)) */
    LGPTimerLPF3_setInitialChannelCompVal(gh_lgpt0_handle, LGPTimerLPF3_CH_NO_1, 4800, false);

    // Start  the LGPTimer in up once mode
    LGPTimerLPF3_start(gh_lgpt0_handle, LGPTimerLPF3_CTL_MODE_UP_ONCE);

Fig1.png

感谢你的帮助。

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

    嗨、Hiroki-san、

    我认为 H->L 是预期的、因为当 LGPTimerLPF3_OPEN() 写入 C1CFG 寄存器时、通道操作的 CLR_ON_0 部分会立即触发。 由于 LGPT 计数器在计时器空闲时为 0、因此硬件在那一刻将输出驱动为低电平。  

    此致、

    现金

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

    嗨、现金。

    感谢您的答复。

    ]我明白你写了什么。

    您能提供一个具体的代码实现来生成一次性低电平脉冲吗?

    谢谢你。