Write Firmware

Get firmware that is written for the microcontroller and the peripherals on your board.

Flux creates firmware for the microcontroller and peripherals in your device. It places the firmware starter document in your project so you can work with the source, pin map, and build instructions together.


Create firmware from the schematic

Tell Flux what the firmware must do and which peripherals to initialize. Include timing, communication, and startup requirements in your request.

Write firmware for this schematic. Read the temperature sensor over I2C once per second and send readings over USB serial.
Create firmware for this motor controller. Initialize the encoder, read its position, and drive the PWM output.

Open the Chat panel and describe the behavior. Flux creates a firmware starter document as a project file. It records the microcontroller, framework, build system, and libraries. It maps pin defines to schematic net names, then adds initialization for each peripheral.

The source can include sensor reads, actuator control, and Wi-Fi or BLE behavior. Flux orders startup so clocks come first, followed by GPIO, peripherals, and interrupts before the main loop. It can add error handling and a watchdog, then include build and flash instructions for the selected board.

The starter document keeps source and setup details together. Ask Flux to change a behavior or explain a peripheral, and it can update the source and its project documentation.

Use an RTOS

Tell Flux how the firmware tasks work together and what each task must do. Flux can set up tasks, queues, timers, and interrupts on FreeRTOS or Zephyr, or structure the code for bare-metal operation.

Set up FreeRTOS tasks for motor control, sensor sampling, and BLE. Give the motor task the highest priority, and send sensor readings to the BLE task through a queue.
Use Zephyr for this board. Set up a sensor task, a motor-control task, and a BLE task with priorities, queues, and periodic timers.
Write bare-metal firmware for this controller. Schedule sensor sampling and motor updates with timer interrupts.

Open the Chat panel and describe the task priorities, timing, and data flow. Ask Flux to organize the firmware around the selected RTOS or bare-metal structure.

Write low-power firmware

Tell Flux the sleep modes, wake sources, and battery budget for the device. Flux can set duty cycles and estimate battery life from the power budget.

Add low-power operation to this sensor firmware. Sleep between readings, wake on the motion interrupt, and report the expected duty cycle and battery life from the power budget.
Use the lowest-power sleep mode for this BLE sensor. Wake to sample every 10 seconds, send the reading, then return to sleep.
Estimate battery life for this firmware using the power budget. Show the active time, sleep time, wake sources, and average current.

Open the Chat panel with the schematic and power budget in the project. Ask Flux to update the firmware and record the sleep mode, wake sources, duty cycle, and battery-life estimate with the project files.

Start from your own code

Tell Flux where your source lives and what you want to change. Flux can use code from a public or private Git repository, an uploaded ZIP file, or files that you paste into chat.

Use the firmware in this public repository. Map its sensor driver to the I2C pins in this schematic.
Read the firmware in our private GitHub repository and update its pin definitions for this board.
Continue from the source in this ZIP. Add the new status LED and document its pin assignment.

Open Chat and share the repository link, upload the ZIP, or paste the relevant files. For a private repository, Flux asks you for an access token in chat and reads the repository from the chat's computer. See Integrations and secrets. Ask Flux to read the code structure before you request a change. It can connect the existing source to the project schematic and make the firmware starter document describe the code, build system, libraries, and board configuration.

You can ask Flux to preserve the project's existing organization while it adds a feature. For example, request a sensor driver, a serial command, a startup sequence, or a test. Flux can also explain how the source uses each net and peripheral.

Use mechanical values in firmware

Tell Flux which value from the model belongs in the firmware and how the device uses it.

Read the spacer volume from the mechanical model and add it as a named constant in the STM32 firmware.
Use the sensor position in the enclosure as firmware coordinates. Keep the units in millimeters.

Open Chat with the mechanical model and firmware source in the same project. Ask Flux to connect a model value to a named firmware constant and explain its units. Flux can read dimensions and positions from the CAD model, then use them in firmware source. The model and firmware document stay together in the project.

This workflow links mechanical design and embedded behavior. For example, firmware can use a spacer volume, sensor position, enclosure dimension, or mounting offset. If you change the hardware, ask Flux to update the constant and the related project documentation.

Open Files to read the firmware starter document and source. Continue with pin and peripheral setup, build and test, or firmware with your hardware.

The starter document gives you a working place to continue. Ask Flux to explain peripheral behavior, split a feature into source files, or add a test for a calculation. You can ask for a project file that records the commands and expected results for a repeatable task. The source, configuration, and documentation stay connected in the same project.

Use the Chat panel to describe the next firmware change. Select Files in the project view switcher to read the current document, source, and tests. Ask Flux to keep the setup and build notes consistent with the code after each update.