2019-09-16 02:59 PM
Hi,
I just got my H745i-DISCO board and started to tinker with ToughGFX right away. I got a test application loaded on the board, but once I disconnected the USB connection and reconnect it (USB connected to STLink USB Port on Nucleo board, power jumper in first position) the STLINK seems not to recognize the MCU anymore. The loaded flash drive contains a "FAIL.txt" file with the following content: "The interface firmware FAILED to reset/halt the target MCU".
When I press and hold the reset button while plugging the USB and releasing it within 2 seconds, the FAIL.txt is not present. Either way, I can't get TouchGFX or STLink Utility to connect to the MCU. I tried all day and only got it to again recognize the MCU once. Then I did a full chip erase with STLink Utility and loaded another application with TouchGFX. Unplugging the USB, plugging it again, same error.
What am I doing wrong? How can I get consistent results?
What I've tried so far:
Any advice is warmly welcome
Best regards
Max
Solved! Go to Solution.
2019-10-11 05:25 PM
SW4STM, arm-gcc.
I am able to build successfully CubeMX generated code as well as the template project from the package you mentioned. SMPS is used in the latter but it doesn't make any difference on debugging. I'll try with that GPIO example, I haven't examined this yet.
2019-10-13 05:26 AM
With GPIO_EXTI example results are exactly the same. CM7 hangs in while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {}
and CM4 gets "Thread #1 (Suspended: Signal: SIGTRAP: Trace/breakpoint trap).
The only difference I noticed is when I generate clean project from CubeMX and leave default clock configuration which is
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 CPU, AHB and APB busses clocks
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
RCC_OscInitStruct.HSIState = RCC_HSI_DIV1;
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
/** Initializes the CPU, AHB and APB busses 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_HSI;
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();
}
}
it somehow works but I still need to click resume on CM4 about 2 times and then it finally reaches the main loop. But in this configuration I've got only CM7@64MHz and CM4@32MHz.
2019-10-13 06:21 AM
Hi,
on the NUCLEO-H745 the SMPS is used (the default config of the board is SMPS. see schematic of the NUCLEO-H745).
The root problem is that you use the LDO " HAL_PWREx_ConfigSupply(PWR_LDO_SUPPLY);".
Unfortunately this is the Code that the CubeMX generates.
Change this to: HAL_PWREx_ConfigSupply(PWR_DIRECT_SMPS_SUPPLY);
Make sure that you don´t use Voltage_Scale_0 and do not configure the CPU Clock higher than 400Mhz.
When this is fixed, first start the CM4 and than the CM7, because the CM7 times out and calls the Error Handler when the CM4 does not go to power down.
Best Regards
Thomas
2019-10-13 06:44 AM
Hi
Actually, the PWR_DIRECT_SMPS_SUPPLY and PWR_REGULATOR_VOLTAGE_SCALE1 are used in H745 Cube package, GPIO example. As I wrote, this leads to the same problem. However I wasn't aware of cores starting sequence and run both of them simultaneously. I will try with that first CM4, second CM7 approach.
2019-10-13 08:24 AM
OK, according to your suggestions I set proper config supply and voltage scale. SystemClock_Config is as follows:
void SystemClock_Config(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
/** Supply configuration update enable
*/
HAL_PWREx_ConfigSupply(PWR_DIRECT_SMPS_SUPPLY);
/** Configure the main internal regulator output voltage
*/
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
while(!__HAL_PWR_GET_FLAG(PWR_FLAG_VOSRDY)) {}
/** Initializes the CPU, AHB and APB busses clocks
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
RCC_OscInitStruct.HSIState = RCC_HSI_DIV1;
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
RCC_OscInitStruct.PLL.PLLM = 4;
RCC_OscInitStruct.PLL.PLLN = 50;
RCC_OscInitStruct.PLL.PLLP = 2;
RCC_OscInitStruct.PLL.PLLQ = 2;
RCC_OscInitStruct.PLL.PLLR = 2;
RCC_OscInitStruct.PLL.PLLRGE = RCC_PLL1VCIRANGE_3;
RCC_OscInitStruct.PLL.PLLVCOSEL = RCC_PLL1VCOWIDE;
RCC_OscInitStruct.PLL.PLLFRACN = 0;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
/** Initializes the CPU, AHB and APB busses 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_PLLCLK;
RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.AHBCLKDivider = RCC_HCLK_DIV2;
RCC_ClkInitStruct.APB3CLKDivider = RCC_APB3_DIV2;
RCC_ClkInitStruct.APB1CLKDivider = RCC_APB1_DIV2;
RCC_ClkInitStruct.APB2CLKDivider = RCC_APB2_DIV2;
RCC_ClkInitStruct.APB4CLKDivider = RCC_APB4_DIV2;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK)
{
Error_Handler();
}
}
Clock configuration is: f_{CPU,1}=400MHz on CM7 and f_{CPU,2}=200MHz on CM4, source: PLL. I flashed the program twice, second time after erasing the chip. Still the same error. I think this might be somehow related to PLL. Default clock configuration in Cube is not using PLL, PWR_LDO_SUPPLY is set instead of PWR_DIRECT_SMPS_SUPPLY and with this I was able to hit the breakpoints in main loops of both cores.
2020-12-28 02:05 AM
Greetings comrade.
A year has passed but I think it will be helpful for other developers if I will tell what solved my problem.
In your case the most likely cause is that your USB cannot feed enough current. Try to use BLUE USB 3 port.
This worked for me and I have had exactly the same problem as you.