2019-07-26 12:57 PM
I have a Nucleo-F411RE and can debug and program ok (using arm cross gcc, eclipse, OpenOCD) and everything works fine.
However, If I just power it but don't debug through eclipse, the board doesn't do anything. LD1 and LD3 are solid red.
My guess is that when I'm debugging it isn't actually flashing the board, or for some reason it isn't jumping to main from the reset vector when I'm not debugging.
Not sure how to approach this.
Maybe related, maybe not... I tried to use the ST-LINK Utility to flash the output file, but I get a No ST_LINK detected error and it won't connect.
EDIT
It looks like the program counter when I start to debug at main is 0x8002810 so it looks like it is running from flash. I just read about the boot pins so I have connected boot0 to gnd but see no difference.
2019-07-26 03:03 PM
Check obvious destinations for death like Error_Handler() and HardFault_Handler()
Check firmware versions in ST-LINK, some older (v25-26) would hold device in reset.
2019-07-30 02:10 PM
I checked, the firmware was v29, I upgraded to v33 but I have the same issue. As best as I can tell it isn't hitting an error or abort function.. i"m trying to see if I can connect with openOCD without downloading code so I can look in memory to see what's going on.
2019-07-30 05:50 PM
Before main() it usually goes through SystemInit(), check clocks, and flash wait states.
2019-07-31 01:29 PM
I was able to load just the symbols and not a new flash image, and also not run to main and just do a reset and let it run... it looks like it's failing a check in HAL_RCC_OscConfig()
if ((RCC_OscInitStruct->PLL.PLLState) != RCC_PLL_NONE)
Where my PLLState is RCC_PLL_ON... I used STMS Cube to generate code.... maybe I have a setting in correct and don't need PLL on?
I did a quick look and couldn't see a way to turn the pll off.... I'll dig into it more.
2019-08-04 12:10 PM
It looks like it may be related to adding FreeRTOS to the project. I can do a simple blink led program and it behaves as expected when I remove power and plug it back in, but when I add freertos to the project it hangs..
2019-08-04 03:52 PM
> It looks like it may be related to adding FreeRTOS to the project.
Then it can be bad HAL timer setting. HAL initially needs time source for SystemClock_Config().
By default it uses SysTick. But with FreeRTOS you have to use some timer for HAL timer instead of the SysTick,
because FreeRTOS wants SysTick for itself.
Have you selected a(nother) timer when Cube prompted?
-- pa
2019-08-05 07:16 AM
I think so.. I'll double check.. I think I selected tim1.. I have a HAL_TIM_PeriodElapsedCallback that calls HAL_IncTick().. below is my SystemClock_Config
void SystemClock_Config(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct = {0};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
/** Configure the main internal regulator output voltage
*/
__HAL_RCC_PWR_CLK_ENABLE();
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE2);
/** Initializes the CPU, AHB and APB busses clocks
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
RCC_OscInitStruct.PLL.PLLM = 16;
RCC_OscInitStruct.PLL.PLLN = 336;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4;
RCC_OscInitStruct.PLL.PLLQ = 7;
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_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK)
{
Error_Handler();
}
}
2019-08-05 07:34 AM
Do you call HAL_Init() where this timer and HAL tick is initialized, before SystemClock_Config?
Because, HAL_RCC_OscConfig() already needs the timer ticking.
-- pa
2019-08-05 07:49 AM