2270807_zh-CN

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

2270807_zh-CN

2270807_zh-CN

MM9z1J638D 无法从 PTBx 的定时唤醒中唤醒

您好,


我在使用内部路由到定时器通道的 PTBx 时遇到了一个与周期性唤醒有关的问题。我按照数据手册配置了寄存器,但仍无法唤醒 MCU。我附上了我的代码中与配置相关的部分。


此外,由LIN和Ah计数器触发信号的唤醒已被证实有效。只是定时唤醒不起作用。感谢您的帮助。


谢谢!


#define  Wakeup_counter  (unsigned int) 5*1000 // counter value in terms of ALFCLK (1ms by default)
char Wakeup_counter_hi = (char) ((Wakeup_counter & 0xFF00U) >> 8); // get the high byte
char Wakeup_counter_lo = (char) ((Wakeup_counter & 0x00FFU) >> 0); // get the low byte

// config to wakeup if certain time is elapsed after in sleep mode
			    B_TSCR1_TEN = 0; // disable the timer to setup timer
			    B_TCNT 		= 0x0000U; // reset counter 

				B_TIOS_IOS1 = 1; // Timer channel 1 acts as an output compare to allow TC1 write	
				/*				Timer clock selection to be Timerclk/1 see table 647*/
				B_TSCR2_PR0 = 0;
				B_TSCR2_PR1 = 0;
				B_TSCR2_PR2 = 0;




				B_TC1Hi      = Wakeup_counter_hi; // compare register needs to write the high byte before low byte
				B_TC1Lo      = Wakeup_counter_lo;

				B_GPIO_CTL = B_GPIO_CTL_DIR1_MASK | B_GPIO_CTL_DIR1M_MASK; // set PTB1 to output
				B_GPIO_CTL = B_GPIO_CTL_PE1_MASK|B_GPIO_CTL_PE1M_MASK; // PTB1 enable mask enabled PTB1 enabled
				B_GPIO_IN1_TCAP1 = 0; // PTB1 input buffer disconnected from Timer channel 1 - input capture
				B_GPIO_OUT1_TCOMP1 = 1; // Timer channel 1 - output compare connected to PTB1 output buffer OR gate (needs to be configured to allow OC to generate a system wakeup)

				B_PCR_WUEH_WUPTB1 = 1;										// enable PTB1 as the internal timed wake up source
 ADCLpEnable();
				PCREnterSleepMode();

Re: MM9z1J638D cannot wake up from Timed wakeup by PTBx

嗨,@WWsmp

TEN=1时,能否使用 CFORC 来强制初始电平 ?

请参阅此主题:

MM9Z1_638 唤醒功能有什么问题?- 恩智浦社区


BR,丹尼尔

Re: MM9z1J638D cannot wake up from Timed wakeup by PTBx

这让它成功了。它现在可以自动唤醒了。

现在唯一的问题是,它似乎从唤醒开始就进入了 _Startup 函数,而不是自动进入 main()。我必须再次手动点击 RUN 才能通过。

__EXTERN_C void _Startup(void) {
	__asm {
		LD S, #__SEG_END_SSTACK-1		/* initialize SP */
	}
	DoZeroOut();
	DoCopyDown();
#ifdef __cplusplus
	__static_init();
#endif
	main();
}

タグ(1)
評価なし
バージョン履歴
最終更新日:
‎01-08-2026 05:18 AM
更新者: