2025-01-28 10:11 PM
Hi
I need to flash both the cores of stm32h745zit3. Tried to flash the code using STMCube ide. But after reset pin pressed, cm4 is not getting run. Using ide i run both cores separately. And using programmer tried to load hex separately but it doesn't work. Are there any additional settings required?
Above is the settings used in programmer.
Thanks in advance
2025-01-28 11:07 PM
Hello,
How did you know CM4 was not running?
which example and which board are you using?
2025-01-28 11:29 PM - last edited on 2025-01-29 12:11 AM by SofLit
Hi
I am using board developed by us with stm32h745. In both cores 2 different applications are loaded, in cm7 GPIO toggle and ethernet data send, while in cm4 data communication over UART. But after pressing reset button, ethernet communication and UART application (send some data at startup) doesn't work.
Also some data is being transferred between both cores, to do so some memory is allocated for the same. and for that linker and code updated as below:
MEMORY
{
RAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 512K
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K /* Memory is divided. Actual start is 0x08000000 and actual length is 2048K */
DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
/* ETH_CODE: change offset & reduce size of RAM_D2 to not collide with M4 */
/* SHARED_MEMORY (xrw) : ORIGIN = 0x30020000, LENGTH = 3K*/
RAM_D2 (xrw) : ORIGIN = 0x30020BB9, LENGTH = 157K
RAM_D3 (xrw) : ORIGIN = ORIGIN = 0x38000000, LENGTH = 64K*/
ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K
}
#define LWIP_RAM_HEAP_POINTER 0x30020BB9//0x30020000
and
void MPU_Config(void)
{
MPU_Region_InitTypeDef MPU_InitStruct = {0};
/* Disables the MPU */
HAL_MPU_Disable();
/** Initializes and configures the Region and the memory to be protected
*/
MPU_InitStruct.Enable = MPU_REGION_ENABLE;
MPU_InitStruct.Number = MPU_REGION_NUMBER0;
MPU_InitStruct.BaseAddress = 0x0;
MPU_InitStruct.Size = MPU_REGION_SIZE_4GB;
MPU_InitStruct.SubRegionDisable = 0x87;
MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
MPU_InitStruct.AccessPermission = MPU_REGION_NO_ACCESS;
MPU_InitStruct.DisableExec = MPU_INSTRUCTION_ACCESS_DISABLE;
MPU_InitStruct.IsShareable = MPU_ACCESS_SHAREABLE;
MPU_InitStruct.IsCacheable = MPU_ACCESS_NOT_CACHEABLE;
MPU_InitStruct.IsBufferable = MPU_ACCESS_NOT_BUFFERABLE;
HAL_MPU_ConfigRegion(&MPU_InitStruct);
/** Initializes and configures the Region and the memory to be protected
*/
MPU_InitStruct.Number = MPU_REGION_NUMBER1;
MPU_InitStruct.BaseAddress = 0x30020000;//0x30020BB9;//0x30021000;
MPU_InitStruct.Size = MPU_REGION_SIZE_128KB;
MPU_InitStruct.SubRegionDisable = 0x0;
MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL1;
MPU_InitStruct.AccessPermission = MPU_REGION_FULL_ACCESS;
MPU_InitStruct.IsShareable = MPU_ACCESS_NOT_SHAREABLE;
HAL_MPU_ConfigRegion(&MPU_InitStruct);
/** Initializes and configures the Region and the memory to be protected
*/
MPU_InitStruct.Number = MPU_REGION_NUMBER2;
MPU_InitStruct.BaseAddress = 0x30040000;
MPU_InitStruct.Size = MPU_REGION_SIZE_512B;
MPU_InitStruct.TypeExtField = MPU_TEX_LEVEL0;
MPU_InitStruct.IsShareable = MPU_ACCESS_SHAREABLE;
MPU_InitStruct.IsBufferable = MPU_ACCESS_BUFFERABLE;
HAL_MPU_ConfigRegion(&MPU_InitStruct);
/* Enables the MPU */
HAL_MPU_Enable(MPU_PRIVILEGED_DEFAULT);
}
2025-01-29 12:10 AM
Hello,
First please use </> button to paste your code as stated in this link. I'm editing your post.
Second, the issue still not clear. For now forget about your application with ethernet and UART. If you create a simple example and toggle a LED with CM4, do you succeed with it?
2025-01-29 12:23 AM
No, that too doesn't work.
I made a modification to below function by commenting while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {}, but don't understand the impact. now after reset button pressed both cores starts running.
void SystemClock_Config(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
/** Supply configuration update enable
*/
HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY);
/** Configure the main internal regulator output voltage
*/
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE3);
// while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {}
/** Initializes the RCC Oscillators according to the specified parameters
* in the RCC_OscInitTypeDef structure.
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLM = 4;
RCC_OscInitStruct.PLL.PLLN = 24;
RCC_OscInitStruct.PLL.PLLP = 2;
RCC_OscInitStruct.PLL.PLLQ = 6;
RCC_OscInitStruct.PLL.PLLR = 2;
RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1VCIRANGE_2;
RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1VCOMEDIUM;
RCC_OscInitStruct.PLL.PLLFRACN = 0;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
/** Initializes the CPU, AHB and APB buses clocks
*/
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2
|RCC_CLOCKTYPE_D3PCLK1|RCC_CLOCKTYPE_D1PCLK1;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSE;
RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.AHBCLKDivider = RCC_HCLK_DIV1;
RCC_ClkInitStruct.APB3CLKDivider = RCC_APB3_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_APB1_DIV1;
RCC_ClkInitStruct.APB2CLKDivider = RCC_APB2_DIV1;
RCC_ClkInitStruct.APB4CLKDivider = RCC_APB4_DIV1;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK)
{
Error_Handler();
}
}
2025-01-29 12:26 AM
For now my doubt goes to the power configuration. As it's your own board, what is the power configuration you have set on the board SMPS or LDO by hardware? knowing that you set it to LDO by software:
HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY);
2025-01-29 01:18 AM - edited 2025-01-29 01:25 AM
LDO by hardware
Also, earlier i used shared memory location at start of RAM_D2(0x30020000) with 3k size and RAM_D2 starts at
0x30020BB9
and now in working code i use start of RAM_D3(0x38000000) with size 3k.