RegCalc – browser calculator for MCU register math (UART, PLL, timers)

jedinaj1 pts0 comments

RegCalc — STM32, ESP32, RP2040 Register Calculator

Calculators<br>AI Assistant<br>Pricing<br>FAQ<br>Open Calculator — Free

2,400+ engineers use it

4.9★ average rating

Free forever · no card

30-day refund guarantee

Calculators

MCU profiles

0ms<br>Install time

Free calculations

// calculators<br>Every register you need,<br>calculated instantly.

No more datasheet arithmetic. Enter values, get results and copy-ready C code.

UART / Baud Rate

Calculates BRR register for any PCLK and baud rate. Shows actual baud, error %, and bit period. Warns if error >2%. Supports 8× and 16× oversampling.

BRR RegisterError %Bit PeriodHAL Export

Timer PSC / ARR

Finds optimal Prescaler and Auto-Reload values for any target frequency. Auto mode searches all valid PSC values. Manual mode for fine control.

PSC RegisterARR RegisterResolutionHAL Export

PLL Clock Tree

Configure PLLM, PLLN, PLLP, PLLQ for any HSE. Validates VCO range and USB 48 MHz alignment. Visual SVG clock tree shows every bus frequency live.

VCOSYSCLKAPB1/APB2Clock DiagramHAL Export

⊓⊓

PWM Duty Cycle

Generates PSC, ARR and CCR for exact PWM frequency and duty. Real-time duty bar preview and actual vs target frequency.

PSC / ARRCCRDuty PreviewHAL Export

ADC Sampling Rate

Calculates conversion time, max sample rate and LSB voltage for 6–12-bit resolution. Includes raw-to-voltage converter.

Conv TimeSample RateLSB SizeHAL Export

I²C / SPI Clock

Computes bus clock from CCR and PCLK. Shows transfer time and throughput for a configurable byte count. Warns if I²C exceeds 400 kHz.

CCR RegisterThroughputTransfer TimeHAL Export

// why RegCalc<br>Built by embedded engineers.<br>For embedded engineers.

Real-time, zero latency<br>Every value updates as you type. No submit button, no page reload. Pure client-side math — works offline once loaded.

📋<br>Click-to-copy registers<br>Click any register value to copy it instantly. BRR, PSC, ARR, CCR — all one click from your clipboard to your IDE.

⚠️<br>Smart validation<br>Warns when UART error exceeds 2%, VCO input is out of range, USB clock is misaligned, or I²C is in Fast Mode territory.

🔌<br>No account. No install.<br>Open the URL, start calculating. No email required for the free tier. No 500MB IDE just to check a BRR value.

🌳<br>Visual clock tree PRO<br>PLL calculator renders a live SVG block diagram — HSE → PLL VCO → SYSCLK → AHB → APB1/APB2 — updating as you type.

💾<br>HAL code export PRO<br>Every calculator outputs paste-ready C initialization code with your exact register values. UART, Timer, PLL, PWM, ADC, I²C.

// hal code export · pro<br>From values to code<br>in one click.

PRO generates paste-ready C initialization code for every calculator — your exact register values, correct HAL functions, ready to copy into your project.

uart_init.c — HAL Code Export<br>C / STM32 HAL

/* STM32F4xx UART Config — 115200 baud, PCLK = 84 MHz */<br>UART_HandleTypeDef huart2;

huart2.Instance = USART2;<br>huart2.Init.BaudRate = 115200;<br>huart2.Init.WordLength = UART_WORDLENGTH_8B;<br>huart2.Init.StopBits = UART_STOPBITS_1;<br>huart2.Init.Parity = UART_PARITY_NONE;<br>huart2.Init.Mode = UART_MODE_TX_RX;<br>huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;<br>HAL_UART_Init(&huart2);<br>/* BRR = 45 (0x2D) | Actual: 116,667 bps | Error: +1.302% ✓ */

// ai assistant · pro<br>Your senior embedded<br>engineer, on call.

The AI assistant has full context of what you're working on — your MCU, clock frequency, and current register values. Ask real questions, get real answers.

"Why is my UART error 3.5% and how do I fix it for this PCLK?"

"What sample cycles should I use for 50 kHz ADC with low noise?"

"My I2C stops responding above 200 kHz — what's wrong with my CCR?"

"Explain the difference between PSC and ARR for my use case"

🤖<br>AI Engineer Assistant<br>PRO

Why is my baud error 1.3% — is that OK to ship?

Yes, 1.3% is completely within spec. UART tolerates ±2–3% error. BRR=45 gives 116,667 bps vs 115,200 target — you'll never see framing errors from this. If you want closer, PCLK=72 MHz gives BRR=39 for 0.16% error.

Is there any PCLK that gives exactly 0%?

For 115200 baud: PCLK=29.4912 MHz (BRR=16, 0.000% error). For 9600 baud: PCLK=14.7456 MHz (BRR=96, perfect). These are UART-friendly oscillator frequencies. Otherwise ±2% is fine for virtually all applications.

Ask anything about your calculation…

Send

// vs alternatives<br>vs STM32CubeMX

CubeMX is a 500 MB desktop install just to check a BRR value. In 2026.

FeatureRegCalcSTM32CubeMXPen & paper

Time to first result⚡ ~3 seconds~5 minutes~10 minutes<br>No install required✓✗✓<br>ESP32 / RP2040 / AVR support✓✗✓<br>Error validation + warnings✓partial✗<br>HAL code generation✓ PRO✓✗<br>AI-assisted debugging✓ PRO✗✗<br>PriceFree / from $7/moFreeFree

// from the community<br>Engineers trust it.

★★★★★

"I've wasted hours at 3AM debugging UART only to find BRR was off by 1. This tool would have saved so much pain. Now it's the first tab I open."

👨‍💻<br>Marko V.<br>Firmware Engineer · STM32F4

★★★★★

"The AI assistant actually knows embedded. Asked about I²C timing margins and got a...

error uart export huart2 register code

Related Articles