$ sudo demsg -w [25664.443438] usb 1-2: new full-speed USB device number 26 using xhci_hcd [25664.574720] usb 1-2: New USB device found, idVendor=0483, idProduct=5740, bcdDevice= 2.00 [25664.574741] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [25664.574748] usb 1-2: Product: STM32 Virtual ComPort [25664.574754] usb 1-2: Manufacturer: STMicroelectronics [25664.579419] cdc_acm 1-2:1.0: ttyACM0: USB ACM device
$ lsusb -t -v /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M ID 1d6b:0002 Linux Foundation 2.0 root hub |__ Port 2: Dev 26, If 0, Class=Communications, Driver=cdc_acm, 12M ID 0483:5740 STMicroelectronics Virtual COM Port |__ Port 2: Dev 26, If 1, Class=CDC Data, Driver=cdc_acm, 12M ID 0483:5740 STMicroelectronics Virtual COM Port
minicom은 9600으로 하던 115200 으로 하던 동일하게 값이 잘 들어온다. 신기하네
다만 많은 데이터가 있을때는 어떻게 될 진 미지수. 나중에 테스트 해봐야지
1회 굽기는 되는데 그 이후로 rebooting이 안될 때
step 1. reset 누르고 connect 누르고 reset 뗀다음 full chip erase
step 2. cubeide에서 swd 핀 할당해주기
"no debug" 로 두면 PA13/PA14가 주황색으로 되는데, 그러면 계속 retry 뜨니까 Serial Wire로 변경해준다.(SWO)
이건 실패시
STMicroelectronics ST-LINK GDB server. Version 7.8.0 Copyright (c) 2024, STMicroelectronics. All rights reserved.
Starting server with the following options: Persistent Mode : Disabled Logging Level : 1 Listen Port Number : 61234 Status Refresh Delay : 15s Verbose Mode : Disabled SWD Debug : Enabled
Waiting for debugger connection... Debugger connected Waiting for debugger connection... Debugger connected Waiting for debugger connection... ------------------------------------------------------------------- STM32CubeProgrammer v2.17.0 -------------------------------------------------------------------
Log output file: /tmp/STM32CubeProgrammer_RFILwX.log ST-LINK SN : 31000D000D2D343632525544 ST-LINK FW : V2J45S7 Board : -- Voltage : 3.21V SWD freq : 4000 KHz Connect mode: Under Reset Reset mode : Hardware reset Device ID : 0x410 Revision ID : Rev X Device name : STM32F101/F102/F103 Medium-density Flash size : 128 KBytes Device type : MCU Device CPU : Cortex-M3 BL Version : --
Erasing memory corresponding to segment 0: Erasing internal memory sectors [0 31] Download in Progress:
File download complete Time elapsed during download operation: 00:00:01.365
Verifying ...
Download verified successfully
Shutting down... Target is not responding, retrying... Target is not responding, retrying... Target is not responding, retrying... Target is not responding, retrying... Target is not responding, retrying...
이건 설정해주고 잘 될 때
STMicroelectronics ST-LINK GDB server. Version 7.8.0 Copyright (c) 2024, STMicroelectronics. All rights reserved.
Starting server with the following options: Persistent Mode : Disabled Logging Level : 1 Listen Port Number : 61234 Status Refresh Delay : 15s Verbose Mode : Disabled SWD Debug : Enabled
Waiting for debugger connection... Debugger connected Waiting for debugger connection... Debugger connected Waiting for debugger connection... ------------------------------------------------------------------- STM32CubeProgrammer v2.17.0 -------------------------------------------------------------------
Log output file: /tmp/STM32CubeProgrammer_0DypHa.log ST-LINK SN : 31000D000D2D343632525544 ST-LINK FW : V2J45S7 Board : -- Voltage : 3.21V SWD freq : 4000 KHz Connect mode: Under Reset Reset mode : Hardware reset Device ID : 0x410 Revision ID : Rev X Device name : STM32F101/F102/F103 Medium-density Flash size : 128 KBytes Device type : MCU Device CPU : Cortex-M3 BL Version : --
uint32_t HAL_CRC_Calculate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength) { uint32_t index; /* CRC input data buffer index */ uint32_t temp = 0U; /* CRC output (read from hcrc->Instance->DR register) */
/* Change CRC peripheral state */ hcrc->State = HAL_CRC_STATE_BUSY;
/* Reset CRC Calculation Unit (hcrc->Instance->INIT is * written in hcrc->Instance->DR) */ __HAL_CRC_DR_RESET(hcrc);
/* Enter 32-bit input data to the CRC calculator */ for (index = 0U; index < BufferLength; index++) { hcrc->Instance->DR = pBuffer[index]; } temp = hcrc->Instance->DR;
/* Change CRC peripheral state */ hcrc->State = HAL_CRC_STATE_READY;
/* Return the CRC computed value */ return temp; }
2.3.3 CRC (cyclic redundancy check) calculation unit The CRC (cyclic redundancy check) calculation unit is used to get a CRC code from a 32-bit data word and a fixed generator polynomial. Among other applications, CRC-based techniques are used to verify data transmission or storage integrity. In the scope of the EN/IEC 60335-1 standard, they offer a means of verifying the Flash memory integrity. The CRC calculation unit helps compute a signature of the software during runtime, to be compared with a reference signature generated at linktime and stored at a given memory location.