Ich habe mir mit STM32CubeMX eine Programmstruktur mit den benötigen IOs, Timern etc. erzeugt. Das Ganze ist ohne Fehlermeldung compiliert worden (mit OpenSTM32 in Eclipse). Ich habe das erzeugte Hex-file spaßeshalber mal geflasht, sinnvollen Inhalt hat der Code ja noch keinen, es wird nur die ganze Peripherie initialisiert. Nach dem Flashen ist nun der Controller mit dem ST-Link-Utility nicht mehr ansprechbar. Ich habe die Clock auf internen Oszillator gestellt, da kein externer angeschlossen ist.
1 | void SystemClock_Config(void) |
2 | {
|
3 | |
4 | RCC_OscInitTypeDef RCC_OscInitStruct; |
5 | RCC_ClkInitTypeDef RCC_ClkInitStruct; |
6 | RCC_PeriphCLKInitTypeDef PeriphClkInit; |
7 | |
8 | /**Initializes the CPU, AHB and APB busses clocks
|
9 | */
|
10 | RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; |
11 | RCC_OscInitStruct.HSIState = RCC_HSI_ON; |
12 | RCC_OscInitStruct.HSICalibrationValue = 16; |
13 | RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; |
14 | RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI_DIV2; |
15 | RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL16; |
16 | if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) |
17 | {
|
18 | _Error_Handler(__FILE__, __LINE__); |
19 | }
|
20 | |
21 | /**Initializes the CPU, AHB and APB busses clocks
|
22 | */
|
23 | RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |
24 | |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; |
25 | RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; |
26 | RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; |
27 | RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2; |
28 | RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; |
29 | |
30 | if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2) != HAL_OK) |
31 | {
|
32 | _Error_Handler(__FILE__, __LINE__); |
33 | }
|
34 | |
35 | PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC; |
36 | PeriphClkInit.AdcClockSelection = RCC_ADCPCLK2_DIV6; |
37 | if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) |
38 | {
|
39 | _Error_Handler(__FILE__, __LINE__); |
40 | }
|
41 | |
42 | /**Configure the Systick interrupt time
|
43 | */
|
44 | HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000); |
45 | |
46 | /**Configure the Systick
|
47 | */
|
48 | HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK); |
49 | |
50 | /* SysTick_IRQn interrupt configuration */
|
51 | HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0); |
52 | }
|
Hier der Log des ST-Link-Utilities
1 | 18:14:26 : Device ID:0x412 |
2 | 18:14:26 : Device flash Size : 32KBytes |
3 | 18:14:26 : Device family :STM32F10xx Low-density |
4 | 18:14:36 : Disconnected from device. |
5 | 18:20:16 : [OC_01.hex] opened successfully. |
6 | 18:20:16 : [OC_01.hex] checksum : 0x000DDFEA |
7 | 18:20:27 : ST-LINK SN : 53FF6C065178535441492387 |
8 | 18:20:27 : ST-LINK Firmware version : V2J27S6 |
9 | 18:20:27 : Connected via SWD. |
10 | 18:20:27 : SWD Frequency = 4,0 MHz. |
11 | 18:20:27 : Connection mode : Normal. |
12 | 18:20:27 : Debug in Low Power mode enabled. |
13 | 18:20:27 : Device ID:0x412 |
14 | 18:20:27 : Device flash Size : 32KBytes |
15 | 18:20:27 : Device family :STM32F10xx Low-density |
16 | 18:20:59 : Memory programmed in 1s and 781ms. |
17 | 18:20:59 : Verification...OK |
18 | 18:20:59 : Programmed memory Checksum: 0x000DDFEA |
19 | 18:21:00 : Disconnected from device. |
20 | 18:21:00 : Connection to device is lost: check power supply and debug connection. |
21 | 18:21:00 : If the target is in low power mode, please enable "Debug in Low Power mode" option from Target->settings menu. |
22 | 18:21:13 : Can not connect to target! |
23 | Please select "Connect Under Reset" mode from Target->Settings menu and try again. |
24 | If you're trying to connect to a low frequency application , please select a lower SWD Frequency mode from Target->Settings menu. |
hat jemand eine Tipp, wie ich den Prozessor wieder zum Leben erwecken kann? Gruß hochsitzcola