embeded/Cortex-M3 STM2025. 12. 9. 23:03

하드웨어로 구현된거라 소프트웨어로 루프돌리는것 보다 빠르다는게 장점인데 대충(?) 60배 빠르다고 한다.

[링크 : https://www.st.com/resource/en/application_note/an4187-using-the-crc-peripheral-on-stm32-microcontrollers-stmicroelectronics.pdf]

 

hcrc 라는 핸들이 선언되어 있고

HAL_CRC_Calcuate() 함수를 이용해서 바로 리턴을 받는 구조인 듯.

/* Private variables ---------------------------------------------------------*/
CRC_HandleTypeDef hcrc;

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;
}

[링크 : https://cpattern.tistory.com/218]

[링크 : https://m.blog.naver.com/sheld2/222346016827] crc32 와 동일하게 나오게 하려면 수정 필요

[링크 : https://blog.naver.com/eziya76/221507312819]

 

[링크 : https://community.st.com/t5/stm32-mcus/crc-computation-in-stm32-mcus-and-post-build-creation/ta-p/49710]

 

CRC calculation unit, 96-bit unique ID

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.

[링크 : https://www.st.com/resource/en/datasheet/stm32f103rc.pdf]

'embeded > Cortex-M3 STM' 카테고리의 다른 글

stm32f103ret middleware - usb  (0) 2025.12.09
stm32f103ret connectivity - usb  (0) 2025.12.09
STSW-STM32084 / usb demo  (0) 2025.12.09
stlink v2 클론 도착!  (0) 2025.11.26
stm32 cubeide git commit hash  (0) 2025.11.24
Posted by 구차니
embeded/Cortex-M3 STM2025. 12. 9. 17:02

쭈욱 눌러보는데 저 FS가 Full Speed(12Mbps) 였군..

아무튼 지원가능한 클래스는 6가지이다. DFU로도 쓰면서 HID로 쓰고.. 이런식의 구성은 안될 것 같다.

 

Audio Deivce Class

 

샘플링 주파수는 250 ~ 48000 sample/s  이 가능하다. 내장  ADC를 어떻게 잘(?) 굴리면 48k 까지 가능하려나?

 

Communication Device Class (Virtual Port)

그래도 가상 com port인데 baudrate이 없네?

 

Download Firmware Update Class (DFU)

펍웨어 업로드 할때 쓰기 좋은 DFU 클래스.

USBD_DFU_MEDIA interface 는 무슨 의미이려나? Kg 써있으니 몸무게 같네

@Internal Flash   /0x08000000/03*016Ka,01*016Kg,01*064Kg,07*128Kg,04*016Kg,01*064Kg,07*128Kg

 

Human Interface Device Class (HID)

가상 키보드, 마우스, 조이스틱 만들기 좋은 HID 클래스

 

Custom Human Interface Device Class

HID랑 머가 다르려나? class parameter에 IN ENDPOINT, OUT ENDPOINT가 추가 되긴하는데..

송수신이 가능한 HID인가?

 

Mass Storage Class

microSD hat 붙이면 SD 플래시 메모리 만들수 있겠군

 

'embeded > Cortex-M3 STM' 카테고리의 다른 글

stm32f103ret crc  (0) 2025.12.09
stm32f103ret connectivity - usb  (0) 2025.12.09
STSW-STM32084 / usb demo  (0) 2025.12.09
stlink v2 클론 도착!  (0) 2025.11.26
stm32 cubeide git commit hash  (0) 2025.11.24
Posted by 구차니
embeded/Cortex-M3 STM2025. 12. 9. 16:45

23새 프로젝트 생성해서 이것저것 눌러보고 있는 중인데 USB는 무조건 48MHz가 들어가야 하나보다.

 

 

그 와중에 APB1 클럭은 10~36Mhz는 들어가야 하는 제약이라니

 

그 와중에  PLL source는 HSE만 허용한다고.. 왜 활성화 안되냐고!

 

먼가 꼬였었는지 RCC 설정이 없었는데 다시 ioc 파일 열고 외부 클럭 하니 이제야 된다.

USB를 쓰려면 PLL 클럭이 있어야 하고 그러려면 외부 클럭이 있어야 한다.

 

USB FS 활성화 하니 PA11 / PA12 가 설정된다.

 

Full Speed 12MB/s 만 선택지에 있고(USB FS - Full Speed)

Link Power Management를 활성화 하려면 Low Power를 Enable 해주어야 한다.

Battery Charging은 멀 하던 Enable 할 수 없네

 

NVIC Settings 제외하면 딱히 설정할 내용이 없긴한다.

 

'embeded > Cortex-M3 STM' 카테고리의 다른 글

stm32f103ret crc  (0) 2025.12.09
stm32f103ret middleware - usb  (0) 2025.12.09
STSW-STM32084 / usb demo  (0) 2025.12.09
stlink v2 클론 도착!  (0) 2025.11.26
stm32 cubeide git commit hash  (0) 2025.11.24
Posted by 구차니
embeded/Cortex-M3 STM2025. 12. 9. 16:43

 

[링크 : https://www.st.com/en/microcontrollers-microprocessors/stm32f103re.html]

 

받아보니 윈도우용.. OTL

[링크 : https://www.st.com/en/development-tools/stsw-stm32084.html#overview]

 

STM32F103RET 인데 USB Prescaler / To USB 가 있었네?

 

핀을 쓰고 있어서 활성화는 안되는데 Device (FS) 만 보인다.

File system인줄 알았는데 Fast Speed (12Mbps) 인 듯.

 

[링크 : https://blog.naver.com/eziya76/220945711310]

'embeded > Cortex-M3 STM' 카테고리의 다른 글

stm32f103ret middleware - usb  (0) 2025.12.09
stm32f103ret connectivity - usb  (0) 2025.12.09
stlink v2 클론 도착!  (0) 2025.11.26
stm32 cubeide git commit hash  (0) 2025.11.24
stm32f103c8t6 blue pill board  (0) 2025.11.22
Posted by 구차니
embeded/Cortex-M3 STM2025. 11. 26. 17:43

좀 더 써봐야 알겠지만, STM32F103C8T6과 STLink v2 클론 SWD로 작동 확인완료!

그나저나 reset은 안해놔서 리셋이 될지 모르겠네

 

'embeded > Cortex-M3 STM' 카테고리의 다른 글

stm32f103ret connectivity - usb  (0) 2025.12.09
STSW-STM32084 / usb demo  (0) 2025.12.09
stm32 cubeide git commit hash  (0) 2025.11.24
stm32f103c8t6 blue pill board  (0) 2025.11.22
stm32f103 usb c 연결 + usb ttl 연결  (0) 2025.11.22
Posted by 구차니
embeded/Cortex-M3 STM2025. 11. 24. 19:08

pre-build steps 에서 명령을 주어 특정 파일을 행성해서 그 변수에 값을 넣어주는 방식

머.. 어짜피 이것도 makefile로 생성될테니 방법은 방법이지

 

 

git log --pretty=format:'#define GIT_INFO_PRESENT%n static const char* GIT_INFO = "Version Information=[%H,%d]\r\n";' -n 1 > ../Core/Inc/gitcommit.h

[링크 : https://community.st.com/t5/stm32-mcus-embedded-software/git-commit-hash-flashed-along-with-my-code/td-p/179180]

'embeded > Cortex-M3 STM' 카테고리의 다른 글

STSW-STM32084 / usb demo  (0) 2025.12.09
stlink v2 클론 도착!  (0) 2025.11.26
stm32f103c8t6 blue pill board  (0) 2025.11.22
stm32f103 usb c 연결 + usb ttl 연결  (0) 2025.11.22
stm32f103 dfu (Device Firmware Upgrade)  (0) 2025.11.19
Posted by 구차니
embeded/Cortex-M3 STM2025. 11. 22. 20:26

예제

[링크 : https://github.com/miniwinwm/BluePillDemo]

 

ATMEL AVR 아두이노 대신 stm32를 넣기 시작한게 bluepill 인가..?

[링크 : https://deepbluembedded.com/stm32-blue-pill-pinout-programming-guide/]

 

c8과 c6 두가지가 있다는데 플래시와 메모리 용량이 차이가 많이 난다.

  • Arm® 32-bit Cortex®-M3 CPU core
    • 72 MHz maximum frequency, 1.25 DMIPS/MHz (Dhrystone 2.1) performance at 0 wait state memory access
    • Single-cycle multiplication and hardware division
  • Memories
    • 64 or 128 Kbytes of Flash memory
    • 20 Kbytes of SRAM

[링크 : https://www.st.com/en/microcontrollers-microprocessors/stm32f103c8.html]

 

  • ARM 32-bit Cortex™-M3 CPU Core
    • 72 MHz maximum frequency,1.25 DMIPS/MHz (Dhrystone 2.1) performance at 0 wait state memory access
    • Single-cycle multiplication and hardware division
  • Memories
    • 16 or 32 Kbytes of Flash memory
    • 6 or 10 Kbytes of SRAM

[링크 : https://www.st.com/en/microcontrollers-microprocessors/stm32f103c6.html]

Posted by 구차니
embeded/Cortex-M3 STM2025. 11. 22. 19:40

단순하게 전원만 연결되는줄 알았는데

윈도우에서는 잘못된 장치라고 떠서, 리눅스에서 확인

 

boot0 - 0  / boot1 - 0 에 usb 연결

[   50.788963] usb 1-1.1: new full-speed USB device number 4 using ehci-pci
[   50.853992] usb 1-1.1: device descriptor read/64, error -32
[   51.023960] usb 1-1.1: device descriptor read/64, error -32
[   51.196938] usb 1-1.1: new full-speed USB device number 5 using ehci-pci
[   51.261946] usb 1-1.1: device descriptor read/64, error -32
[   51.429943] usb 1-1.1: device descriptor read/64, error -32
[   51.533019] usb 1-1-port1: attempt power cycle
[   52.113007] usb 1-1.1: new full-speed USB device number 6 using ehci-pci
[   52.524932] usb 1-1.1: device not accepting address 6, error -32
[   52.589928] usb 1-1.1: new full-speed USB device number 7 using ehci-pci
[   53.004924] usb 1-1.1: device not accepting address 7, error -32
[   53.005142] usb 1-1-port1: unable to enumerate USB device

 

boot0 - 1 / boot1 - 0에 usb 연결. 차이는 없다.

[  225.014866] usb 1-1.1: new full-speed USB device number 8 using ehci-pci
[  225.079866] usb 1-1.1: device descriptor read/64, error -32
[  225.253817] usb 1-1.1: device descriptor read/64, error -32
[  225.420787] usb 1-1.1: new full-speed USB device number 9 using ehci-pci
[  225.485801] usb 1-1.1: device descriptor read/64, error -32
[  225.654762] usb 1-1.1: device descriptor read/64, error -32
[  225.756872] usb 1-1-port1: attempt power cycle
[  226.337664] usb 1-1.1: new full-speed USB device number 10 using ehci-pci
[  226.756996] usb 1-1.1: device not accepting address 10, error -32
[  226.820602] usb 1-1.1: new full-speed USB device number 11 using ehci-pci
[  227.236577] usb 1-1.1: device not accepting address 11, error -32
[  227.236751] usb 1-1-port1: unable to enumerate USB device

 

 

일단 PA9이 USART1_TX / PA10이 USART1_RX니까 USB TTL을 이용해서 적당히 연결해줘본다.

[링크 : https://www.st.com/resource/en/datasheet/stm32f103c8.pdf]

 

USB TTL이 /dev/ttyUSB0으로 인식해서 설정하고 읽어보면 잘 읽힌다.

$ stm32flash /dev/ttyUSB0
stm32flash 0.5

http://stm32flash.sourceforge.net/

Interface serial_posix: 57600 8E1
Warning: the interface was not closed properly.
Version      : 0x30
Option 1     : 0x00
Option 2     : 0x00
Device ID    : 0x0410 (STM32F10xxx Medium-density)
- RAM        : Up to 20KiB  (512b reserved by bootloader)
- Flash      : Up to 128KiB (size first sector: 4x1024)
- Option RAM : 16b
- System RAM : 2KiB

 

프로그램이 없어서 그런가 boot0 - 0, boot1 - 0 으로 되어있어도 내부 부트로더가 작동한다.

[링크 : https://eteo.tistory.com/417]

 

무언가 구으면 boot0 - 1, boot1 - 0 으로 하고 리셋눌러줘야 stm32flash에 응답한다.

'embeded > Cortex-M3 STM' 카테고리의 다른 글

stm32 cubeide git commit hash  (0) 2025.11.24
stm32f103c8t6 blue pill board  (0) 2025.11.22
stm32f103 dfu (Device Firmware Upgrade)  (0) 2025.11.19
stn32f103 usb cdc(communication device class)  (0) 2025.11.19
stm32f103 도착  (0) 2025.11.19
Posted by 구차니
embeded/Cortex-M3 STM2025. 11. 19. 19:47

리눅스/우분투

[링크 : https://manpages.ubuntu.com/manpages/xenial//man1/dfu-util.1.html]

 

윈도우

Description

STSW-STM32080 package contains all binaries and source code for DfuSe USB device firmware upgrade (DFU) software, including the demonstration, debugging GUIs and protocol layers.
It includes the DFU driver compatible with the latest Microsoft®OS.
DfuSe utility can be used to interact with the STM32 system memory bootloader or any In-Application Programming (IAP) firmware, running from the user Flash, thus allowing internal memories programming through USB.
All source files for Microsoft®Visual Studio 2012 are provided as well, to allow the customization of the default GUI interface.
  • All features

    • DfuSE USB Programming
    • Command line version
    • All binaries and sources provided
 

[링크 : https://www.st.com/en/development-tools/stsw-stm32080.html]

 

[링크 : https://community.st.com/t5/stm32cubeide-mcus/programming-stm32-in-bootloader-mode-under-linux/td-p/277572]

[링크 : https://www.os4all.com/m/70]

[링크 : https://www.os4all.com/m/69]

 

dfu 부트로더

[링크 : https://bigcoco.tistory.com/m/6]

 

 

'embeded > Cortex-M3 STM' 카테고리의 다른 글

stm32f103c8t6 blue pill board  (0) 2025.11.22
stm32f103 usb c 연결 + usb ttl 연결  (0) 2025.11.22
stn32f103 usb cdc(communication device class)  (0) 2025.11.19
stm32f103 도착  (0) 2025.11.19
stm32 리셋없이 디버그 붙이기  (0) 2025.11.11
Posted by 구차니
embeded/Cortex-M3 STM2025. 11. 19. 19:39

간단하게.. ft232 같은 것 없어도 usb를 통해서 바로 통신이 가능한 com 포트를 생성해주는 기능

cubeIDE에서 따라해봐야겠다.

[링크 : https://jeonhj.tistory.com/m/29]

 

 

 

PA11 / PA12가 CAN or USB 포트로 사용을 해야 하는것 같군..

[링크 : https://www.st.com/resource/en/datasheet/stm32f103c8.pdf]

[링크 : https://www.st.com/en/microcontrollers-microprocessors/stm32f103c8.html]

 

 

뚫어져라 보니

B7 / A6 + B8 으로 연결되어서 쭈욱 따라가니 A11 / A12로 연결된 듯.

[링크 : https://electronics.stackexchange.com/questions/610007/how-to-wire-usb-c-connector]

'embeded > Cortex-M3 STM' 카테고리의 다른 글

stm32f103 usb c 연결 + usb ttl 연결  (0) 2025.11.22
stm32f103 dfu (Device Firmware Upgrade)  (0) 2025.11.19
stm32f103 도착  (0) 2025.11.19
stm32 리셋없이 디버그 붙이기  (0) 2025.11.11
stm32 adc + dma.. part 2?  (0) 2025.10.29
Posted by 구차니