Board-dat/DPR/DPR1130-DAT/DPR1130-DAT.md
... ...
@@ -2,6 +2,9 @@
2 2
3 3
# DPR1130 DAT STM32 offline programmer
4 4
5
+https://www.electrodragon.com/product/chip-holdstm32-online-offline-programmer-daplink-off-prog/
6
+
7
+- legacy wiki page - https://w.electrodragon.com/w/STM32_OFF-PROG
5 8
6 9
7 10
... ...
@@ -39,4 +42,9 @@
39 42
- HC32F005
40 43
- HC32L136
41 44
45
+
46
+## ref
47
+
48
+- [[STM32-dat]]
49
+
42 50
- [[DPR1130]]
... ...
\ No newline at end of file
Chip-dat/ST-dat/STM32-dat/STM32-dat.md
... ...
@@ -14,11 +14,13 @@ legacy wiki page - https://w.electrodragon.com/w/Category:STM32
14 14
15 15
## Programmer
16 16
17
-based on [[CMSIS-dap-dat]] - [[st-link-dat]] - [[SWD-dat]]
17
+based on [[CMSIS-dap-dat]] - [[st-link-dat]] - [[SWD-dat]] - [[serial-dat]] - [[ST-Utility-dat]] - [[openOCD-dat]] - [[jlink-dat]]
18 18
19
-- [[DPR1004-dat]] - [[DPR1100-dat]]
19
+- [[DPR1004-dat]] - [[DPR1100-dat]] - [[DPR1130-dat]]
20 20
21
+IDE - [[STM32-Cube-G0]]
21 22
23
+SDK library - [[STM32-SDK-HAL-dat]]
22 24
23 25
## Periperals list
24 26
... ...
@@ -36,6 +38,11 @@ Interface
36 38
37 39
## Boot
38 40
41
+
42
+* STM32 microcontroller system memory boot mode - AN2606 - https://www.st.com/content/ccc/resource/technical/document/application_note/b9/9b/16/3a/12/1e/40/0c/CD00167594.pdf/files/CD00167594.pdf/jcr:content/translations/en.CD00167594.pdf
43
+
44
+
45
+
39 46
| Setup | Common Pin | User Flash Boot | ISP | System |
40 47
| ----- | ---------- | --------------- | ----------- | ------ |
41 48
| Boot0 | Boot0 | 0 | 0 | 1 |
SDK-dat/STM32-SDK-dat/ST-LINK-dat/2024-07-05-17-47-12.png
... ...
Binary files /dev/null and b/SDK-dat/STM32-SDK-dat/ST-LINK-dat/2024-07-05-17-47-12.png differ
SDK-dat/STM32-SDK-dat/ST-LINK-dat/ST-LINK-dat.md
... ...
@@ -29,6 +29,11 @@ Firmware
29 29
* Reference from - https://www.amobbs.com/forum.php?mod=viewthread&tid=5518690&highlight=%E6%94%BB%E5%85%8B
30 30
31 31
32
+## Upgrade firmware
33
+* If error st-link is not DFU mode -> connect ST-link, do not operate anythings, click upgrade firwmare directly
34
+
35
+![](2024-07-05-17-47-12.png)
36
+
32 37
## Projects
33 38
34 39
* STLink + UART - https://github.com/Edragon/stlink-uart
SDK-dat/STM32-SDK-dat/ST-Utility-dat/ST-Utility-dat.md
... ...
@@ -1,3 +1,5 @@
1 1
2 2
# ST-Utility-dat
3 3
4
+## ST Utility
5
+* https://www.st.com/zh/development-tools/stsw-link004.html
SDK-dat/STM32-SDK-dat/STM32-SDK-HAL-dat/2024-07-05-17-58-07.png
... ...
Binary files /dev/null and b/SDK-dat/STM32-SDK-dat/STM32-SDK-HAL-dat/2024-07-05-17-58-07.png differ
SDK-dat/STM32-SDK-dat/STM32-SDK-HAL-dat/STM32-SDK-HAL-dat.md
... ...
@@ -0,0 +1,535 @@
1
+
2
+# STM32-SDK-HAL-dat
3
+
4
+## Main
5
+
6
+### Vaiables
7
+
8
+ /* Private variables ---------------------------------------------------------*/
9
+ ADC_HandleTypeDef hadc;
10
+
11
+ I2C_HandleTypeDef hi2c1;
12
+ I2C_HandleTypeDef hi2c2;
13
+
14
+ SPI_HandleTypeDef hspi1;
15
+ SPI_HandleTypeDef hspi2;
16
+
17
+ UART_HandleTypeDef huart1;
18
+ UART_HandleTypeDef huart2;
19
+
20
+### Prototype
21
+
22
+ /* Private function prototypes -----------------------------------------------*/
23
+ void SystemClock_Config(void);
24
+ static void MX_GPIO_Init(void);
25
+ static void MX_ADC_Init(void);
26
+ static void MX_I2C1_Init(void);
27
+ static void MX_I2C2_Init(void);
28
+ static void MX_SPI1_Init(void);
29
+ static void MX_SPI2_Init(void);
30
+ static void MX_USART1_UART_Init(void);
31
+ static void MX_USART2_UART_Init(void);
32
+
33
+
34
+### Main Init
35
+ MX_GPIO_Init();
36
+ MX_ADC_Init();
37
+ MX_I2C1_Init();
38
+ MX_I2C2_Init();
39
+ MX_SPI1_Init();
40
+ MX_SPI2_Init();
41
+ MX_USART1_UART_Init();
42
+ MX_USART2_UART_Init();
43
+
44
+
45
+### Clock RCC
46
+
47
+ void SystemClock_Config(void)
48
+ {
49
+ RCC_OscInitTypeDef RCC_OscInitStruct = {0};
50
+ RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
51
+ RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
52
+
53
+ /** Initializes the CPU, AHB and APB busses clocks
54
+ */
55
+ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_HSI14;
56
+ RCC_OscInitStruct.HSIState = RCC_HSI_ON;
57
+ RCC_OscInitStruct.HSI14State = RCC_HSI14_ON;
58
+ RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
59
+ RCC_OscInitStruct.HSI14CalibrationValue = 16;
60
+ RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
61
+ if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
62
+ {
63
+ Error_Handler();
64
+ }
65
+ /** Initializes the CPU, AHB and APB busses clocks
66
+ */
67
+ RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
68
+ |RCC_CLOCKTYPE_PCLK1;
69
+ RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
70
+ RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
71
+ RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
72
+
73
+ if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK)
74
+ {
75
+ Error_Handler();
76
+ }
77
+ PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART1|RCC_PERIPHCLK_I2C1;
78
+ PeriphClkInit.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK1;
79
+ PeriphClkInit.I2c1ClockSelection = RCC_I2C1CLKSOURCE_HSI;
80
+ if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
81
+ {
82
+ Error_Handler();
83
+ }
84
+ }
85
+
86
+### ADC
87
+
88
+ static void MX_ADC_Init(void)
89
+ {
90
+
91
+ /* USER CODE BEGIN ADC_Init 0 */
92
+
93
+ /* USER CODE END ADC_Init 0 */
94
+
95
+ ADC_ChannelConfTypeDef sConfig = {0};
96
+
97
+ /* USER CODE BEGIN ADC_Init 1 */
98
+
99
+ /* USER CODE END ADC_Init 1 */
100
+ /** Configure the global features of the ADC (Clock, Resolution, Data Alignment and number of conversion)
101
+ */
102
+ hadc.Instance = ADC1;
103
+ hadc.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV1;
104
+ hadc.Init.Resolution = ADC_RESOLUTION_12B;
105
+ hadc.Init.DataAlign = ADC_DATAALIGN_RIGHT;
106
+ hadc.Init.ScanConvMode = ADC_SCAN_DIRECTION_FORWARD;
107
+ hadc.Init.EOCSelection = ADC_EOC_SINGLE_CONV;
108
+ hadc.Init.LowPowerAutoWait = DISABLE;
109
+ hadc.Init.LowPowerAutoPowerOff = DISABLE;
110
+ hadc.Init.ContinuousConvMode = DISABLE;
111
+ hadc.Init.DiscontinuousConvMode = DISABLE;
112
+ hadc.Init.ExternalTrigConv = ADC_SOFTWARE_START;
113
+ hadc.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;
114
+ hadc.Init.DMAContinuousRequests = DISABLE;
115
+ hadc.Init.Overrun = ADC_OVR_DATA_PRESERVED;
116
+ if (HAL_ADC_Init(&hadc) != HAL_OK)
117
+ {
118
+ Error_Handler();
119
+ }
120
+ /** Configure for the selected ADC regular channel to be converted.
121
+ */
122
+ sConfig.Channel = ADC_CHANNEL_8;
123
+ sConfig.Rank = ADC_RANK_CHANNEL_NUMBER;
124
+ sConfig.SamplingTime = ADC_SAMPLETIME_1CYCLE_5;
125
+ if (HAL_ADC_ConfigChannel(&hadc, &sConfig) != HAL_OK)
126
+ {
127
+ Error_Handler();
128
+ }
129
+ /* USER CODE BEGIN ADC_Init 2 */
130
+
131
+ /* USER CODE END ADC_Init 2 */
132
+
133
+ }
134
+
135
+### I2C
136
+
137
+ /**
138
+ * @brief I2C1 Initialization Function
139
+ * @param None
140
+ * @retval None
141
+ */
142
+ static void MX_I2C1_Init(void)
143
+ {
144
+
145
+ /* USER CODE BEGIN I2C1_Init 0 */
146
+
147
+ /* USER CODE END I2C1_Init 0 */
148
+
149
+ /* USER CODE BEGIN I2C1_Init 1 */
150
+
151
+ /* USER CODE END I2C1_Init 1 */
152
+ hi2c1.Instance = I2C1;
153
+ hi2c1.Init.Timing = 0x2000090E;
154
+ hi2c1.Init.OwnAddress1 = 0;
155
+ hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
156
+ hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
157
+ hi2c1.Init.OwnAddress2 = 0;
158
+ hi2c1.Init.OwnAddress2Masks = I2C_OA2_NOMASK;
159
+ hi2c1.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
160
+ hi2c1.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
161
+ if (HAL_I2C_Init(&hi2c1) != HAL_OK)
162
+ {
163
+ Error_Handler();
164
+ }
165
+ /** Configure Analogue filter
166
+ */
167
+ if (HAL_I2CEx_ConfigAnalogFilter(&hi2c1, I2C_ANALOGFILTER_ENABLE) != HAL_OK)
168
+ {
169
+ Error_Handler();
170
+ }
171
+ /** Configure Digital filter
172
+ */
173
+ if (HAL_I2CEx_ConfigDigitalFilter(&hi2c1, 0) != HAL_OK)
174
+ {
175
+ Error_Handler();
176
+ }
177
+ /* USER CODE BEGIN I2C1_Init 2 */
178
+
179
+ /* USER CODE END I2C1_Init 2 */
180
+
181
+ }
182
+
183
+ /**
184
+ * @brief I2C2 Initialization Function
185
+ * @param None
186
+ * @retval None
187
+ */
188
+ static void MX_I2C2_Init(void)
189
+ {
190
+
191
+ /* USER CODE BEGIN I2C2_Init 0 */
192
+
193
+ /* USER CODE END I2C2_Init 0 */
194
+
195
+ /* USER CODE BEGIN I2C2_Init 1 */
196
+
197
+ /* USER CODE END I2C2_Init 1 */
198
+ hi2c2.Instance = I2C2;
199
+ hi2c2.Init.Timing = 0x2000090E;
200
+ hi2c2.Init.OwnAddress1 = 0;
201
+ hi2c2.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
202
+ hi2c2.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
203
+ hi2c2.Init.OwnAddress2 = 0;
204
+ hi2c2.Init.OwnAddress2Masks = I2C_OA2_NOMASK;
205
+ hi2c2.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
206
+ hi2c2.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
207
+ if (HAL_I2C_Init(&hi2c2) != HAL_OK)
208
+ {
209
+ Error_Handler();
210
+ }
211
+ /** Configure Analogue filter
212
+ */
213
+ if (HAL_I2CEx_ConfigAnalogFilter(&hi2c2, I2C_ANALOGFILTER_ENABLE) != HAL_OK)
214
+ {
215
+ Error_Handler();
216
+ }
217
+ /** Configure Digital filter
218
+ */
219
+ if (HAL_I2CEx_ConfigDigitalFilter(&hi2c2, 0) != HAL_OK)
220
+ {
221
+ Error_Handler();
222
+ }
223
+ /* USER CODE BEGIN I2C2_Init 2 */
224
+
225
+ /* USER CODE END I2C2_Init 2 */
226
+
227
+ }
228
+
229
+### SPI
230
+
231
+
232
+ /**
233
+ * @brief SPI1 Initialization Function
234
+ * @param None
235
+ * @retval None
236
+ */
237
+ static void MX_SPI1_Init(void)
238
+ {
239
+
240
+ /* USER CODE BEGIN SPI1_Init 0 */
241
+
242
+ /* USER CODE END SPI1_Init 0 */
243
+
244
+ /* USER CODE BEGIN SPI1_Init 1 */
245
+
246
+ /* USER CODE END SPI1_Init 1 */
247
+ /* SPI1 parameter configuration*/
248
+ hspi1.Instance = SPI1;
249
+ hspi1.Init.Mode = SPI_MODE_MASTER;
250
+ hspi1.Init.Direction = SPI_DIRECTION_2LINES;
251
+ hspi1.Init.DataSize = SPI_DATASIZE_4BIT;
252
+ hspi1.Init.CLKPolarity = SPI_POLARITY_LOW;
253
+ hspi1.Init.CLKPhase = SPI_PHASE_1EDGE;
254
+ hspi1.Init.NSS = SPI_NSS_HARD_OUTPUT;
255
+ hspi1.Init.BaudRatePrescaler = SPI_BAUDRATEPRESCALER_2;
256
+ hspi1.Init.FirstBit = SPI_FIRSTBIT_MSB;
257
+ hspi1.Init.TIMode = SPI_TIMODE_DISABLE;
258
+ hspi1.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
259
+ hspi1.Init.CRCPolynomial = 7;
260
+ hspi1.Init.CRCLength = SPI_CRC_LENGTH_DATASIZE;
261
+ hspi1.Init.NSSPMode = SPI_NSS_PULSE_ENABLE;
262
+ if (HAL_SPI_Init(&hspi1) != HAL_OK)
263
+ {
264
+ Error_Handler();
265
+ }
266
+ /* USER CODE BEGIN SPI1_Init 2 */
267
+
268
+ /* USER CODE END SPI1_Init 2 */
269
+
270
+ }
271
+
272
+ /**
273
+ * @brief SPI2 Initialization Function
274
+ * @param None
275
+ * @retval None
276
+ */
277
+ static void MX_SPI2_Init(void)
278
+ {
279
+
280
+ /* USER CODE BEGIN SPI2_Init 0 */
281
+
282
+ /* USER CODE END SPI2_Init 0 */
283
+
284
+ /* USER CODE BEGIN SPI2_Init 1 */
285
+
286
+ /* USER CODE END SPI2_Init 1 */
287
+ /* SPI2 parameter configuration*/
288
+ hspi2.Instance = SPI2;
289
+ hspi2.Init.Mode = SPI_MODE_SLAVE;
290
+ hspi2.Init.Direction = SPI_DIRECTION_2LINES;
291
+ hspi2.Init.DataSize = SPI_DATASIZE_4BIT;
292
+ hspi2.Init.CLKPolarity = SPI_POLARITY_LOW;
293
+ hspi2.Init.CLKPhase = SPI_PHASE_1EDGE;
294
+ hspi2.Init.NSS = SPI_NSS_HARD_INPUT;
295
+ hspi2.Init.FirstBit = SPI_FIRSTBIT_MSB;
296
+ hspi2.Init.TIMode = SPI_TIMODE_DISABLE;
297
+ hspi2.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE;
298
+ hspi2.Init.CRCPolynomial = 7;
299
+ hspi2.Init.CRCLength = SPI_CRC_LENGTH_DATASIZE;
300
+ hspi2.Init.NSSPMode = SPI_NSS_PULSE_DISABLE;
301
+ if (HAL_SPI_Init(&hspi2) != HAL_OK)
302
+ {
303
+ Error_Handler();
304
+ }
305
+ /* USER CODE BEGIN SPI2_Init 2 */
306
+
307
+ /* USER CODE END SPI2_Init 2 */
308
+
309
+ }
310
+
311
+### USART
312
+
313
+ /**
314
+ * @brief USART1 Initialization Function
315
+ * @param None
316
+ * @retval None
317
+ */
318
+ static void MX_USART1_UART_Init(void)
319
+ {
320
+
321
+ /* USER CODE BEGIN USART1_Init 0 */
322
+
323
+ /* USER CODE END USART1_Init 0 */
324
+
325
+ /* USER CODE BEGIN USART1_Init 1 */
326
+
327
+ /* USER CODE END USART1_Init 1 */
328
+ huart1.Instance = USART1;
329
+ huart1.Init.BaudRate = 9600;
330
+ huart1.Init.WordLength = UART_WORDLENGTH_8B;
331
+ huart1.Init.StopBits = UART_STOPBITS_1;
332
+ huart1.Init.Parity = UART_PARITY_NONE;
333
+ huart1.Init.Mode = UART_MODE_TX_RX;
334
+ huart1.Init.HwFlowCtl = UART_HWCONTROL_NONE;
335
+ huart1.Init.OverSampling = UART_OVERSAMPLING_16;
336
+ huart1.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
337
+ huart1.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
338
+ if (HAL_UART_Init(&huart1) != HAL_OK)
339
+ {
340
+ Error_Handler();
341
+ }
342
+ /* USER CODE BEGIN USART1_Init 2 */
343
+
344
+ /* USER CODE END USART1_Init 2 */
345
+
346
+ }
347
+
348
+ /**
349
+ * @brief USART2 Initialization Function
350
+ * @param None
351
+ * @retval None
352
+ */
353
+ static void MX_USART2_UART_Init(void)
354
+ {
355
+
356
+ /* USER CODE BEGIN USART2_Init 0 */
357
+
358
+ /* USER CODE END USART2_Init 0 */
359
+
360
+ /* USER CODE BEGIN USART2_Init 1 */
361
+
362
+ /* USER CODE END USART2_Init 1 */
363
+ huart2.Instance = USART2;
364
+ huart2.Init.BaudRate = 115200;
365
+ huart2.Init.WordLength = UART_WORDLENGTH_8B;
366
+ huart2.Init.StopBits = UART_STOPBITS_1;
367
+ huart2.Init.Parity = UART_PARITY_NONE;
368
+ huart2.Init.Mode = UART_MODE_TX_RX;
369
+ huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
370
+ huart2.Init.OverSampling = UART_OVERSAMPLING_16;
371
+ huart2.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
372
+ huart2.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
373
+ if (HAL_UART_Init(&huart2) != HAL_OK)
374
+ {
375
+ Error_Handler();
376
+ }
377
+ /* USER CODE BEGIN USART2_Init 2 */
378
+
379
+ /* USER CODE END USART2_Init 2 */
380
+
381
+ }
382
+
383
+### GPIO
384
+
385
+ /**
386
+ * @brief GPIO Initialization Function
387
+ * @param None
388
+ * @retval None
389
+ */
390
+ static void MX_GPIO_Init(void)
391
+ {
392
+ GPIO_InitTypeDef GPIO_InitStruct = {0};
393
+
394
+ /* GPIO Ports Clock Enable */
395
+ __HAL_RCC_GPIOA_CLK_ENABLE();
396
+ __HAL_RCC_GPIOB_CLK_ENABLE();
397
+
398
+ /*Configure GPIO pin Output Level */
399
+ HAL_GPIO_WritePin(GPIOB, GPIO_PIN_1, GPIO_PIN_RESET);
400
+
401
+ /*Configure GPIO pin : PB1 */
402
+ GPIO_InitStruct.Pin = GPIO_PIN_1;
403
+ GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
404
+ GPIO_InitStruct.Pull = GPIO_NOPULL;
405
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
406
+ HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
407
+
408
+ /*Configure GPIO pin : PB2 */
409
+ GPIO_InitStruct.Pin = GPIO_PIN_2;
410
+ GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
411
+ GPIO_InitStruct.Pull = GPIO_NOPULL;
412
+ HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
413
+
414
+ /*Configure GPIO pin : PA8 */
415
+ GPIO_InitStruct.Pin = GPIO_PIN_8;
416
+ GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
417
+ GPIO_InitStruct.Pull = GPIO_NOPULL;
418
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
419
+ GPIO_InitStruct.Alternate = GPIO_AF2_TIM1;
420
+ HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
421
+
422
+ }
423
+
424
+## stm32f0xx_hal_msp.c
425
+
426
+void HAL_I2C_MspInit
427
+
428
+ void HAL_I2C_MspInit(I2C_HandleTypeDef* hi2c)
429
+ {
430
+ GPIO_InitTypeDef GPIO_InitStruct = {0};
431
+ if(hi2c->Instance==I2C1)
432
+ {
433
+ /* USER CODE BEGIN I2C1_MspInit 0 */
434
+
435
+ /* USER CODE END I2C1_MspInit 0 */
436
+
437
+ __HAL_RCC_GPIOB_CLK_ENABLE();
438
+ /**I2C1 GPIO Configuration
439
+ PB7 ------> I2C1_SDA
440
+ PB8 ------> I2C1_SCL
441
+ */
442
+ GPIO_InitStruct.Pin = GPIO_PIN_7|GPIO_PIN_8;
443
+ GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
444
+ GPIO_InitStruct.Pull = GPIO_PULLUP;
445
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
446
+ GPIO_InitStruct.Alternate = GPIO_AF1_I2C1;
447
+ HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
448
+
449
+ /* Peripheral clock enable */
450
+ __HAL_RCC_I2C1_CLK_ENABLE();
451
+ /* USER CODE BEGIN I2C1_MspInit 1 */
452
+
453
+ /* USER CODE END I2C1_MspInit 1 */
454
+ }
455
+ else if(hi2c->Instance==I2C2)
456
+ {
457
+ /* USER CODE BEGIN I2C2_MspInit 0 */
458
+
459
+ /* USER CODE END I2C2_MspInit 0 */
460
+
461
+ __HAL_RCC_GPIOB_CLK_ENABLE();
462
+ /**I2C2 GPIO Configuration
463
+ PB10 ------> I2C2_SCL
464
+ PB11 ------> I2C2_SDA
465
+ */
466
+ GPIO_InitStruct.Pin = GPIO_PIN_10|GPIO_PIN_11;
467
+ GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
468
+ GPIO_InitStruct.Pull = GPIO_PULLUP;
469
+ GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
470
+ GPIO_InitStruct.Alternate = GPIO_AF1_I2C2;
471
+ HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
472
+
473
+ /* Peripheral clock enable */
474
+ __HAL_RCC_I2C2_CLK_ENABLE();
475
+ /* USER CODE BEGIN I2C2_MspInit 1 */
476
+
477
+ /* USER CODE END I2C2_MspInit 1 */
478
+ }
479
+
480
+ }
481
+
482
+## USART
483
+
484
+### Setup
485
+
486
+* Global interrupt
487
+* DMA on TX / channel 4 / priority high
488
+
489
+### Use DMA
490
+
491
+ HAL_StatusTypeDef HAL_UART_Transmit_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
492
+
493
+
494
+## IIC
495
+
496
+HAL_StatusTypeDef HAL_I2C_Mem_Write(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint16_t MemAddress, uint16_t MemAddSize, uint8_t *pData, uint16_t Size, uint32_t Timeout)
497
+
498
+HAL_I2C_Mem_Write(&hi2c1,0xA0,100,I2C_MEMADD_SIZE_16BIT,i2cWriteBuf,10,10)
499
+
500
+
501
+
502
+## MDK-ARM Setup by STM32CubeMx
503
+
504
+* Install MDK-ARM lastest version
505
+* Install software pack for platform, for example STM32F030xxx
506
+* Install STM32Cube
507
+* Follow the following animation, open to watch
508
+
509
+
510
+[[Stm32_quick_build_for_blink.gif]]
511
+Quick blink IO
512
+
513
+[[Upload_code_STM32.gif]]
514
+Upload code to board use MDK-ARM or ST-Utility
515
+
516
+
517
+![](2024-07-05-17-58-07.png)
518
+
519
+
520
+Code add this two lines for blinking IO in user code 1 area:
521
+ HAL_GPIO_TogglePin(LED_GPIO_Port,LED_Pin);
522
+ HAL_Delay(1000);
523
+
524
+ HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_13);
525
+ HAL_Delay(1000);
526
+
527
+
528
+### Note
529
+
530
+* Default frequency is 8Mhz
531
+* Choose to output hex compilied file.
532
+* In STM32Cube, only copy necessary files, otherwise will be very big project folder
533
+
534
+
535
+[[category: STM32 SDK]]
SDK-dat/STM32-SDK-dat/STM32-SDK-HAL-dat/Stm32_quick_build_for_blink.gif
... ...
Binary files /dev/null and b/SDK-dat/STM32-SDK-dat/STM32-SDK-HAL-dat/Stm32_quick_build_for_blink.gif differ
SDK-dat/STM32-SDK-dat/STM32-SDK-HAL-dat/Upload_code_STM32.gif
... ...
Binary files /dev/null and b/SDK-dat/STM32-SDK-dat/STM32-SDK-HAL-dat/Upload_code_STM32.gif differ
SDK-dat/STM32-SDK-dat/stm32-cube-dat/stm32-cube-dat.md
... ...
@@ -0,0 +1,15 @@
1
+
2
+# stm32-cube-dat
3
+
4
+
5
+## Programmer
6
+* X64 2.6 - https://my.st.com/content/ccc/resource/technical/software/utility/group0/d5/9b/ea/a8/cd/2d/4e/3c/stm32cubeprg-win64_v2-6-0/files/stm32cubeprg-win64_v2-6-0.zip/jcr:content/translations/en.stm32cubeprg-win64_v2-6-0.zip
7
+- STM32cubeprog 2.2.1 - https://my.st.com/content/ccc/resource/technical/software/utility/group0/e1/74/6e/13/97/d4/48/98/stm32cubeprog/files/stm32cubeprog.zip/jcr:content/translations/en.stm32cubeprog.zip
8
+
9
+* Require https://w.electrodragon.com/w/Java
10
+* Support DFU
11
+
12
+
13
+## ref
14
+
15
+- [[stm32-cube]]
... ...
\ No newline at end of file
SDK-dat/STM8-SDK-dat/STM8-SDK-dat.md
... ...
@@ -0,0 +1,15 @@
1
+
2
+# STM8-SDK-dat
3
+
4
+https://w.electrodragon.com/w/STM8_Program
5
+
6
+https://w.electrodragon.com/w/STM8_IAR
7
+
8
+## ToolChain
9
+
10
+### Guide for IAR STM8
11
+
12
+* Download standard stm8 library via google search, on st website.
13
+* Install st toolset (STVD + programmer ). Current version we provided is [http://dl.electrodragon.com/k/index.php?share/folder&user=1&sid=JMyabvNR sttoolset_pack29] (pass electrodragon0428)
14
+* Alternative install ST-link driver
15
+
SDK-dat/arduino-dat/Arduino-IDE-DAT/arduino-stm32-dat/arduino-stm32-dat.md
... ...
@@ -0,0 +1,20 @@
1
+
2
+# arduino-stm32-dat
3
+
4
+* In arduino IDE install arduino SAM board first ("for arduino zero"), so toolchain "arm-none-eabi-g++ " installed
5
+* Git clone into arduino\hardware folder
6
+{| class="wikitable sortable"
7
+|-
8
+! Github !! Support hardward !! Support software
9
+|-
10
+| [https://github.com/rogerclarkmelbourne/Arduino_STM32.git STM32 Arduino] || F1, F3, F4 ||
11
+|-
12
+| [https://github.com/stm32duino/Arduino_Core_STM32 Arduino_Core_STM32] || F0~F7, L0~L4 ||
13
+|}
14
+* Hardware programmer use ST-LINK, install driver, [https://github.com/Edragon/stm8 you can find it here]
15
+* Connect with our STM32F103C8T6 board, upload blink sketch onto PB12 pin.
16
+* Support arduino library - [http://stm32duino.com/viewtopic.php?f=13&t=2812 here]
17
+
18
+## ref
19
+
20
+- [[arduino-dat.md]]
... ...
\ No newline at end of file
SDK-dat/openOCD-dat/openOCD-dat.md
... ...
@@ -0,0 +1,58 @@
1
+
2
+# openOCD-dat
3
+
4
+
5
+## STM32 Linux
6
+
7
+### Debugger OpenOCD
8
+
9
+* [http://openocd.org/doc/html/index.html Help page.]
10
+* Use either ST-LINK or OpenOCD, can work with ST-LINK2
11
+* For example OpenOCD, run command as follow to install
12
+# install openocs: sudo apt-get install openocd
13
+# setup up for usbdevice: sudo vi /etc/udev/rules.d/99-stlink.rules
14
+# add conent: ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3748", MODE="0666"
15
+# reload setup: sudo udevadm control --reload-rules
16
+# open board: openocd -f /usr/share/openocd/scripts/board/stm32f3discovery.cfg
17
+# or use: /usr/share/openocd/scripts# openocd -f interface/stlink-v2.cfg -f target/stm32f1x_stlink.cfg
18
+* If well connected, result will show:
19
+
20
+Open On-Chip Debugger 0.7.0 (2013-05-15-17:44)
21
+Licensed under GNU GPL v2
22
+For bug reports, read
23
+ http://openocd.sourceforge.net/doc/doxygen/bugs.html
24
+ srst_only separate srst_nogate srst_open_drain connect_deassert_srst
25
+ Info : This adapter doesn't support configurable speed
26
+ Info : STLINK v2 JTAG v16 API v2 SWIM v0 VID 0x0483 PID 0x3748
27
+ Info : Target voltage: 2.915198
28
+ Info : stm32f3x.cpu: hardware has 6 breakpoints, 4 watchpoint
29
+* Run another terminal and telnet to the board: telnet localhost 4444
30
+* halt it into debug mode: reset halt or: reset init
31
+* Reflash bin into board:
32
+ flash write_image erase maple_mini_boot.bin 0x08000000
33
+ flash write_image erase /media/sf_VM_XP_share/LED.hex
34
+* Finall reset it to start up again: reset run
35
+
36
+
37
+#### Toolchain
38
+* Install: sudo apt-get install gcc-arm-none-eabi
39
+
40
+
41
+#### Firmware libopencm3 and test code
42
+* git clone the firmware and try stm32f103 demo blink code, the firmware works like arduino
43
+ git clone https://github.com/libopencm3/libopencm3-examples.git
44
+ cd libopencm3-examples
45
+ git submodule init //
46
+ git submodule update
47
+ make
48
+* enter into board folder like: cd libopencm3-examples/examples/stm32/f3/stm32f3-discovery/miniblink
49
+* for STM32F1x board, enter into /libopencm3-examples/examples/stm32/f1/stm32-h103//miniblink/
50
+* firmware support openocd, can run make flash directory
51
+* Or manually telnet to openocd: telnet localhost 4444
52
+ reset halt
53
+ flash write_image erase miniblink.elf
54
+ reset
55
+
56
+## ref
57
+
58
+- [[stm32-dat]]
Tech-dat/ARM-dat/SWD-dat/2024-07-05-17-37-28.png
... ...
Binary files /dev/null and b/Tech-dat/ARM-dat/SWD-dat/2024-07-05-17-37-28.png differ
Tech-dat/ARM-dat/SWD-dat/SWD-dat.md
... ...
@@ -9,7 +9,11 @@
9 9
10 10
https://stm32-base.org/guides/connecting-your-debugger.html
11 11
12
-
12
+![](2024-07-05-17-37-28.png)
13 13
14 14
## Debug
15 15
* If SWD Serial-Wire is not enable, add reset line to force enter into debug mode
16
+
17
+- [[USB-TTL-dat]]
18
+
19
+- [[stm32-dat]]
... ...
\ No newline at end of file
Tech-dat/Interface-dat/Serial-dat/2024-07-05-17-39-17.png
... ...
Binary files /dev/null and b/Tech-dat/Interface-dat/Serial-dat/2024-07-05-17-39-17.png differ
Tech-dat/Interface-dat/Serial-dat/2024-07-05-17-39-28.png
... ...
Binary files /dev/null and b/Tech-dat/Interface-dat/Serial-dat/2024-07-05-17-39-28.png differ
Tech-dat/Interface-dat/Serial-dat/2024-07-05-17-39-45.png
... ...
Binary files /dev/null and b/Tech-dat/Interface-dat/Serial-dat/2024-07-05-17-39-45.png differ
Tech-dat/Interface-dat/Serial-dat/Serial-dat.md
... ...
@@ -83,6 +83,19 @@ Booting Mode select
83 83
84 84
![](2024-04-03-15-04-50.png)
85 85
86
+
87
+
88
+### Programming STM32
89
+
90
+- [[STM32-dat]] - ISP USART
91
+* BOOT0 should be pull to high, foce chip into system memory
92
+* Flash loader demostrator from official ST = Flasher
93
+* https://www.st.com/en/development-tools/flasher-stm32.html
94
+
95
+![](2024-07-05-17-39-17.png)
96
+![](2024-07-05-17-39-28.png)
97
+![](2024-07-05-17-39-45.png)
98
+
86 99
## ref
87 100
software [[com-monitor-dat]]
88 101
Tech-dat/Interface-dat/USB-dat/usb-dat.md
... ...
@@ -42,6 +42,13 @@ MicroA_2_A_Female
42 42
* Open the DFU tool to upload firmware to internal flash, see left animation.
43 43
44 44
45
+### USB DFU
46
+* Short connect Boot0 + 3V3 to re-enter into USB DFU mode
47
+* use STM32CubeProgrammer upload hex or DFU file.
48
+In other boot try:
49
+* In case of SLCAN software connect UCCB and type in terminal '''boot''' device should reset and new device should connect to Your pc
50
+
51
+
45 52
46 53
## ref
47 54
Tech-dat/Programming-dat/Programmer-dat/JLINK-dat/2024-07-05-17-55-07.png
... ...
Binary files /dev/null and b/Tech-dat/Programming-dat/Programmer-dat/JLINK-dat/2024-07-05-17-55-07.png differ
Tech-dat/Programming-dat/Programmer-dat/JLINK-dat/2024-07-05-17-55-19.png
... ...
Binary files /dev/null and b/Tech-dat/Programming-dat/Programmer-dat/JLINK-dat/2024-07-05-17-55-19.png differ
Tech-dat/Programming-dat/Programmer-dat/JLINK-dat/JLINK-dat.md
... ...
@@ -1,4 +1,19 @@
1 1
2 2
# JLINK dat
3 3
4
-JLink is a the SEGGER company launched JTAG emulator for ARM core chip to support simulation. IAR EWARM, ADS, KEIL, WINARM, RealView and other integrated development environment with the support all ARM7/ARM9 kernel chip simulation and seamless connectivity through the RDI interface and the integrated development environment, easy to operate, easy to connect, easy to learn, learning to develop ARM the best and most practical development tools.
... ...
\ No newline at end of file
0
+JLink is a the SEGGER company launched JTAG emulator for ARM core chip to support simulation. IAR EWARM, ADS, KEIL, WINARM, RealView and other integrated development environment with the support all ARM7/ARM9 kernel chip simulation and seamless connectivity through the RDI interface and the integrated development environment, easy to operate, easy to connect, easy to learn, learning to develop ARM the best and most practical development tools.
1
+
2
+
3
+## About J-Link
4
+
5
+
6
+* J-Link-OB developed by Segger, for development board "on-board"
7
+* Interface include JTAG and SWD, simple version only have SWD
8
+* Support IDE: J-Flash ARM、Keil MDK-ARM、IAR EWARM、CoIDE、mikroC PRO for ARM、nRFgo Studio
9
+* Supported MCUs: ST、Freecale、nuvoton、NXP、TI, Cypress, Atmel, Analog, Fujitsu, Toshiba, Energy Micro and more
10
+* Could be detected as fake in MDK, so not as good as STLINK or DAPLINK
11
+
12
+
13
+![](2024-07-05-17-55-07.png)
14
+
15
+![](2024-07-05-17-55-19.png)
... ...
\ No newline at end of file