cancel
Showing results for 
Search instead for 
Did you mean: 

NUCLEO-H745ZI-Q Bare Metal Default Clock?

zirogravity
Associate II

Hello,

I am following a few examples for bare metal firmware (without HAL or LL) to enable USART. I am using a NUCLEO-H745ZI-Q starting with an empty project. From the users manual I am gathering that the STLink MCU on the board provides a 25MHz (X1) clock (STLK_MCO) to (PH0-MCU/PH1-MCU) into the H745xx dual core MCU. I am focused on working only with the CM4 at the moment and ignoring the CM7.

I have been pretty puzzled on setting the BRR register with the correct USARTDIV value which is making doubt my understanding of which clock is being supplied to the MCU by default? I am also assuming since there is a physical clock (default clock via hardware supplied) that I do not need to configure a clock? I was able to blink an LED via GPIO/PIN clock enables etc... without configuring like a SysTick or something like that. The board also has the 32.768KHz (X3) directly populated to the H745xx pins but I have ignored it for now.

If I use the following code with PeriphClk=25000000 and BaduRate=115200. I am unable to transmit to my terminal (PuTTy) in this case.

 

 

//Set Baud Rate Register BRR
static uint16_t get_uart_bd(uint32_t PeriphClk, uint32_t BaudRate){

	//RM0399 Rev 4: 51.5.7 : Page 2188 USARTDIV=usart_ker_ckpres/(baud) for OVER8='0'
	
	 return (PeriphClk/BaudRate);
}

 

 

If use the following code which was basically a "guess" at BRR~0x217 I am able to transmit to my terminal. In both instances I am only transmitting a single charter.

 

 

 

//Set Baud Rate Register BRR

static uint16_t get_uart_bd(uint32_t PeriphClk, uint32_t BaudRate){


//RM0399 Rev 4: 51.5.7 : Page 2188 USARTDIV=usart_ker_ckpres/(baud) for OVER8='0'

return 0x217; //213 to 249 each work here ...why?

}

 

 

 

I am not sure how much of the rest of my code would be helpful to post but happy to do so. At this point the rest of my code "works" when BRR=0x217 but even if I attempt to back out a clock from 0x217 I get something like 62MHz which is no where to be found on this Nucleo Board especially with bare metal i.e. no code configuration of clock dividers/scalers etc.... The most obvious clock values would be like 8MHz, 16MHz, 25MHz, or 100MHz for this board 8, 16,and 100 would be questionable "out of the box without any configuration code"..

Helping me identify what I am missing here greatly appreciated :)

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

The H7's HSI is 64MHz, it starts / runs from this clock until you get the alternate clock source enabled and PLL working.

You can also set the ratios for the AHB and APB buses.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

3 REPLIES 3

The H7's HSI is 64MHz, it starts / runs from this clock until you get the alternate clock source enabled and PLL working.

You can also set the ratios for the AHB and APB buses.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Thank you @Tesla DeLorean. May I ask where should I have started in the documents to have uncovered this?

Hi @zirogravity 

Table 56. HSI oscillator characteristics in datasheet

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


I'm out of offce with limited access to my emails.
Happy New Year!