Ver código fonte

LED Pin 변경 / 메모리 Start Position 변경

PYJ 5 anos atrás
pai
commit
25e93e3558

+ 1 - 1
Bluecell_Src/Bluecell_operate.c

@@ -2479,7 +2479,7 @@ uint32_t MBIC_DataSend(uint8_t* data){
2479 2479
     data[MBIC_LENGTH_1] = ((Length  + (3 * 74)) & 0x00FF);  
2480 2480
 
2481 2481
 
2482
-    data[MBIC_HEADERCHECKSUM_0] = Chksum_Create(data,MBIC_HEADER_SIZE - 4);        
2482
+    data[MBIC_HEADERCHECKSUM_0] = Chksum_Create(data);        
2483 2483
     data[MBIC_PAYLOADSTART + i++] = ((CRC16_Generate(&data[MBIC_PAYLOADSTART], (Length  + (3 * 74))) & 0xFF00) >> 8);  
2484 2484
     data[MBIC_PAYLOADSTART + i++] = CRC16_Generate(&data[MBIC_PAYLOADSTART], (Length  + (3 * 74))) & 0x00FF;  
2485 2485
     data[MBIC_PAYLOADSTART + i++] = 0x03; 

+ 10 - 8
Bluecell_Src/uart.c

@@ -103,19 +103,21 @@ void GetDataFromUartQueue(UART_HandleTypeDef *huart)
103 103
             }else if(uart_buf[0] == MBIC_PREAMBLE0
104 104
                    &&uart_buf[1] == MBIC_PREAMBLE1
105 105
                    &&uart_buf[2] == MBIC_PREAMBLE2
106
-                   &&uart_buf[3] == MBIC_PREAMBLE3){
107
-                   
108
-               if(Chksum_Check(uart_buf,MBIC_HEADER_SIZE - 4,uart_buf[MBIC_CHECKSHUM_INDEX])){
109
-                Length = ((uart_buf[MBIC_LENGTH_0] << 8) | uart_buf[MBIC_LENGTH_1]);
110
-                CrcChk = ((uart_buf[MBIC_PAYLOADSTART + Length + 1] << 8) | (uart_buf[MBIC_PAYLOADSTART + Length + 2]));
111
-                    if((CRC16_Check(&uart_buf[MBIC_PAYLOADSTART], Length,CrcChk)
106
+                   &&uart_buf[3] == MBIC_PREAMBLE3)
107
+           {
108
+               if(Chksum_Check(uart_buf,MBIC_HEADER_SIZE - 4,uart_buf[MBIC_CHECKSHUM_INDEX]))
109
+               {
110
+                    Length = ((uart_buf[MBIC_LENGTH_0] << 8) | uart_buf[MBIC_LENGTH_1]);
111
+                    CrcChk = ((uart_buf[MBIC_PAYLOADSTART + Length + 1] << 8) | (uart_buf[MBIC_PAYLOADSTART + Length + 2]));
112
+                    if(CRC16_Check(&uart_buf[MBIC_PAYLOADSTART], Length,CrcChk))
112 113
                         MBIC_Operate(uart_buf);
113 114
                }
114
-               else{
115
+               else
116
+               {
115 117
                     printf("CHECK SUM ERR \r\n");
116 118
                }
117 119
             }
118
-        memset(uart_buf,0x00,cnt);
120
+            memset(uart_buf,0x00,cnt);
119 121
 //        for(int i  = 0; i < cnt; i++)
120 122
 //            uart_buf[i] = 0;
121 123
         cnt = 0;

+ 5 - 4
Inc/main.h

@@ -69,8 +69,8 @@ extern I2C_HandleTypeDef hi2c2;
69 69
 /* USER CODE END EFP */
70 70
 
71 71
 /* Private defines -----------------------------------------------------------*/
72
-#define LED_ACT_Pin GPIO_PIN_3
73
-#define LED_ACT_GPIO_Port GPIOE
72
+#define LED_FAIL2_Pin GPIO_PIN_3
73
+#define LED_FAIL2_GPIO_Port GPIOE
74 74
 #define FAIL_MBIC_Pin GPIO_PIN_4
75 75
 #define FAIL_MBIC_GPIO_Port GPIOE
76 76
 #define BOOT_LED_Pin GPIO_PIN_15
@@ -125,7 +125,9 @@ extern I2C_HandleTypeDef hi2c2;
125 125
 #define PATH_EN_DL2_GPIO_Port GPIOD
126 126
 #define PATH_EN_UL2_Pin GPIO_PIN_11
127 127
 #define PATH_EN_UL2_GPIO_Port GPIOD
128
-#define LED_FAIL_Pin GPIO_PIN_14
128
+#define LED_ACT_Pin GPIO_PIN_14
129
+#define LED_ACT_GPIO_Port GPIOD
130
+#define LED_FAIL_Pin GPIO_PIN_15
129 131
 #define LED_FAIL_GPIO_Port GPIOD
130 132
 #define ATT_EN_DL3_Pin GPIO_PIN_2
131 133
 #define ATT_EN_DL3_GPIO_Port GPIOG
@@ -192,4 +194,3 @@ extern I2C_HandleTypeDef hi2c2;
192 194
 #endif /* __MAIN_H */
193 195
 
194 196
 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
195
-

Diferenças do arquivo suprimidas por serem muito extensas
+ 50 - 50
STM32F103ZET_JDASMBIC.elf.launch


+ 4 - 2
STM32F103ZET_JDASMBIC.ioc

@@ -284,9 +284,11 @@ PD11.GPIO_Label=PATH_EN_UL2
284 284
 PD11.Locked=true
285 285
 PD11.Signal=GPIO_Output
286 286
 PD14.GPIOParameters=GPIO_Label
287
-PD14.GPIO_Label=LED_FAIL
287
+PD14.GPIO_Label=LED_ACT
288 288
 PD14.Locked=true
289 289
 PD14.Signal=GPIO_Output
290
+PD15.GPIOParameters=GPIO_Label
291
+PD15.GPIO_Label=LED_FAIL
290 292
 PD15.Locked=true
291 293
 PD15.Signal=GPIO_Output
292 294
 PD2.GPIOParameters=GPIO_Label
@@ -330,7 +332,7 @@ PE15.GPIO_Label=PATH_EN_UL4
330 332
 PE15.Locked=true
331 333
 PE15.Signal=GPIO_Output
332 334
 PE3.GPIOParameters=GPIO_Label
333
-PE3.GPIO_Label=LED_ACT
335
+PE3.GPIO_Label=LED_FAIL2
334 336
 PE3.Locked=true
335 337
 PE3.Signal=GPIO_Output
336 338
 PE4.GPIOParameters=GPIO_Label

+ 1 - 1
STM32F103ZE_FLASH.ld

@@ -62,7 +62,7 @@ _Min_Stack_Size = 0x400; /* required amount of stack */
62 62
 MEMORY
63 63
 {
64 64
 RAM (xrw)      : ORIGIN = 0x20000000, LENGTH = 64K
65
-FLASH (rx)      : ORIGIN = 0x8004000, LENGTH = 512K - 16K
65
+FLASH (rx)      : ORIGIN = 0x8005000, LENGTH = 64K
66 66
 }
67 67
 
68 68
 /* Define output sections */

+ 8 - 10
Src/main.c

@@ -162,7 +162,7 @@ uint16_t adc3cnt = 0 ;
162 162
 void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)
163 163
 {
164 164
 //?��?��?�� 코드 ?��?��
165
-//만약 ?��?�� adc?���?????????? �???????????��?�� ?�� ?��?���?????????? ?��?���?????????? ?��?��?? 같이 조건�?????????? ?��?��
165
+//諤嵸烄 ?嚙踝蕭?嚙踝蕭 adc?嚙踝蕭嚙??????????? 嚙????????????嚙踝蕭?嚙踝蕭 ?嚙踝蕭 ?嚙踝蕭?嚙踝蕭嚙??????????? ?嚙踝蕭?嚙踝蕭嚙??????????? ?嚙踝蕭?嚙踝蕭?? 穈軤𦚯 魽國探嚙??????????? ?嚙踝蕭?嚙踝蕭
166 166
 
167 167
     if(hadc->Instance == hadc1.Instance)
168 168
     {
@@ -311,12 +311,10 @@ extern void Booting_LED_Check(void);
311 311
 
312 312
 /**
313 313
   * @brief  The application entry point.
314
-  *
315 314
   * @retval int
316 315
   */
317 316
 int main(void)
318
-
319
-  {
317
+{
320 318
   /* USER CODE BEGIN 1 */
321 319
 
322 320
   /* USER CODE END 1 */
@@ -805,7 +803,7 @@ static void MX_GPIO_Init(void)
805 803
   __HAL_RCC_GPIOD_CLK_ENABLE();
806 804
 
807 805
   /*Configure GPIO pin Output Level */
808
-  HAL_GPIO_WritePin(GPIOE, LED_ACT_Pin|FAIL_MBIC_Pin|ATT_CLOCK4_Pin|ATT_DATA4_Pin 
806
+  HAL_GPIO_WritePin(GPIOE, LED_FAIL2_Pin|FAIL_MBIC_Pin|ATT_CLOCK4_Pin|ATT_DATA4_Pin 
809 807
                           |ATT_EN_DL4_Pin|ATT_EN_UL4_Pin|PATH_EN_DL4_Pin|PATH_EN_UL4_Pin, GPIO_PIN_RESET);
810 808
 
811 809
   /*Configure GPIO pin Output Level */
@@ -822,12 +820,12 @@ static void MX_GPIO_Init(void)
822 820
                           |ATT_EN_DL1_Pin, GPIO_PIN_RESET);
823 821
 
824 822
   /*Configure GPIO pin Output Level */
825
-  HAL_GPIO_WritePin(GPIOD, PATH_EN_DL2_Pin|PATH_EN_UL2_Pin|LED_FAIL_Pin|GPIO_PIN_15 
823
+  HAL_GPIO_WritePin(GPIOD, PATH_EN_DL2_Pin|PATH_EN_UL2_Pin|LED_ACT_Pin|LED_FAIL_Pin 
826 824
                           |ATT_CLOCK2_Pin|ATT_DATA2_Pin|ATT_EN_DL2_Pin|ATT_EN_UL2_Pin, GPIO_PIN_RESET);
827 825
 
828
-  /*Configure GPIO pins : LED_ACT_Pin FAIL_MBIC_Pin ATT_CLOCK4_Pin ATT_DATA4_Pin 
826
+  /*Configure GPIO pins : LED_FAIL2_Pin FAIL_MBIC_Pin ATT_CLOCK4_Pin ATT_DATA4_Pin 
829 827
                            ATT_EN_DL4_Pin ATT_EN_UL4_Pin PATH_EN_DL4_Pin PATH_EN_UL4_Pin */
830
-  GPIO_InitStruct.Pin = LED_ACT_Pin|FAIL_MBIC_Pin|ATT_CLOCK4_Pin|ATT_DATA4_Pin 
828
+  GPIO_InitStruct.Pin = LED_FAIL2_Pin|FAIL_MBIC_Pin|ATT_CLOCK4_Pin|ATT_DATA4_Pin 
831 829
                           |ATT_EN_DL4_Pin|ATT_EN_UL4_Pin|PATH_EN_DL4_Pin|PATH_EN_UL4_Pin;
832 830
   GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
833 831
   GPIO_InitStruct.Pull = GPIO_NOPULL;
@@ -863,9 +861,9 @@ static void MX_GPIO_Init(void)
863 861
   GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
864 862
   HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
865 863
 
866
-  /*Configure GPIO pins : PATH_EN_DL2_Pin PATH_EN_UL2_Pin LED_FAIL_Pin PD15 
864
+  /*Configure GPIO pins : PATH_EN_DL2_Pin PATH_EN_UL2_Pin LED_ACT_Pin LED_FAIL_Pin 
867 865
                            ATT_CLOCK2_Pin ATT_DATA2_Pin ATT_EN_DL2_Pin ATT_EN_UL2_Pin */
868
-  GPIO_InitStruct.Pin = PATH_EN_DL2_Pin|PATH_EN_UL2_Pin|LED_FAIL_Pin|GPIO_PIN_15 
866
+  GPIO_InitStruct.Pin = PATH_EN_DL2_Pin|PATH_EN_UL2_Pin|LED_ACT_Pin|LED_FAIL_Pin 
869 867
                           |ATT_CLOCK2_Pin|ATT_DATA2_Pin|ATT_EN_DL2_Pin|ATT_EN_UL2_Pin;
870 868
   GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
871 869
   GPIO_InitStruct.Pull = GPIO_NOPULL;

+ 1 - 1
Src/system_stm32f1xx.c

@@ -92,7 +92,7 @@
92 92
 /*!< Uncomment the following line if you need to relocate your vector Table in
93 93
      Internal SRAM. */ 
94 94
 /* #define VECT_TAB_SRAM */
95
-#define VECT_TAB_OFFSET  0x4000 /* Original Value : 0x00000000U*/ /*!< Vector Table base offset field.
95
+#define VECT_TAB_OFFSET  0x5000 /* Original Value : 0x00000000U*/ /*!< Vector Table base offset field.
96 96
                                   This value must be a multiple of 0x200. */
97 97
 
98 98