BOARD_InitBootClocks causes hard fault when put inside the SystemInitHook function

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

BOARD_InitBootClocks causes hard fault when put inside the SystemInitHook function

Jump to solution
1,280 Views
VolcanicCheese
Contributor III

I am currently trying to use the BOARD_sdram to place the global data placement. I have been running into issues trying to implement this. This is currently my understanding of my problem. The project would throw an imprecise data bus error because the SDRAM needs to be initialized before going to the main function. Thus, I put the functions to initialize the SDRAM inside the SystemInitHook function. After doing this, I ran into a hard fault with an imprecise data bus error with the function BOARD_BootClockRun(). I attached the screenshot of the NXP IDE when it throws the hard fault. I was wondering how would I fix this error? and is this the correct step to place global data to the BOARD_sdram? Thank you!

0 Kudos
1 Solution
1,230 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
From my experience, I'd like to suggest you implement the DCD mechanism to initialize the SDRAM prior to ROM jumping to the application image, it's the easiest and most efficient way to solve the issue.
Please give it a try.
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

View solution in original post

5 Replies
1,274 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
I think I need more information about your design, so I was wondering if you can clarify the below inquiries.
1) Did you use the SDRAM as the primary memory in the code project?
2) If yes, you should use the DCD mechanism to initialize the SDRAM prior to ROM jumping to the application image.
3) Please introduce your testing environment, such as IDE, board, etc.
Furthermore, I've not found your attachment, I think you'd better upload it again.
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
1,265 Views
VolcanicCheese
Contributor III

Thank you! Sorry about the upload

To answer your question:

1) I use the BOARD_flash as my primary memory for the project

3) I am using an i. MX RT1020 Evaluation Kit and NXP IDE. It is a project that uses FreeRTOS, LPUART, LPI2C, LPSPI, and power mode-switch drivers. 

Additional info:

The code below is how I attempted to initialize the BOARD_sdram before the program runs main().

__attribute__ ((weak)) void SystemInitHook (void) {
	/* Void implementation of the weak function. */
	/* Init board hardware. */
	BOARD_ConfigMPU();
	BOARD_InitPins();
	BOARD_InitBootClocks();
	/* Set semc clock to 132 MHz */
	CLOCK_InitSysPfd(kCLOCK_Pfd2, 24);
	CLOCK_SetMux(kCLOCK_SemcMux, 1);
	CLOCK_SetDiv(kCLOCK_SemcDiv, 2);
	BOARD_InitDebugConsole();
	BOARD_InitSEMC();
}

I attached the screenshot below.Screenshot.png

0 Kudos
1,249 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
I think you misunderstand my question, I'd like to know whether the SDRAM is primary RAM just as the below figure shows.

jeremyzhou_0-1643264561098.png


Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
1,241 Views
VolcanicCheese
Contributor III

VolcanicCheese_0-1643270544001.png

Sorry about that, SRAM_DTC seems to be the primary RAM being used. Hope that answers your question.

0 Kudos
1,231 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
From my experience, I'd like to suggest you implement the DCD mechanism to initialize the SDRAM prior to ROM jumping to the application image, it's the easiest and most efficient way to solve the issue.
Please give it a try.
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------