Highlights
Attention
/dev/tty*?brltty package.sudo apt autoremove brltty
Tip
3. Remove burden of entering password every time while git clone and git push. Add SSH key to GitHub.
Attention
CMake does not generate binary file.Error
5. NRST pin of ST-Link is not connected to the NRST pin of the microcontroller but try to reset using st-flash command.
st-flash --reset write <your_binary_filename>.bin 0x8000000
Remove --reset and reset manually or common NRST pins.
Danger
6. You must write you code inside comment block. Begin and End are specified by /* USER CODE BEGIN x */ and /* USER CODE END x */. Here x is the number. If you write outside this block, your code will be lost when you regenerate the code using CubeMX.
Attention
USB after pressing reset button of STM32?Attention
cat command to see serial data from USB?115200 or use Arduino Serial Monitor, PuTTY or other software.Warning
9. STM32F407VG-DISC1 default UART1 TX pin (PA9) does not work properly when the USB OTG is used because PA9 pin is also used for USB OTG. For more information, see the schematic of the board.
Attention
Note
11. Formula for Frequency of PWM:
Note
12. Open drain encoders need pullup resistors. For 3V3 VDD, 4K7 pull up resistors are better. For 5V VDD, 10K pull up resistors are better.
Caution
13. STM32F407VG-DISC1 TIM1 gives problem in high speed encoder reading if cable length is long. It is better to use other timers for high speed encoder reading.
Tip
14. If you timer as counter like frequncy counter or encoder. It is better to keep ARR value to maximum i.e. 65535 for 32-bit.
Important
15. To print floating point, add -u _printf_float flag to LDFLAGS in Makefile.
LDFLAGS = $(MCU) -specs=nano.specs -T$(LDSCRIPT) $(LIBDIR) $(LIBS) -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref -Wl,--gc-sections -u _printf_float
Caution
16. If PWM pin is pulled up, it sends logic high at reset. So make sure not to use pulled up pins for PWM to control motors. But you can use the pulled up pins to control servo motors. STM32F407VG-DISC1 board have many pulled up pins as it contains many peripherals. You can check them using multimeter under reset. To hold the reset, use STM32CubeProgrammer. If you connect it and open SWV, it is under reset uintill you press START.
Attention
17. SWV does not work in STM32F407VG-DISC1 board if you use PB3 pin because it is connected to SWO pin of ST-Link.
Warning
18. Many bluepills found in Nepal have STM32F103C6T6 microcontroller and have only 32KB flash memory. Using USB can overflow the flash memory.
Important
19. ITM uses SWO, so select Debug option as Trace Asynchronous SW in STM32CubeMX configuration.
Error
20.Drivers/CMSIS/Include/core_cm4.h:105:8: error: #error “Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)”
105 | #error “Compiler generates FPU instructions for a device without an FPU (check __FPU_PRESENT)”
To solve this compilation error when using arm math for Cortex M4 or others having FPU, add -D__FPU_PRESENT=1U to C_DEFS in the Makefile: