This is 3-channel pulse generator that generates square signals. It is made on stm32 with STM32CubeMX and Keil µVision. This version is built on the board stm32f103c8t6 and ST-LINK V2 programmer was used to install the code. Output signals are amplified by low-to-high voltage level shifter.
- Frequency range from less than 1 Hz up to 10 MHz
- Configurable frequency, duty cycle and phase shift between channels
- Mode with automatic synchronization between channels
- Saving configuration and automatic loading it on restart
At the time when I built this project, I used Keil µVision to compile and to load the program into the board. But now when I tried to replicate the process, I for some reason got an error about device mismatch. Then I figured out another approach with STM32CubeProgrammer.
- Download and install STM32CubeProgrammer. The installer should also install drivers for ST-LINK.
- Connect ST-LINK with the STM32 board to the computer via USB.
- Open the program and click "Open file". Then find and select file "Stm32Generator.hex" (You have to download it from the "/MDK-ARM/Stm32Generator" in this repo)
- Click "Download". Then connection with ST-LINK should establish and the compiled file should load to the board. Thats it.
- Download and install Keil.
- Download this repo, go to the "MDK-ARM" folder and open "Stm32Generator.uvprojx" with Keil.
- In the Keil press Alt+F7 and "Options for target" window should pop up.
- There in the "Target" tab find option "ARM Compiler" and choose default compiler.
- Press F7 to build the project, then the file "Stm32Generator.hex" should update.
- Repeat the process shown above to load this file into the board.
Note: this version of code works only on boards stm32f103c8. If your board is different, then you have to reconfigure pins and clocks. You can do so by rewriting the code manually or by generating new one in the STM32CubeMX.
Output signals are configured using a rotary encoder and 6 buttons (see sircuit diagram).
By pressing on buttons B1, B2 and B3 you can turn on and off channels. LEDs D1, D2 and D3 indicate whether the channels are on or off. (Button B1 and LED L1 correspond to the channel 1, etc)
By pressing on button B6 you can select the channel to configure. Button B5 switches signal parameter that is currently configured (frequency, duty cycle or phase shift). And button B4 changes the step of parameter change when rotating the encoder.
The configuration is saving every 30 seconds if any parameter was changed.
If you change the frequency of the 1-st channel, then frequencies of other channels will automatically change to the nearest values that divide or are divisible by the frequency of the 1-st channel. But if you don't need synchronization, you can just change frequency of 2-nd or 3-rd channel and it will not affect other channels.
MIT © Space4444