如何使用jetson thor的硬件定时器?

我需要使用硬件定时器来实现精准控制管脚输出周期信号,但是在英伟达的网站上没有找到使用案例,只有一个看门狗驱动Linux_for_Tegra/source/kernel/kernel-noble/drivers/clocksource/timer-tegra186.c,由于Jetson thor的TRM资料没有完整介绍如何配置TMR,所以这份代码我无法理解。而且我cat /proc/interrupts 发现tegra186-timer并没有产生中断,所以这个看门狗真的有正常工作吗?

另外我在论坛中找到以下文章

请问以上代码的hrtimer是硬件定时器还是软定时器?因为我需要高实时的硬件定时器,如果是软定时器无法满足我的需要。

Have reference to below topic.

这篇文章使用的是timer-tegra.c这份驱动,但是jetson thor的设备树Linux_for_Tegra/source/hardware/nvidia/t264/nv-public/tegra264.dtsi中没有"nvidia,tegra20-timer" 这样的节点。如果我手动添加,需要配置一个clocks、地址范围和中断号,那么clocks应该可以指向哪个时钟节点呢?而且寄存器地址范围、中断号是否和tegra20的配置相同呢?
以下是tegra20.dtsi的配置:

	timer@60005000 {
		compatible = "nvidia,tegra20-timer";
		reg = <0x60005000 0x60>;
		interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>,
			     <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>,
			     <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>,
			     <GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>;
		clocks = <&tegra_car TEGRA20_CLK_TIMER>;
	};

Looks like the TKE is for TX2 have check below for Orin/Thor.

请问TSC_EDGE_OUT0A、TSC_EDGE_OUT0B、TSC_EDGE_OUT0C、TSC_EDGE_OUT0D是同一个信号发生器多路同时输出吗?也就是假设配置OUT0为30Hz周期,那么OUT0A~D这4根管脚会输出边沿对齐的相同信号吗?

TSC_EDGE_OUT0A usually set with TSC_EDGE_OUT0B/C/D on other TSC pins while same edge out time is required.

Thanks,管脚的问题似乎解决了,但是回到标题本身,因为我需要在触发周期信号时做一些特殊处理,比如记录时间戳,所以我仍然希望使用timer定时器触发硬件中断,那么代码该如何实现呢?

Have a reference to below topic.

@ShaneCCC
但是tsc管脚最多只支持4路信号输出,我需要超过6路定时器,因此我还是知道下tmr定时器中断如何启用?

Suppose you can consider to use GPIO pin for interrupted.

这跟gpio中断有啥关系?我不理解gpio如何满足我的需求。事实上我的硬件需要驱动程序12路设备,需要12路管脚输出周期信号,tsc只有4路,pwm管脚只有6路,其中pwm4固定给风扇,因此无法满足我的需求,所以我需要开发硬件定时器中断功能,稳定输出12路周期信号。

You can use GPIO to generate PWM. Should able found example searching on the internet.

Thanks

很遗憾,你的回答解决不了问题。我只能认为,英伟达thor的定时器代码尚未开发完成,手册也没写完,主打一个“先卖货,剩下的让买家自己开发”

Could you have specific information that you found in TRM but without driver.

Also maybe have much detail request for your use case in English to have internal developer to give advice.

Thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.