본문으로 건너뛰기
Modern Embedded Recipes · 59/153

USB Device 기초 — TinyUSB CDC·Descriptor·STM32F407 OTG_FS

· Hawk · 9분 읽기

#한 줄 요약

“이 글의 USB 쪽 애플리케이션 코드는 descriptor callback 세 개와 tud_cdc_* 호출이 전부입니다.” control transfer, enumeration, endpoint FIFO는 TinyUSB 같은 stack이 맡고, 애플리케이션은 자신이 어떤 device인지 descriptor로 적고 class API로 data를 주고받습니다.

#어떤 상황에서 쓰나

보드를 PC에 USB로 꽂아 serial 콘솔처럼 쓰고 싶을 때 CDC ACM class를 씁니다. Linux의 cdc_acm driver가 이 class를 받아 /dev/ttyACM*를 만듭니다.

이 글은 STM32F407의 OTG_FS로 받은 byte를 그대로 돌려주는 CDC echo device를 TinyUSB 0.18.0으로 만듭니다. 세 파일(tusb_config.h, usb_descriptors.c, main.c)과 빌드 명령을 그대로 옮기면 같은 크기의 ELF가 나옵니다. descriptor byte는 host에서 같은 파일을 컴파일해 풀었습니다. 실제 보드를 PC에 꽂아 enumeration한 결과는 없습니다. QEMU에는 STM32의 OTG_FS model이 없습니다.

#핵심 개념

#STM32F407 OTG_FS

STM32F407 datasheet(DS8626 Rev 4) 2.2.30절과 Table 58에서 이 글에 필요한 값만 옮겼습니다.

항목값
peripheral“USB OTG full-speed device/host/OTG peripheral with integrated transceivers”, USB 2.0 준수
clock“requires a dedicated 48 MHz clock that is generated by a PLL connected to the HSE oscillator”
endpoint“4 bidirectional endpoints”
FIFO“Combined Rx and Tx FIFO size of 320 × 35 bits”
핀PA11 = DM, PA12 = DP (AF10)
DP pull-up (RPU, PA12)1.5 / 1.8 / 2.1 kΩ (min / typ / max), chip 내부
USB 동작 전압VDD 3.0 ~ 3.6 V

48 MHz는 4-04의 PLL 설정(HSE 8 MHz, M = 8, N = 336, Q = 7 → 336 / 7 = 48 MHz)이 이미 만듭니다. DP pull-up이 chip 안에 있으므로 외부 1.5 kΩ는 달지 않습니다. TinyUSB는 dcd_connect()에서 DCTL의 SDIS bit를 지워 이 pull-up을 켭니다. ST LL은 같은 동작을 “Connect the USB device by enabling Rpu”라고 적습니다.

#Descriptor

enumeration에서 host는 device descriptor, configuration descriptor, string descriptor를 차례로 GET_DESCRIPTOR로 읽고, 그 안의 class code로 driver를 고릅니다. 아래 usb_descriptors.c가 만드는 byte를 host에서 풀면 이렇습니다(다음 절의 실행 결과).

descriptor이 글의 값뜻
Deviceclass 0xEF / subclass 0x02 / protocol 0x01Miscellaneous + IAD: interface들을 묶는 IAD가 있다는 표시
DeviceVID 0xCAFE, PID 0x4001TinyUSB 예제가 쓰는 값. 시험 전용
ConfigurationwTotalLength 75, 2 interfaces, bmAttributes 0x80, bMaxPower 0x3275 = TUD_CONFIG_DESC_LEN(9) + TUD_CDC_DESC_LEN(66), bMaxPower는 2 mA 단위라 100 mA
IAD (type 0x0B)interface 0부터 2개, class 0x02CDC 두 interface를 한 기능으로 묶음
Interface 0class 0x02 (CDC), subclass 0x02 (ACM), endpoint 1개제어 interface
Endpoint 0x81interrupt, 8 byte, interval 16상태 알림
Interface 1class 0x0A (CDC Data), endpoint 2개data interface
Endpoint 0x02 / 0x82bulk, 64 bytedata OUT / IN

TUD_CONFIG_DESCRIPTOR()는 bmAttributes에 TU_BIT(7) | _attribute를 쓰고 bMaxPower에 (_power_ma)/2를 쓰므로, 인자 0x00·100이 0x80·0x32가 됩니다. class code는 TinyUSB tusb_types.h의 TUSB_CLASS_CDC = 2, TUSB_CLASS_CDC_DATA = 10, TUSB_CLASS_MISC = 0xEF입니다.

VID는 USB-IF가 할당하는 값입니다. 0xCAFE는 TinyUSB 예제의 값이라 제품에 쓰지 않습니다.

#코드 예제

#1. tusb_config.h

tusb_config.h
#ifndef TUSB_CONFIG_H
#define TUSB_CONFIG_H
#define CFG_TUSB_MCU OPT_MCU_STM32F4
#define CFG_TUSB_OS OPT_OS_NONE
#define CFG_TUD_ENABLED 1
#define CFG_TUD_MAX_SPEED OPT_MODE_FULL_SPEED
#define CFG_TUD_ENDPOINT0_SIZE 64
#define CFG_TUD_CDC 1
#define CFG_TUD_CDC_RX_BUFSIZE 64
#define CFG_TUD_CDC_TX_BUFSIZE 64
#define CFG_TUD_CDC_EP_BUFSIZE 64
#endif

CFG_TUSB_MCU = OPT_MCU_STM32F4가 TinyUSB에 Synopsys DWC2 core driver(dcd_dwc2.c)를 고르게 합니다. tusb.h는 tusb_time_millis_api()를 RTOS 없는 일부 port·구성에서 필요한 함수로 적습니다. 이 빌드에서는 부르는 곳이 없어 --gc-sections로 빠지지만, 다른 port로 옮길 때를 위해 main.c에 둡니다.

#2. usb_descriptors.c

usb_descriptors.c
#include <string.h>
#include "tusb.h"
static tusb_desc_device_t const desc_device = {
.bLength = sizeof(tusb_desc_device_t),
.bDescriptorType = TUSB_DESC_DEVICE,
.bcdUSB = 0x0200,
.bDeviceClass = TUSB_CLASS_MISC, // CDC uses two interfaces:
.bDeviceSubClass = MISC_SUBCLASS_COMMON, // group them with an IAD
.bDeviceProtocol = MISC_PROTOCOL_IAD,
.bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
.idVendor = 0xCafe, // TinyUSB example VID, test only
.idProduct = 0x4001,
.bcdDevice = 0x0100,
.iManufacturer = 1,
.iProduct = 2,
.iSerialNumber = 3,
.bNumConfigurations = 1,
};
enum { ITF_CDC_CTRL, ITF_CDC_DATA, ITF_TOTAL };
#define CONFIG_TOTAL_LEN (TUD_CONFIG_DESC_LEN + TUD_CDC_DESC_LEN)
static uint8_t const desc_configuration[] = {
// config 1, interfaces, string 0, total length, attributes, 100 mA
TUD_CONFIG_DESCRIPTOR(1, ITF_TOTAL, 0, CONFIG_TOTAL_LEN, 0x00, 100),
// CDC: interface 0, string 4, notification EP 0x81 (8 B),
// data OUT 0x02, data IN 0x82, 64 B
TUD_CDC_DESCRIPTOR(ITF_CDC_CTRL, 4, 0x81, 8, 0x02, 0x82, 64),
};
uint8_t const *tud_descriptor_device_cb(void) {
return (uint8_t const *)&desc_device;
}
uint8_t const *tud_descriptor_configuration_cb(uint8_t index) {
(void)index;
return desc_configuration;
}
static char const *const strings[] = {
NULL, // 0: language ID, handled below
"Example Maker", // 1: manufacturer
"CDC echo", // 2: product
"0001", // 3: serial
"CDC", // 4: CDC interface
};
static uint16_t desc_str[33];
uint16_t const *tud_descriptor_string_cb(uint8_t index, uint16_t langid) {
(void)langid;
size_t n;
if (index == 0) {
desc_str[1] = 0x0409; // English (United States)
n = 1;
} else {
if (index >= sizeof strings / sizeof strings[0]) return NULL;
n = strlen(strings[index]);
if (n > 32) n = 32;
for (size_t i = 0; i < n; i++) desc_str[1 + i] = (uint8_t)strings[index][i];
}
desc_str[0] = (uint16_t)((TUSB_DESC_STRING << 8) | (2 * n + 2));
return desc_str;
}

TinyUSB는 tud_descriptor_device_cb(), tud_descriptor_configuration_cb(), tud_descriptor_string_cb() 세 callback으로 descriptor를 묻습니다. string descriptor는 UTF-16LE이고 첫 word의 하위 byte가 길이(byte), 상위 byte가 type 0x03입니다. index 0은 지원 언어 목록이라 0x0409(English, United States) 하나를 돌려줍니다.

#3. main.c

main.c
#include "stm32f4xx.h"
#include "tusb.h"
#include "gpio.h"
void clock_init_168mhz(void); // 4-04: SYSCLK 168 MHz, PLLQ 48 MHz
static volatile uint32_t ms_ticks;
void SysTick_Handler(void) { ms_ticks++; }
uint32_t tusb_time_millis_api(void) { return ms_ticks; }
void OTG_FS_IRQHandler(void) { tusb_int_handler(0, true); }
static void usb_hw_init(void) {
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN;
// PA11 = OTG_FS_DM, PA12 = OTG_FS_DP, AF10
gpio_init(GPIOA, 11, &(gpio_config_t){.mode=GPIO_MODE_AF, .speed=GPIO_SPEED_VH, .af=10});
gpio_init(GPIOA, 12, &(gpio_config_t){.mode=GPIO_MODE_AF, .speed=GPIO_SPEED_VH, .af=10});
RCC->AHB2ENR |= RCC_AHB2ENR_OTGFSEN;
// no VBUS on PA9: treat VBUS as always valid (ST LL USB_DevInit, F405/F407)
USB_OTG_FS->GCCFG |= USB_OTG_GCCFG_NOVBUSSENS;
USB_OTG_FS->GCCFG &= ~(USB_OTG_GCCFG_VBUSBSEN | USB_OTG_GCCFG_VBUSASEN);
}
int main(void) {
clock_init_168mhz();
SysTick_Config(168000000u / 1000u);
usb_hw_init();
tusb_rhport_init_t dev_init = { .role = TUSB_ROLE_DEVICE, .speed = TUSB_SPEED_AUTO };
tusb_init(0, &dev_init);
for (;;) {
tud_task(); // handles enumeration and class requests
if (tud_cdc_available()) {
uint8_t buf[64];
uint32_t n = tud_cdc_read(buf, sizeof buf);
tud_cdc_write(buf, n); // echo
tud_cdc_write_flush();
}
}
}

clock_init_168mhz()는 4-04, gpio_init()은 4-03에서 가져옵니다. OTG_FS_IRQHandler의 이름은 CMSIS startup_stm32f407xx.s의 vector table 이름과 같아야 합니다. TinyUSB의 STM32F4 board 코드(hw/bsp/stm32f4/family.c)도 같은 handler에서 tusb_int_handler(0, true)를 부릅니다.

VBUS 핀(PA9)은 쓰지 않았습니다. TinyUSB dcd_dwc2.c는 초기화에서 GOTGCTL에 BVALOEN·BVALOVAL을 세워 “force B Valid”로 두지만, stm32f407xx.h의 GOTGCTL에는 이 두 bit가 정의돼 있지 않아 F407에서는 효과가 없습니다. 그래서 usb_hw_init()이 ST LL USB_DevInit()의 F405/F407 분기처럼 GCCFG의 NOVBUSSENS를 세우고 VBUSBSEN·VBUSASEN을 지웁니다. ST LL은 이 설정을 “VBUS is internally considered to be always at VBUS-Valid level (5V)“라고 설명하고, TinyUSB의 VBUS 없는 F407 보드(hw/bsp/stm32f4/boards/stm32f407blackvet/board.h)도 같은 두 줄을 씁니다. 대신 케이블을 뽑아도 core가 그것을 VBUS로 알아차리지 못합니다.

#4. 빌드

TinyUSB 0.18.0, CMSIS_6 v6.1.0의 CMSIS/Core/Include, CMSIS device(cmsis-device-f4의 startup_stm32f407xx.s·system_stm32f4xx.c), 그리고 C 라이브러리가 필요합니다. 이 환경의 arm-none-eabi-gcc 16.2.0에는 newlib가 없어 Debian의 picolibc-arm-none-eabi 1.8.10-2 패키지에서 header와 libc.a(thumb/v7e-m/nofp)를 꺼내 썼습니다. linker script는 4-01의 것(FLASH 512 KiB, RAM 128 KiB)입니다.

Terminal window
git clone --depth 1 --branch 0.18.0 https://github.com/hathach/tinyusb.git
T=tinyusb; CMS=cmsis-device-f4; PL=picolibc/usr/lib/picolibc/arm-none-eabi
CF="-mcpu=cortex-m4 -mthumb -mfloat-abi=soft -O2 -Wall -Wextra \
-ffunction-sections -fdata-sections -DSTM32F407xx \
-isystem $PL/include -I src -I $T/src -I CMSIS/Core/Include -I $CMS/Include"
arm-none-eabi-gcc $CF -nostdlib -Wl,--gc-sections -T stm32f411.ld -o cdc.elf \
$CMS/Source/Templates/gcc/startup_stm32f407xx.s \
src/main.c src/usb_descriptors.c src/gpio.c src/clock.c \
$CMS/Source/Templates/system_stm32f4xx.c \
$T/src/tusb.c $T/src/common/tusb_fifo.c \
$T/src/device/usbd.c $T/src/device/usbd_control.c \
$T/src/class/cdc/cdc_device.c \
$T/src/portable/synopsys/dwc2/dcd_dwc2.c $T/src/portable/synopsys/dwc2/dwc2_common.c \
$PL/lib/thumb/v7e-m/nofp/libc.a -lgcc
arm-none-eabi-size cdc.elf
text data bss dec hex filename
12396 21 920 13337 3419 cdc.elf

경고 없이 빌드되고, TinyUSB device stack과 CDC class, DWC2 driver를 합친 이미지가 flash 12.4 KB, RAM(data + bss) 941 byte입니다.

#측정 / 동작 확인

#host에서 descriptor 풀기

usb_descriptors.c를 host(clang)에서 TinyUSB header와 함께 컴파일하고, callback이 돌려주는 byte를 descriptor 길이 단위로 끊어 찍었습니다. host가 enumeration에서 읽는 것과 같은 byte입니다.

desc_dump.c
#include <stdio.h>
#include "tusb.h"
static void dump(const char *name, const uint8_t *p, int n) {
printf("%s (%d bytes)\n", name, n);
for (int off = 0; off < n; off += p[off]) {
printf(" len=%2u type=0x%02X:", p[off], p[off + 1]);
for (int i = 0; i < p[off]; i++) printf(" %02X", p[off + i]);
printf("\n");
if (p[off] == 0) break;
}
}
int main(void) {
const uint8_t *dev = tud_descriptor_device_cb();
dump("device", dev, dev[0]);
const uint8_t *cfg = tud_descriptor_configuration_cb(0);
dump("configuration", cfg, cfg[2] | (cfg[3] << 8));
const uint16_t *s = tud_descriptor_string_cb(2, 0x0409);
printf("string 2: len=%u type=0x%02X \"", s[0] & 0xFF, s[0] >> 8);
for (int i = 1; i < (s[0] & 0xFF) / 2; i++) putchar((char)s[i]);
printf("\"\n");
return 0;
}
Terminal window
clang -O2 -Wall -I src -I tinyusb/src -o desc_dump desc_dump.c src/usb_descriptors.c && ./desc_dump
device (18 bytes)
len=18 type=0x01: 12 01 00 02 EF 02 01 40 FE CA 01 40 00 01 01 02 03 01
configuration (75 bytes)
len= 9 type=0x02: 09 02 4B 00 02 01 00 80 32
len= 8 type=0x0B: 08 0B 00 02 02 02 00 00
len= 9 type=0x04: 09 04 00 00 01 02 02 00 04
len= 5 type=0x24: 05 24 00 20 01
len= 5 type=0x24: 05 24 01 00 01
len= 4 type=0x24: 04 24 02 06
len= 5 type=0x24: 05 24 06 00 01
len= 7 type=0x05: 07 05 81 03 08 00 10
len= 9 type=0x04: 09 04 01 00 02 0A 00 00 00
len= 7 type=0x05: 07 05 02 02 40 00 00
len= 7 type=0x05: 07 05 82 02 40 00 00
string 2: len=18 type=0x03 "CDC echo"

device descriptor의 EF 02 01, configuration의 4B 00(75), 80 32, IAD(type 0x0B), interface의 class 02·0A, endpoint 81 03 08 00 10(interrupt, 8 byte, interval 16)과 02 02 40 00·82 02 40 00(bulk, 64 byte)이 핵심 개념의 표와 같습니다.

#보드에서

보드를 꽂은 뒤 Linux에서 lsusb에 cafe:4001이 보이고, cdc_acm driver(Linux v6.12 drivers/usb/class/cdc-acm.c)가 붙으면 dmesg에 “ttyACM%d: USB ACM device” 형식의 줄이 나옵니다. lsusb -v -d cafe:4001은 위 dump의 값을 field 이름과 함께 풀어 보여 줍니다. 이 글은 보드로 이 단계를 실행하지 않았습니다.

장치가 아예 안 보이면 48 MHz clock(PLLQ)과 PA11/PA12 AF10 설정, VBUS sensing(NOVBUSSENS), OTG_FS_IRQHandler 이름을 봅니다. 보이는데 descriptor 오류가 나면 위 dump로 wTotalLength와 실제 길이가 같은지 봅니다.

#자주 보는 함정

⚠️ 48 MHz가 아님

OTG_FS는 PLL의 Q 출력에서 전용 48 MHz를 받습니다. VCO(M·N)를 바꿔 SYSCLK을 바꾸면서 Q를 그대로 두면 48 MHz가 깨집니다. 4-04가 인용한 HAL stm32f4xx_hal_rcc_ex.h 주석도 USB OTG FS를 쓰면 48 MHz가 되도록 PLLQ를 맞추라고 적습니다.

⚠️ wTotalLength와 실제 길이 불일치

configuration descriptor의 wTotalLength는 뒤따르는 interface·endpoint descriptor를 모두 합한 길이입니다. 위 코드는 TUD_CONFIG_DESC_LEN + TUD_CDC_DESC_LEN으로 계산해 손으로 75를 쓰지 않습니다.

⚠️ 외부 DP pull-up을 또 닮

DS8626의 RPU(PA12)가 이미 1.5 ~ 2.1 kΩ입니다. 외부 pull-up을 더하면 TinyUSB가 SDIS로 연결을 끊어도 DP가 올라가 있어 host가 device를 계속 붙은 것으로 봅니다.

⚠️ interrupt handler 이름 오타

OTG_FS_IRQHandler가 아니면 vector table의 weak default handler가 남아, USB interrupt가 오는 순간 default handler의 무한 loop로 들어갑니다(4-05에서 같은 현상을 QEMU로 보였습니다).

⚠️ 시험용 VID를 제품에 씀

0xCAFE는 TinyUSB 예제의 값입니다. 제품은 USB-IF에서 할당받은 VID를 씁니다.

#정리

  • STM32F407 OTG_FS는 내장 transceiver·내장 DP pull-up·전용 48 MHz(PLLQ)를 갖춥니다.
  • TinyUSB는 **세 descriptor callback + tud_task() + OTG_FS_IRQHandler**로 붙습니다.
  • CDC ACM은 **IAD + 제어 interface(interrupt EP) + data interface(bulk EP 2개)**로 구성되고, wTotalLength는 75입니다.
  • 빌드 결과는 flash 12.4 KB, RAM 941 byte(TinyUSB 0.18.0, -O2).
  • descriptor는 host에서 byte로 풀어 보드 없이도 확인할 수 있습니다.

다음 편은 **Ethernet MAC + PHY (lwIP)**입니다. RMII, MDIO, lwIP raw API, DHCP를 다룹니다.

#관련 항목

Modern Embedded Recipes · 60 of 153 전체 목차
  1. 1 Modern Embedded Recipes — 모던 임베디드 실전 레시피 시리즈 소개
  2. 2 디지털 신호 기초 — Voltage Level·Edge·Noise Margin·반사 분석
  3. 3 임베디드 클럭과 타이밍 — Skew·Jitter·PLL 분석
  4. 4 GPIO 내부 구조 분해 — Push-Pull·Open-Drain·Schmitt Trigger
  5. 5 UART 하드웨어 동작 분석 — Baud Rate·Framing·FIFO
  6. 6 SPI 하드웨어 분석 — Clock Mode·MOSI/MISO·Chip Select
  7. 7 I2C 하드웨어 분석 — Open-Drain·Clock Stretching·Arbitration
  8. 8 ADC 동작 원리 — SAR·Sigma-Delta 비교
  9. 9 DAC 동작 원리 — R-2R Ladder·Sigma-Delta·Settling Time
  10. 10 PWM 신호 생성 분석 — Duty·Frequency·Dead Time·Center-Aligned
  11. 11 CAN 버스 전기적 특성 — 종단·전압 레벨·GND 전위차와 1 Mbit/s 버스 길이 예산
  12. 12 RS-485·RS-422 차동 신호 분석 — Termination·Biasing·Topology
  13. 13 LVDS 차동 신호 분석 — Common-Mode·Impedance·Eye Pattern
  14. 14 ARM Cortex-M 시리즈 비교 — M0·M3·M4·M7·M33·M55 분석
  15. 15 ARM Cortex-A 시리즈 비교 — A53·A55·A72·A78·X1 분석
  16. 16 Cortex-M 레지스터 구조 분석 — R0~R15·xPSR·CONTROL·Mask Registers
  17. 17 Cortex-M4 예외 처리 — Vector Table·NVIC 우선순위·Tail-Chaining
  18. 18 ARM 메모리 맵 분석 — Normal·Device·Strongly-Ordered Region
  19. 19 Cortex-M7 캐시와 DMA — Cache Line·Write-Back·Clean/Invalidate 순서
  20. 20 Cortex-M4 MPU 활용 — Region 배치·Stack Guard·Task 격리
  21. 21 AArch64 Linux MMU 기초 — Translation Table·TLB·ASID
  22. 22 ARM TrustZone-M 기초 — Secure/Non-Secure·NSC·MPC
  23. 23 ARM Memory Barrier 실전 — DMB·DSB·ISB·DMA·MMIO
  24. 24 임베디드 크로스 컴파일러 분석 — GCC·Clang·Sysroot 구성
  25. 25 C 컴파일 4단계 — Preprocess·Compile·Assemble·Link 추적
  26. 26 ELF 파일 구조 분석 — Section·Segment·Symbol Table·DWARF
  27. 27 링커 스크립트 기초 — SECTIONS·MEMORY·entry point
  28. 28 링커 스크립트 고급 — Overlay·BSS·init_array·LMA/VMA
  29. 29 임베디드 스타트업 코드 분석 — Reset_Handler·Vector Table·SystemInit
  30. 30 C 런타임 crt0 분석 — Stack·BSS Zero·Data Copy·atexit
  31. 31 임베디드 메모리 레이아웃 — .text·.rodata·.data·.bss·.heap·.stack
  32. 32 임베디드 컴파일러 최적화 분석 — -O0~-O3·-Os·-LTO 비교
  33. 33 Map 파일 분석 — 링커가 넣은 것, 끌어온 이유, 버린 것 읽기
  34. 34 Make·CMake 크로스 컴파일 — Toolchain File·Sysroot·Preset
  35. 35 임베디드 Bootloader 체인 — BootROM·SPL·U-Boot·Kernel·Secure Boot
  36. 36 첫 bare-metal 프로그램 작성 — Linker·Startup·main의 최소 구성
  37. 37 MMIO 레지스터 직접 접근 — volatile·Memory Map·Aliasing 분석
  38. 38 GPIO 드라이버 직접 구현 — STM32F407을 HAL 없이 레지스터로
  39. 39 임베디드 클럭 설정 분석 — HSE·PLL·SYSCLK·AHB/APB 분주
  40. 40 Cortex-M 인터럽트 핸들링 — NVIC·Priority·Vector·EXTI
  41. 41 SysTick 타이머 활용 — 24-bit Counter·1ms Tick·delay 구현
  42. 42 UART 드라이버 구현 — polling·interrupt·DMA 3가지 방식 비교
  43. 43 SPI 드라이버 구현 — Master·Slave·CRC·DMA
  44. 44 I2C 드라이버 구현 — STM32F405/407 Master·Repeated START·Clock Stretching·Bus Recovery
  45. 45 임베디드 DMA 기초 — Memory-to-Memory·Peripheral·Circular Mode
  46. 46 저전력 모드 분석 — Sleep·Stop·Standby·Wake-up Source
  47. 47 STM32F405/407 IWDG·WWDG 워치독 구현 — Independent vs Window 비교
  48. 48 임베디드 Flash 프로그래밍 — Erase·Program·Read While Write
  49. 49 DDR 초기화 실패 진단 — Timing·Calibration·Walking Bit Test
  50. 50 PWM 출력 실전 — LED 밝기·모터 속도 제어
  51. 51 DC 모터 제어 — H-Bridge·PWM Duty·Encoder Feedback
  52. 52 스테퍼 모터 제어 — Full Step·Half Step·Microstepping
  53. 53 서보 모터 제어 — 50 Hz PWM·다채널·Calibration
  54. 54 Character LCD 제어 — HD44780·4-bit Mode·Custom Char
  55. 55 SPI OLED 제어 — SSD1306·Frame Buffer·Page 단위 갱신
  56. 56 TFT 디스플레이 구동 — ILI9341 SPI와 STM32F746 LTDC
  57. 57 환경 센서 활용 — BME280 온습압·SHT3x 비교
  58. 58 IMU 센서 활용 — MPU-6050·Data Ready·Complementary Filter
  59. 59 CAN 통신 구현 — bxCAN Bit Timing·Filter·Mailbox·Error 상태
  60. 60 USB Device 기초 — TinyUSB CDC·Descriptor·STM32F407 OTG_FS
  61. 61 Ethernet MAC+PHY 통합 — RMII·MDIO·lwIP Raw API
  62. 62 SD 카드 SPI 모드 + FatFs — 초기화·diskio 포팅·다중 블록 쓰기와 f_sync
  63. 63 STM32F4 RTC 활용 — Calendar·Alarm·Sub-second·Tamper·Backup Register
  64. 64 RTOS 도입 결정 분석 — Super Loop vs RTOS 트레이드오프
  65. 65 RTOS Task 설계 패턴 — 우선순위·스택·State Machine
  66. 66 RTOS Scheduler 동작 분석 — Tick·Context Switch·Yield
  67. 67 RTOS Semaphore 활용 — Binary·Counting·ISR Give
  68. 68 RTOS Mutex 활용 — Recursive·Priority Inheritance 적용
  69. 69 RTOS Queue 활용 — By-Value·By-Reference·Timeout 패턴
  70. 70 RTOS Event Group 활용 — Bit Wait·Sync·Notify
  71. 71 RTOS Software Timer 활용 — One-shot·Auto-reload·Daemon Task
  72. 72 ISR-Safe API 설계 — Reentrant·Atomic·Defer 패턴
  73. 73 Priority Inversion 진단·예방 — Mars Pathfinder Lesson 추적
  74. 74 Timer Wheel 분석 — Hashed·Hierarchical·O(1) Tick
  75. 75 RTOS 디버깅 기법 — Stack·Heap·Run-time Stats·SystemView
  76. 76 i.MX8M Mini EVK Linux 부팅 흐름 — BootROM에서 PID 1까지 단계별 인계
  77. 77 U-Boot 활용 — bootcmd·env·tftp·boot.scr 분석
  78. 78 Device Tree 실전 — DTS·DTB·Overlay·Phandle 추적
  79. 79 Device Tree Overlay 적용 — Runtime fragment·dtoverlay
  80. 80 임베디드 커널 빌드 — defconfig·menuconfig·Image·deb 패키지
  81. 81 커널 모듈 기초 — init/exit·Parameter·KBuild·modprobe
  82. 82 캐릭터 드라이버 작성 — file_operations·cdev·register_chrdev
  83. 83 Platform 드라이버 작성 — of_match·devm 해제 순서·probe 실패 판정 (Linux v6.12)
  84. 84 mmap 4가지 모드 — Anonymous·File·Shared·Huge Page
  85. 85 epoll 실전 — LT·ET·ONESHOT·EXCLUSIVE 비교
  86. 86 UIO·VFIO 분석 — User-Space Driver와 IOMMU 격리
  87. 87 sysfs·configfs 활용 — kobject 기반 User 인터페이스
  88. 88 IRQ Affinity 설정이 거부되거나 되돌아가는 이유 — smp_affinity·effective_affinity·isolcpus·irqbalance
  89. 89 루트 파일시스템 구축 — Buildroot 기초·Package·Toolchain
  90. 90 임베디드 동적 메모리 — malloc 위험·결정성·대안 분석
  91. 91 메모리 정렬과 패딩 분석 — Natural·Strict Alignment·Trap
  92. 92 Cache Line Alignment — alignas·Padding·SoA 적용
  93. 93 DMA-Friendly Allocator — dma_alloc_coherent·IOMMU·Pool
  94. 94 Zero-Copy Pipeline — DMA-BUF·sendfile·io_uring·splice
  95. 95 NUMA Memory Topology — numactl·numa_alloc·HBM 적용
  96. 96 SIMD 활용 분석 — Intrinsics·Auto-Vectorization·OpenMP SIMD
  97. 97 ARM NEON 심화 — Matrix Multiply·FFT·Image Filter 적용
  98. 98 임베디드 스택 분석 — high-water·overflow 탐지
  99. 99 임베디드 코드 크기 최적화 — -Os·LTO·Section Garbage Collection
  100. 100 임베디드 전력 최적화 — Sleep Mode·Clock Gating·DVFS
  101. 101 WCET 분석 기법 — Static·Measurement·Hybrid 방법론
  102. 102 Lock-Free Ring Buffer 구현 — SPSC·Power-of-2·Memory Order
  103. 103 Wait-Free Signaling — Atomic Flag·Sequence·Latest-Value
  104. 104 RCU (Read-Copy-Update) 기초 — Quiescent State·Grace Period
  105. 105 Hazard Pointer 분석 — Lock-Free Memory Reclamation
  106. 106 Compare-And-Swap 패턴 — Stack·Counter·Linked List 적용
  107. 107 Atomic Operation 비용 분석 — Fence·Cache Line·Contention
  108. 108 Spinlock vs Mutex 결정 가이드 — Context Switch·Hold Time
  109. 109 ABA 문제 회피 — Tagged Pointer·Hazard·Generation Counter
  110. 110 False Sharing 해결 — Cache Line Padding·Per-CPU·thread_local
  111. 111 MPMC Queue 구현 — Multi-producer Multi-consumer Lock-Free
  112. 112 임베디드 디버깅 마인드셋 — 가설·격리·재현·이분탐색
  113. 113 JTAG·SWD 안 붙을 때 — 핀·전압·속도·세션 진단
  114. 114 GDB 원격 디버깅 — OpenOCD·J-Link·target remote 구성
  115. 115 Cortex-M 하드폴트 분석 — Stacked Frame·CFSR 읽기
  116. 116 UART 안 찍힐 때 — Bare-metal 체크리스트
  117. 117 임베디드 부팅 실패 진단 — 단계별 Isolation
  118. 118 인터럽트 누락·중복 진단 — Priority·Pending·Re-entry 추적
  119. 119 메모리 오버플로우·오염 진단 — Canary·MPU·Pattern 분석
  120. 120 타이밍·Race 진단 — Heisenbug 잡는 법
  121. 121 통신 프로토콜 분석 — Logic Analyzer와 Protocol Decoder
  122. 122 임베디드 로깅 시스템 설계 — 레벨·버퍼·SWO·Deferred
  123. 123 임베디드 포스트모템 분석 — Core Dump와 Field Crash
  124. 124 FPGA 기초 분석 — LUT·FF·BRAM·DSP 자원 구조
  125. 125 Vivado 사용법 — Project·Constraint·Synth·Impl·Bitstream
  126. 126 PCIe BAR 매핑 분석 — Config Space·Enumeration·MMIO 접근
  127. 127 AXI 인터페이스 — AXI4·AXI4-Lite·AXI-Stream 비교
  128. 128 Zynq PS-PL 통신 — GP·HP·ACP 인터페이스 선택
  129. 129 Mailbox Protocol 분석 — Host와 Accelerator를 잇는 Doorbell
  130. 130 Command Queue·Submission Queue — NVMe·XDMA 공통 패턴
  131. 131 DMA Completion 메커니즘 — Interrupt·Polling·Completion Ring
  132. 132 PCIe Streaming 분석 — BAR Type·MSI-X·Kernel Bypass
  133. 133 Vitis HLS 분석 — Pragma·Pipeline II·Dataflow 실전 감각
  134. 134 HLS 최적화 기법 — Pipeline·Unroll·Partition·Dataflow
  135. 135 Vitis AI 분석 — DPU·xmodel·VART
  136. 136 OpenCL on FPGA — Kernel·Channel·Burst Memory 분석
  137. 137 Intel Quartus로 넘어가기 전 — 어느 toolchain에서나 쓰는 HDL과 testbench
  138. 138 Edge Inference 분석 — Cloud vs Edge·Latency·Privacy
  139. 139 Edge 추론 Pipeline 측정 — Stage Latency·Mailbox 정책·Buffer 수
  140. 140 NPU 아키텍처 분석 — Ethos·Hexagon·Systolic Array 비교
  141. 141 딥러닝 Quantization 분석 — PTQ·QAT·INT8·INT4·Calibration
  142. 142 TensorRT 분석 — ONNX→Engine·FP16·INT8·DLA·Multi-Stream
  143. 143 TFLite Micro 분석 — Op Resolver·Tensor Arena·Cortex-M
  144. 144 ONNX Runtime 분석 — Execution Provider와 Cross-Platform 배포
  145. 145 Edge Thermal Management — Throttling·DVFS·Fan Curve·Sustained
  146. 146 NVIDIA Jetson 분석 — Nano·Xavier·Orin·Thor·JetPack·DLA·VPI
  147. 147 Zero-Copy Camera Pipeline — V4L2·DMA-BUF·GPU Import·NPU 직결
  148. 148 온디바이스 LLM 추론 — llama.cpp·GGUF·MLX·KV Cache·NPU Backend
  149. 149 Cortex-M33 TF-M·TrustZone — Secure Firmware·PSA·MCUboot
  150. 150 Matter·Thread 분석 — IoT 통합 표준·Commissioning·Multi-Fabric
  151. 151 PCIe → CXL 진화 — 같은 PHY 위 cache-coherent 프로토콜 추가
  152. 152 QEMU CXL Type 3 디바이스 에뮬레이션 — 노트북에서 CXL 개발 환경 구축
  153. 153 Linux CXL 드라이버 분석 — cxl_pci·cxl_core·region·DAX