博文

How to boot stm32 Blue Pill?

图片
 On the STM32 “Blue Pill”, “booting” basically means: Power the board correctly Put it in the right boot mode (BOOT0/BOOT1) Have valid firmware in flash I’ll walk you through the typical ways to boot it. 1. Powering the Blue Pill (don’t skip this) The board has an STM32F103C8 (or CB) + a 3.3 V regulator. You can power it in three safe ways : Via USB port (Mini-USB) Plug into USB → board gets 5 V → regulator makes 3.3 V for the MCU. Via 5V pin Feed regulated 5 V into the 5V pin, GND to GND. Direct 3.3 V Feed 3.3 V into 3.3V pin, GND to GND (bypasses regulator). ⚠️ Never put 5 V on the 3.3 V pin → instant blue smoke risk. If power is good, the red power LED should light. 2. Boot mode basics: BOOT0 & BOOT1 The STM32 decides where to boot from using BOOT0 and BOOT1 at reset: On the Blue Pill: BOOT0 is broken out with a jumper. BOOT1 (PB2) is usually fixed low (GND) with a resistor. So the useful modes are: BO...

How to power on DE10 FPGA?

图片
 To power on a Terasic DE10 FPGA board , you mainly need the right power source and the correct switch/jumper settings. I’ll cover the common boards (DE10-Nano, DE10-Lite, DE10-Standard). The exact steps are very similar. 1. Identify which DE10 board you have Look at the silkscreen on the PCB: “DE10-Nano” (with HPS/ARM and RJ45 Ethernet) “DE10-Lite” (small, MAX 10 FPGA, usually used in courses) “DE10-Standard” (larger, Cyclone V , more connectors) If you’re not sure, follow the section that visually matches what you see. 2. DE10-Nano – how to power it on The DE10-Nano can be powered in two main ways : Option A: Via DC barrel jack (recommended for heavy loads) Use a 5V regulated DC adapter , usually 5V / 2A (check label on board or kit PSU). Plug the adapter into the DC jack on the board. Make sure the power select jumper (often labeled JP3 / PWR or similar) is set to DC IN / EXT (depends on revision). Slide the ON/OFF switch (if present) t...

How to install Raspberry Pi OS?

图片
 Here’s the straightforward way to install Raspberry Pi OS, step by step. 1. Prepare what you need Hardware Raspberry Pi board (any supported model) microSD card (8 GB minimum, 16–32 GB recommended, Class 10) Card reader for your PC Power supply for the Pi (Optional) HDMI cable + monitor, USB keyboard/mouse On your computer A PC running Windows, macOS, or Linux Raspberry Pi Imager (official tool) 2. Download and install Raspberry Pi Imager Go to the official Raspberry Pi website and download Raspberry Pi Imager for your OS. Install it like a normal application and then open it. Imager handles downloading the correct Raspberry Pi OS image and writing it to the SD card for you. 3. Flash Raspberry Pi OS to the microSD card Insert the microSD card into your computer. In Raspberry Pi Imager : Click Choose Device (if available) and select your Pi model (e.g. “ Raspberry Pi 4 ”). Click Choose OS For most users: Raspberry...

How to store config file on microcontroller?

图片
 You treat the “config file” as a small block of non-volatile data and give it a safe place + a simple protocol, rather than literally thinking “files on a PC”. Here’s a practical way to do it. 1. Decide where to store the config Depending on your MCU and how big the config is: Internal EEPROM (AVR, some STM8 , some STM32 , PIC , etc.) Easiest: byte-wise writes, survives reset and power off. Great for a few bytes to a few kB (baud rate, calibration constants, flags…). Internal Flash (most Cortex-M, ESP32, etc.) Use one or more flash pages/sectors reserved for config. You must erase a whole page before rewriting; limited erase cycles (often 10k–100k). Common for MCUs without EEPROM (STM32, nRF, etc.). External non-volatile memory I²C/SPI EEPROM/FRAM/Flash if you need more space or don’t want to wear out internal flash. FRAM is great when you want many writes (wear basically not a problem). SD card / filesystem Overkill for tiny conf...

How to do wiring for shield board for Arduino Nano in KiCad?

图片
Think of an Arduino Nano shield PCB in KiCad as: A board with two rows of female headers that match the Nano’s pins, plus whatever parts you want to connect to those pins. “Wiring” is really just connecting Nano pins (on the schematic) to your parts , then routing those nets on the PCB. I’ll walk you through it step-by-step. 1. Decide what the shield should do Before KiCad: Which Nano pins do you need? (D2–D13, A0–A7, 5V, 3V3, GND, VIN…) What will you connect? e.g. joystick module: X→A0, Y→A1, SW→D2 LEDs on D3/D5 I2C connector on A4/A5, etc. Write this mapping down; you’ll literally implement that in the schematic. 2. In the schematic: use Nano symbol as the “connector” Assuming you already have an Arduino Nano symbol (from previous step / library): Create a new KiCad project for the shield. Open Schematic Editor . Place the Arduino Nano symbol This symbol represents the female headers where the Nano will plug in. Its pins D0, D1, 5V, GND… are yo...

How to use DMA in circular mode on STM32?

图片
 Using DMA in circular mode on STM32 basically means: “Keep filling the same buffer in RAM over and over, wrapping around when you reach the end.” This is perfect for continuous ADC sampling , UART RX streams , audio , etc. Here’s how to do it, in practical steps. 1. Basic idea Peripheral data register → DMA → RAM buffer. DMA writes: buf[0] … buf[N-1] then automatically wraps back to buf[0] and continues. Your code never restarts the DMA; it just reads from the buffer while DMA keeps filling it. 2. Create the buffer in RAM Example for an ADC (16-bit samples): # define ADC_BUF_LEN 256 uint16_t adc_buf[ADC_BUF_LEN]; Example for UART RX (8-bit): # define UART_RX_BUF_LEN 128 uint8_t uart_rx_buf[UART_RX_BUF_LEN]; Make sure the buffer is global or static so it stays allocated. 3. Configure DMA in circular mode (HAL example) Let’s say you’re using STM32Cube HAL. 3.1. In CubeMX / code, set: Direction : Peripheral → Memory Mode : DMA_...