FRDM-MCXN947 LPTMR0 12MHz clock issue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FRDM-MCXN947 LPTMR0 12MHz clock issue

Jump to solution
2,791 Views
spgeorge2006
Contributor I

I am using a FRDM-MCXN947 board with the MCU expresso SDK and am trying to get LPTRM0 to be clocked at 12MHz.

I have successfully run the lptmr_cm33_core0 demo project which runs at 16KHz.

I modified the example as follows:

1 - Change the system clock to be the FRO12M clock (I don't think this is required but I want to run the system at 12MHZ to save power).

void BOARD_InitBootClocks(void)
{
// BOARD_BootClockPLL150M();
BOARD_BootClockFRO12M();
}

2 - add the line lptmrConfig.prescalerClockSource = kLPTMR_PrescalerClock_0; to select the 12MHz clock. Based on table 463 from the manual

spgeorge2006_0-1744880478717.pngspgeorge2006_0-1744880478717.png

LPTMR_GetDefaultConfig(&lptmrConfig);
lptmrConfig.prescalerClockSource = kLPTMR_PrescalerClock_0;
/* Initialize the LPTMR */
LPTMR_Init(DEMO_LPTMR_BASE, &lptmrConfig);

3 - change LPTMR_SOURCE_CLOCK define to 12000000 to keep the example timings the same

#define LPTMR_SOURCE_CLOCK (12000000)//(16000)

I then ran the example and expected it to run the same as before but using the 12MHz clock, unfortunately the timer does not seem to be counting up. I confirmed this by opening a register view in the debugger and typing a value into the CNR register. On the working example this caused the CNR to update with the current count value, on the 12MHz version the CNR value stays at 0.

The registers look like they are set up correctly:

spgeorge2006_1-1744881104141.pngspgeorge2006_1-1744881104141.png

I assume I am missing a step somewhere but I have read through the manual and cannot see anything in the syscon register or anywhere else that I need to do to select the LPTMR0 clock.

If anyone can tell me what I am doing wrong it would be appreciated.

Labels (3)
0 Kudos
Reply
1 Solution
2,670 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @spgeorge2006 

You can use config tool to set  the system clock to 12MHz.

Harry_Zhang_0-1745923090539.pngHarry_Zhang_0-1745923090539.png

And then add  CLOCK_SetupClockCtrl(kCLOCK_FRO12MHZ_ENA);

Harry_Zhang_1-1745923191678.pngHarry_Zhang_1-1745923191678.png

You can try.

BR

Harry

View solution in original post

0 Kudos
Reply
6 Replies
2,614 Views
yyjekekr
Contributor I

Created by Alexey Pajitnov in 1984 at the Soviet Academy of Sciences, Tetris revolutionized gaming forever. This ingenious puzzle game featuring falling geometric blocks ("tetrominoes") became the first video game to bridge East-West relations during the Cold War.

Tags (1)
0 Kudos
Reply
2,680 Views
spgeorge2006
Contributor I

Hi @Harry_Zhang , 

thanks for your reply sorry i didn't respond sooner but I have been out of the office.

I can set the system clock to 12MHz, the issue I was having was that when I set the system clock to 12MHz and set LPTMR0 to use the 12MHz clock the LPTMR does not seem to count. Can you provide me with instructions for how to get the system and the LPTMR running off the 12MHz clock? or tell me what I have done wrong based on the information I gave in my original post?

reagrds,

Simon

0 Kudos
Reply
2,408 Views
yyjekekr
Contributor I

Di sản vượt thời gian của Tetris: Tại sao trò chơi giải đố này vẫn hấp dẫn hàng triệu người

Trải nghiệm sự kỳ diệu của Tetris - trò chơi đã chiếm trọn trái tim qua nhiều thế hệ. Từ khởi đầu khiêm tốn đến hiện tượng toàn cầu, hãy khám phá lý do tại sao kiệt tác giải đố này vẫn tiếp tục mê hoặc người chơi trên toàn thế giới.  

 

 

Lịch sử tóm tắt của Tetris

Từ nước Nga Xô Viết đến hiện tượng toàn cầu

Được Alexey Pajitnov tạo ra vào năm 1984 tại Viện Hàn lâm Khoa học Liên Xô, Tetris đã cách mạng hóa trò chơi mãi mãi. Trò chơi giải đố khéo léo này có các khối hình học rơi ("tetrominoes") đã trở thành trò chơi điện tử đầu tiên thu hẹp quan hệ Đông-Tây trong Chiến tranh Lạnh.    

Trò chơi định nghĩa lại trò chơi di động

  • Hơn 35 triệu máy Game Boy đã được bán
  • Hơn 100 triệu hộp Tetris  được phân phối trên toàn thế giới
  • Ước tính có hơn 5 tỷ người chơi  trên mọi nền tảng

Tại sao Tetris vẫn tồn tại: Tâm lý của sự hoàn hảo

Lợi ích về nhận thức được khoa học chứng minh

  1. Cải thiện khả năng suy luận không gian  (tăng 20% ​​trong các nghiên cứu)
  2. Giảm căng thẳng thông qua kích hoạt "trạng thái dòng chảy"
  3. Tăng cường trí nhớ thông qua nhận dạng mẫu
 

 

Tetris hiện đại: Vượt ra ngoài những khối cơ bản

Thể thao điện tử Tetris cạnh tranh

Giải vô địch thế giới Tetris cổ điển

  • Ghi được hơn 1.000.000 điểm trong các giải vô địch
  • 20+ dòng được xóa mỗi phút bởi các chuyên gia
  • Thời gian phản ứng 0,15 giây từ những người chơi hàng đầu

Ứng dụng điều trị

  • Hiệu quả điều trị PTSD
  • Hỗ trợ phục hồi chứng nghiện
  • Duy trì nhận thức cho dân số già

Trải nghiệm Tetris ngay hôm nay

Sẵn sàng tham gia cùng hàng triệu người chơi trên toàn thế giới? Truy cập Tetris.one để có trải nghiệm chơi game tuyệt đỉnh.  

0 Kudos
Reply
2,671 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @spgeorge2006 

You can use config tool to set  the system clock to 12MHz.

Harry_Zhang_0-1745923090539.pngHarry_Zhang_0-1745923090539.png

And then add  CLOCK_SetupClockCtrl(kCLOCK_FRO12MHZ_ENA);

Harry_Zhang_1-1745923191678.pngHarry_Zhang_1-1745923191678.png

You can try.

BR

Harry

0 Kudos
Reply
2,626 Views
spgeorge2006
Contributor I

Hi @Harry_Zhang ,

Thanks that was the answer, the clock is running now.

best wishes,

Simon

0 Kudos
Reply
2,758 Views
Harry_Zhang
NXP Employee
NXP Employee

Hi @spgeorge2006 

If you want to set system clock to 12M,

You can use the config tool.

Harry_Zhang_0-1745294002637.pngHarry_Zhang_0-1745294002637.png

And i tested it.

It can work.

BR

Harry

 

 

0 Kudos
Reply