|
@@ -274,125 +274,31 @@ int main(void)
|
274
|
274
|
HAL_ADC_Start_DMA(&hadc1, (uint16_t*)ADC1value, 4);
|
275
|
275
|
HAL_TIM_Base_Start_IT(&htim6);
|
276
|
276
|
|
277
|
|
-
|
278
|
|
-
|
279
|
277
|
setbuf(stdout, NULL);
|
280
|
|
- uint32_t CurrApiAddress = 0,Bank1Address=0,Bank2Address = 0;
|
281
|
|
- int32_t CrcLength = 0;
|
282
|
|
-
|
283
|
|
-
|
284
|
|
-#if 0 // PYJ.2020.07.13_BEGIN --
|
285
|
|
-
|
286
|
|
- CurrApiAddress = FLASH_MBICUSER_START_ADDR;
|
287
|
|
- Bank1Address = FLASH_USER_BANK1_START_ADDR;
|
288
|
|
- Bank2Address = FLASH_USER_BANK2_START_ADDR;
|
|
278
|
+ uint32_t CurrApiAddress = 0,Bank1Address=0,Bank2Address = 0;
|
|
279
|
+ int32_t CrcLength = 0;
|
289
|
280
|
|
290
|
|
- uint8_t* Currdata = (uint8_t*)CurrApiAddress;
|
291
|
|
- uint8_t* Bank1data = (uint8_t*)Bank1Address;
|
292
|
|
- uint8_t* Bank2data = (uint8_t*)Bank2Address;
|
293
|
281
|
|
294
|
|
- uint16_t crcret = 0;
|
295
|
282
|
|
296
|
|
- CrcLength=
|
297
|
|
- ((Bank1data[MBIC_BOOT_LENGTH] << 24 )
|
298
|
|
- | Bank1data[MBIC_BOOT_LENGTH + 1]<<16
|
299
|
|
- | Bank1data[MBIC_BOOT_LENGTH + 2]<<8
|
300
|
|
- | Bank1data[MBIC_BOOT_LENGTH + 3]);
|
301
|
|
-
|
302
|
|
- if(CrcLength > 0 && CrcLength <= 0x1FFFF ){
|
303
|
|
- printf("Bank 1 Crc ret : %x Length : %x : %d \r\n",crcret ,CrcLength,CrcLength);
|
304
|
|
- crcret = CRC16_Generate(Bank1data, CrcLength + 128);
|
305
|
|
- }
|
306
|
|
- CrcLength += 128;
|
307
|
|
- printf("Bank 1 Crc ret : %x Length : %x : %d \r\n",crcret ,CrcLength,CrcLength);
|
308
|
|
-
|
309
|
|
- CrcLength=
|
310
|
|
- ((Bank2data[MBIC_BOOT_LENGTH] << 24 )
|
311
|
|
- | Bank2data[MBIC_BOOT_LENGTH + 1]<<16
|
312
|
|
- | Bank2data[MBIC_BOOT_LENGTH + 2]<<8
|
313
|
|
- | Bank2data[MBIC_BOOT_LENGTH + 3]);
|
314
|
|
- printf("address : %x \r\n",Bank2data[0]);
|
315
|
|
-
|
316
|
|
- printf("Bank 2 Crc ret : %x Length : %x : %d \r\n", crcret,CrcLength,CrcLength );
|
317
|
|
- CrcLength += 128;
|
318
|
|
- if(CrcLength > 0 && CrcLength <= 0x1FFFF )
|
319
|
|
- crcret = CRC16_Generate(Bank2data, CrcLength );
|
320
|
|
- printf("Bank 2 Crc ret : %x Length : %x : %d \r\n", crcret,CrcLength,CrcLength );
|
321
|
|
-#endif // PYJ.2020.07.13_END --
|
322
|
283
|
|
323
|
284
|
PE43711_PinInit();
|
324
|
285
|
EEPROM_M24C08_Init();
|
325
|
286
|
Flash_InitRead();
|
326
|
287
|
Booting_LedInit();
|
327
|
|
-// Booting_LED_Check();
|
328
|
288
|
InitUartQueue(&TerminalQueue);
|
329
|
289
|
|
330
|
|
-#if 0 // PYJ.2020.04.22_BEGIN --
|
331
|
|
- EEPROM_M24C08_write(0xA0,0,i2cTestData,1);
|
332
|
|
- printf("i2c Test Data1 %d\r\n",i2ctest[0]);
|
333
|
|
- EEPROM_M24C08_Read(0xA0,0x00,i2ctest,2);
|
334
|
|
- printf("i2c Test Data2 %d\r\n",i2ctest[0]);
|
335
|
|
- printf("i2c Test Data2 %d\r\n",i2ctest[1]);
|
336
|
|
- /* USER CODE END 2 */
|
337
|
|
-
|
338
|
|
- /* Infinite loop */
|
339
|
|
- /* USER CODE BEGIN WHILE */
|
340
|
|
-// uint16_t ret = 0;
|
341
|
|
-// EEPROMTEST_J();
|
342
|
|
-// eepromtest_j1();
|
343
|
|
-// eepromtest_j1();
|
344
|
|
-// uint8_t retdate[10] = {0,1,2,3,4,5,6,7,8,9};
|
345
|
|
-// uint16_t rrrrrr = 0;
|
346
|
|
-// rrrrrr = ((CRC16_Generate(&retdate[0], 10)));
|
347
|
|
-// printf("CRC : %x \r\n",rrrrrr);
|
348
|
|
-// Bluecell_DataInit();
|
349
|
|
-// Bluecell_AttenInitialize();
|
350
|
|
-#endif // PYJ.2020.04.22_END --
|
351
|
|
-
|
352
|
|
-// uint16_t CrcLength = ((data2[MBIC_LENGTH_0] << 8 ) | data2[MBIC_LENGTH_1] );
|
353
|
|
-// uint16_t crcret = CRC16_Generate(&data2[MBIC_PAYLOADSTART], CrcLength);
|
354
|
|
-// printf("data2 : %X size %d \r\n",crcret,CrcLength );
|
355
|
|
-
|
356
|
|
-// while(1);
|
|
290
|
+
|
|
291
|
+
|
357
|
292
|
#if 1 // PYJ.2020.05.06_BEGIN --
|
358
|
|
-
|
359
|
|
- printf("****************************************\r\n");
|
360
|
|
- printf("MBIC Project\r\n");
|
361
|
|
- printf("Build at %s %s\r\n", __DATE__, __TIME__);
|
362
|
|
- printf("Copyright (c) 2020. BLUECELL\r\n");
|
363
|
|
- printf("****************************************\r\n");
|
|
293
|
+ printf("****************************************\r\n");
|
|
294
|
+ printf("MBIC Project\r\n");
|
|
295
|
+ printf("Build at %s %s\r\n", __DATE__, __TIME__);
|
|
296
|
+ printf("Copyright (c) 2020. BLUECELL\r\n");
|
|
297
|
+ printf("****************************************\r\n");
|
364
|
298
|
#endif // PYJ.2020.05.06_END --
|
365
|
|
-#if 0 // PYJ.2020.06.24_BEGIN --
|
366
|
299
|
|
367
|
|
-// Bank_Flash_write(data,FLASH_USER_TEMPBANK_START_ADDR);
|
368
|
|
-// Bank_Flash_write(data,FLASH_USER_START_ADDR);
|
369
|
|
-
|
370
|
|
-//
|
371
|
|
-// printf("Bootloader Test File \r\n");
|
372
|
|
-// while(1);
|
373
|
|
-#endif // PYJ.2020.06.24_END --
|
374
|
|
-
|
375
|
|
- printf("PCB Version : %d.%d \r\n",bluecell_Currdatastatus.PCB_Version[0],bluecell_Currdatastatus.PCB_Version[1]);
|
376
|
|
- printf("Serial Number : ");
|
377
|
|
- for(int a = 0; a < 20; a++){
|
378
|
|
- printf("%c",bluecell_Currdatastatus.Serial_Number[a]);
|
379
|
|
- }
|
380
|
|
- printf("\r\n");
|
381
|
|
- printf("Manufacture_Date : ");
|
382
|
|
- for(int a = 0; a < 3; a++){
|
383
|
|
- printf("%c",bluecell_Currdatastatus.Manufacture_Date[a]);
|
384
|
|
- }
|
385
|
|
- printf("\r\n");
|
386
|
|
-
|
387
|
|
-
|
388
|
|
-
|
389
|
|
- //NVIC_SystemReset();
|
390
|
|
-
|
391
|
|
-//
|
392
|
300
|
while (1)
|
393
|
301
|
{
|
394
|
|
-// HAL_GPIO_TogglePin(GPIOG,GPIO_PIN_14);
|
395
|
|
- // printf("data %d\r\n",LedTimerCnt);
|
396
|
302
|
Boot_LED_Toggle(); /*LED Check*/
|
397
|
303
|
Uart_Check(); /*Usart Rx*/
|
398
|
304
|
ALC_Function(); /*ALC Function*/
|
|
@@ -401,9 +307,6 @@ int main(void)
|
401
|
307
|
Alarm_Check(); /*Function to check all alarm status variables*/
|
402
|
308
|
FRBT_Operate();
|
403
|
309
|
SelfTestTimer_Operate();
|
404
|
|
-
|
405
|
|
-// Uart1_Data_Send("A",1);
|
406
|
|
-// HAL_Delay(1);
|
407
|
310
|
/* USER CODE END WHILE */
|
408
|
311
|
|
409
|
312
|
/* USER CODE BEGIN 3 */
|