Project of quad_v4



Resources


# Link Category Reference Description
1 en.stsw-stm32068.zip template codes ST official template codes
2 STM32F4开发指南-库函数版本_V1.1.pdf tutorial openedv tutorial handbook for STM32F4 programming
3 MPU6050 driver codes template codes
4 STM32F401xB_STM32F401xC.pdf datasheets STM32F401RBT6 MCU datasheets
5 STM32F4DISCOVERY board User Manual.pdf Usermanuals STM32F4DIS usermanual (schematic included)
6 STM32F4DIS-BB REV1.0.pdf Schematic STM32F4DIS-BB schematic
7 MPU6050_spec.pdf Datasheet MPU6050 datasheet
8 MPU6050-Register-Map.pdf Develop Note MPU6050 register map
9 MPU9250_spec.pdf Datasheet MPU9250 datasheet
10 MPU9250-Register-Map.pdf Develop Note MPU9250 register map
11 MPU9250 STM32 drive codes template codes init codes in github
12 AK8963.pdf Datasheet datasheet of magnetometer in mpu9250
13 kriswiner - Affordable-9-DoF-Sensor-Fusion Tutorial Invensense 6 dof fusion DMP vs opensource 9 dof fusion
14 MPU-6050 Redux: DMP Data Fusion vs. Complementary Filter Tutorial DMP data filtering
15 SparkFun_MPU-9250-DMP_Arduino_Library template code together with #16
16 Invensense DMP official core codes template code ver 6.12, work together with #15
17 Data flow instruction a diagram demonstrate how data flows in DMP
18 Tilt Compensated Compass tutorial calibrate megnetometer
19 Kalman filter code for IMU template code github
20 Adafruit AHRS template code github, opensource data fusion from Madgwick besides DMP
21 test data of Madgwick AHRS tutorial
22 Madgwick AHRS template code github, official code
23 Simple-and-Effective-Magnetometer-Calibration tutorial kriswiner's magnetometer calibration
24 calibrate-magnetometer tutorial a more general tutorial
25 UART DMA codes DMA tutorial
26 printf DMA codes STM32 printf DMA
27 another printf DMA codes STM32 printf DMA using queueing
28 solve va start end problem in #26 tutorial
29 printf with HAL_UART_Transmit_IT? tutorial important discussion to implement dma printf
30 Open source IMU and AHRS algorithms tutorial madgwick AHRS including matlab code and others


Troubleshoot


# Troubles Solutions
1 程序跑飞复位 重新上电,按住重启,用st_utility在connect after reset设置下连接,松开重启
2 L6406E RAM空间溢出 configTOTAL_HEAP_SIZE ( ( size_t ) ( 62 * 1024 ) )
3 freertos进不去task FREERTOS_CONFIG_H
#define vPortSVCHandler SVC_Handler
#define xPortPendSVHandler PendSV_Handler
stm32f4xx_it.c/h
注释掉SVC_Handler和PendSV_Handler
4 HAL和FreeRTOS的延迟函数不工作 在it.c文件中新建systick_handler函数
加入
HAL_IncTick();
HAL_SYSTICK_IRQHandler();
5 HAL和FreeRTOS的延迟中断函数冲突 CUBE生成工程时不用systick做timebase source
在it.c文件中的TIM1_UP_TIM10_IRQHandler函数中加入
HAL_IncTick();
HAL_SYSTICK_IRQHandler();
6 使用HSE跑飞 1.改良晶振电路,采用更好的晶振或有源晶振;
2.降频使用
7 DMA不工作
8 MPU6050连接不上 试解决方法:用pb6,pb9,加测试接口(含pb7),使用有源晶振


Hardware


quad_v4_4_update_note

# issues
1 MAG3110->HMC5883L/MPU9250
2 remove photocoupler
3 圆圈开口
4 reserve CH340
5 SMT 10uF capacitor
6 package optimization
7 tighten 3d printed parts, add tightening screwer
8 reduce the size of motor connector
9 nylon screwer
10 tester via
11 change usb connector
12 modify crystal circuit, or use active crystal,gnd ring, shell gnd
13 tester via for I2C


Workflow


#include <stdio.h>
#include <stdarg.h>

    ...

void DMA_printf(const char *format,...)
{
    uint32_t length;
    va_list args;
    uint8_t buffer[256];	
	
    va_start(args, format);
    length = vsnprintf((char*)buffer, sizeof(buffer), (char*)format, args);
    va_end(args);
	
    if(HAL_UART_Transmit_DMA(&huart1, (uint8_t *)&buffer, length)!= HAL_OK)
    {
        Error_Handler();
    }
}
T1: 乱码
A1: set buffer size from 128 bytes to 256 bytes
T2: 传输不全
A2: insufficient delay, set delay from 10 ns to 50 ns
M2: add lock unlock flag