My TMR-FC Flight Controller
- Frame
- Controller
- Introductions
1. User Guide :
2. Sechematic :
3. Gerber :
4. Software :
The software is Porting from "PX4".
https://github.com/cctsao1008/TMR
- Hardware Features
1. MCU :
STM32f405RG
2. AHRS :
MPU6050, HMC5883, MS5611
3. Features :
12 channels PWM output, one PPM input and one Futaba S.BUS input,
Built-in 10 DOF, 5 LEDs ( controlled by PCA9533/9536), GPS port ( UART / I2C),
Auxiliary SPI and GPIO, RF port (APC230 or BT), LiPo Voltage measure via ADC,
Beeper for tone alarm, SWD port, SONAR, USB VCP and MSC, Micro SD ( can be read via USB),
Light Bar LED control, Internal FLASH EEPROM emulation using sector 1, 2 and 3 ( 16KB x 3 ),
RTC ( power keep by 3V CR1220 )
....... etc
4. Stress Test VB scripts :
Auto re-boot loop test, tone alarm loop test, ..... etc
5. Support PX4 Qupgrade tool :
- Tests :
---------------------------------------
- Boot Log :
---------------------------------------
reboot
ABCDF
nsh_romfsetc: nsh > romfs_img_len 0xFF52F09C
nsh_romfsetc: nsh > Mounting ROMFS filesystem at target=/etc with source=/dev/ram0
[boot] Initializing (HRT) 1...
[boot] Initializing (CPU) 2...
[boot] Initializing (DMA) 3...
[boot] Initializing pca953x driver
[PCA953X] on I2C bus 2 at 0x62
[TMRFC_LED] led_off, led = 0x338
[TMRFC_LED] led_off, led = 0x332
[TMRFC_LED] led_on, led = 0x334
[boot] Initializing soft SPI for the MMC/SD slot
[boot] Successfully initialized soft SPI for the MMC/SD slot
[boot] Binding soft SPI device to MMC/SD slot 0
[boot] Successfuly bound Soft SPI device to MMC/SD slot 0
[boot] Initializing SPI3
[init] MODE = autostart
[init] Looking for microSD...
[init] Card mounted at /fs/microsd
[init] tone_alarm start
[init] Reading /fs/microsd/etc/rc.txt
Detecting on board sensors on I2C bus(I2C2) ......
( 0x62 ) Have PCA9533DP
( 0x41 ) Have PCA9536DP
( 0x69 ) Have MPU6050
Set MPU6050 auxiliary I2C bus to bypass mode......
Detecting sensors on MPU6050 auxiliary I2C bus......
( 0x1e ) Have HMC5883L
( 0x77 ) Have MS5611
i2c: Done
[init] Start the ORB
[uorb] ready
ramtron: RAMTRON not enabled, skipping.
param: selected parameter default file /fs/microsd/params
[init] param load /fs/microsd/params
param: end of parameters
[init] Start mavlink ( 57600 /dev/ttyS1 )
mavlink: MAVLink v1.0 serial interface starting...
mavlink: DOWNLINK MODE
mavlink: UART is /dev/ttyS1, baudrate is 57600
[init] Start commander
commander: starting
commander: No RGB LED found
[fcservo] default PWM output device
<fcservo> MODE_NONE
[fcservo] starting
<fcservo> adjusted actuator update interval to 100ms
FC driver (no PWM) started
[init] Start sensors >> need to implement
[init] Start one of the estimators ( attitude_estimator_ekf ) >> wait for MPU6050 driver ready !!
[init] Start GPS >> need to implement
NuttShell (NSH)
nsh> eeprom test
---------------------------------------------------------------------------------------
RM0090 Table 5. Flash module organization (STM32F40x and STM32F41x)
---------------------------------------------------------------------------------------
[DEBUG]Check_Sector_Erased (845):SS = 0x08000000, SE = 0x08003FFF, COUNT = 0x00000001
[DEBUG]internal_flash_test (986):Check_Sector_Erased 0 (DATA)
---------------------------------------------------------------------------------------
[DEBUG]Check_Sector_Erased (845):SS = 0x08004000, SE = 0x08007FFF, COUNT = 0x00000001
[DEBUG]internal_flash_test (988):Check_Sector_Erased 1 (DATA)
---------------------------------------------------------------------------------------
[DEBUG]Check_Sector_Erased (845):SS = 0x08008000, SE = 0x0800BFFF, COUNT = 0x00004000
[DEBUG]internal_flash_test (990):Check_Sector_Erased 2 (ERASED)
---------------------------------------------------------------------------------------
[DEBUG]Check_Sector_Erased (845):SS = 0x0800C000, SE = 0x0800FFFF, COUNT = 0x00000001
[DEBUG]internal_flash_test (992):Check_Sector_Erased 3 (DATA)
---------------------------------------------------------------------------------------
[DEBUG]Check_Sector_Erased (845):SS = 0x08010000, SE = 0x0801FFFF, COUNT = 0x00000001
[DEBUG]internal_flash_test (994):Check_Sector_Erased 4 (DATA)
---------------------------------------------------------------------------------------
[DEBUG]Check_Sector_Erased (845):SS = 0x08020000, SE = 0x0803FFFF, COUNT = 0x00000001
[DEBUG]internal_flash_test (996):Check_Sector_Erased 5 (DATA)
---------------------------------------------------------------------------------------
[DEBUG]Check_Sector_Erased (845):SS = 0x08040000, SE = 0x0805FFFF, COUNT = 0x00000001
[DEBUG]internal_flash_test (998):Check_Sector_Erased 6 (DATA)
---------------------------------------------------------------------------------------
[DEBUG]Check_Sector_Erased (845):SS = 0x08060000, SE = 0x0807FFFF, COUNT = 0x00000001
[DEBUG]internal_flash_test (1000):Check_Sector_Erased 7 (DATA)
---------------------------------------------------------------------------------------
[DEBUG]Check_Sector_Erased (845):SS = 0x08080000, SE = 0x0809FFFF, COUNT = 0x00000001
[DEBUG]internal_flash_test (1002):Check_Sector_Erased 8 (DATA)
---------------------------------------------------------------------------------------
[DEBUG]Check_Sector_Erased (845):SS = 0x080A0000, SE = 0x080BFFFF, COUNT = 0x00000001
[DEBUG]internal_flash_test (1004):Check_Sector_Erased 9 (DATA)
---------------------------------------------------------------------------------------
[DEBUG]Check_Sector_Erased (845):SS = 0x080C0000, SE = 0x080DFFFF, COUNT = 0x00000001
[DEBUG]internal_flash_test (1006):Check_Sector_Erased 10 (DATA)
---------------------------------------------------------------------------------------
[DEBUG]Check_Sector_Erased (845):SS = 0x080E0000, SE = 0x080FFFFF, COUNT = 0x00000001
[DEBUG]internal_flash_test (1008):Check_Sector_Erased 11 (DATA)
---------------------------------------------------------------------------------------
[DEBUG]internal_flash_test (1011):Warning !! This test will destroy the data stored on sector 1 and 2 !
[DEBUG]internal_flash_test (1014):1)sched_lock....
[DEBUG]internal_flash_test (1018):2)FLASH_Unlock....
[DEBUG]internal_flash_test (1022):3)EE_Init....
[DEBUG]EE_Init (146):EE_Init
[DEBUG]EE_Init (330):EE_Init >> VALID_PAGE
[DEBUG]EE_Init (345):EE_Init >> ERASED
[DEBUG]EE_Init (347):EE_Init >> FLASH_EraseSector 1
[DEBUG]Check_Sector_Erased (845):SS = 0x08008000, SE = 0x0800BFFF, COUNT = 0x00004000
[DEBUG]EE_Init (355):Page 1 blank, skip to erase it.
[DEBUG]internal_flash_test (1025):4)FLASH_Lock....
[DEBUG]internal_flash_test (1029):5)sched_unlock....
nsh>
---------------------------------------
-log for DJI F450 :
---------------------------------------
ABCDF
nsh_romfsetc: nsh > romfs_img_len 0x80B7DC8
nsh_romfsetc: nsh > Mounting ROMFS filesystem at target=/etc with source=/dev/ram0
[boot] Initializing HRT Callout Interface
[boot] Initializing CPU Load Estimation
[boot] Initializing Serial DMA
[boot] Initializing PCA9533 and PCA9536
[PCA953X] on I2C bus 2 at 0x62
[TMRFC_LED] led_off, led = 0x338
[TMRFC_LED] led_off, led = 0x332
[TMRFC_LED] led_on, led = 0x334
[boot] Initializing soft SPI for the MMC/SD slot
[boot] Successfully initialized soft SPI for the MMC/SD slot
[boot] Binding soft SPI device to MMC/SD slot 0
[boot] Successfuly bound Soft SPI device to MMC/SD slot 0
[boot] Initializing SPI3
[init] MODE = autostart
[init] Looking for microSD...
[init] Card mounted at /fs/microsd
[init] tone_alarm start
[init] Reading /fs/microsd/etc/rc.txt
sercon: Registering CDC/ACM serial driver
uart_register: Registering /dev/ttyACM0
sercon: Successfully registered the CDC/ACM serial driver
[init] eeprom
eeprom: mounted EEPROM at /eeprom
param: end of parameters
sercon:: ERROR: Already connected
[init] Start the ORB
[uorb] ready
param: selected parameter default file /fs/microsd/params
[init] param load /fs/microsd/params
param: end of parameters
Try to get an USB console
nshterm [12:100]
11: + SYS_AUTOSTART: equal
Load .. 11_dji_f450
[init] TMRFC v1 on DJI F450
MAV_TYPE: curr: 1 -> new: 2
nsh: px4io: command not found
mavlink: MAVLink v1.0 serial interface starting...
mavlink: DOWNLINK MODE
mavlink: UART is /dev/ttyS2, baudrate is 57600
[fcservo] default PWM output device
<fcservo> MODE_12PWM
<fcservo> set_pwm_rate 0 50 50
[fcservo] starting
<fcservo> adjusted actuator update interval to 20ms
<fcservo> MIXERIOCRESET
<fcservo> MIXERIOCLOADBUF
<fcservo> new MixerGroup
<fcservo> set_pwm_rate 0 50 400
<fcservo> set_pwm_rate fff 50 400
<fcservo> adjusted actuator update interval to 2ms
[uorb] already loaded
uORB started
ADC
<adc> init done
[MPU6050] on I2C bus 2 at 0x69
[MPU6050] Ready.
[HMC5883] on I2C bus 2 at 0x1e
[HMC5883] Ready.
[MS5611_I2C] on I2C bus 2 at 0x77
[MS5611] Ready.
[sensors] Initializing..
sensors_task: using system accel
sensors_task: using system gyro
sensors_task: mag cal status changed
preflight_check [38:100]
commander: starting
commander: No RGB LED found
sdlog2: logging to directory: /fs/microsd/sess003
sdlog2: log buffer size: 16384 bytes.
[gps] starting
[gps] failed to open serial port: /dev/ttyS3 err: 2
Extended Kalman Filter Attitude Estimator initialized..
position_estimator_inav: started.
multirotor_att_control: starting
multirotor_pos_control: start
multirotor_pos_control: started
sdlog2: start logging.
sdlog2_writer: logging to: /fs/microsd/sess003/log001.bin.
position_estimator_inav: init baro: alt = 45.242
position_estimator_inav: main loop started.
Comments
good thinks
nsh> tests all
Running all tests...
[led] STARTING TEST
LED test completed, no errors.
[led] PASS
[int] STARTING TEST
--- 64 BIT MATH TESTS ---
success: 354156329598 * 5 == 1770781647990
--- 32 BIT / 64 BIT MIXED MATH TESTS ---
success: 64bit calculation: 50 * 2147483647 (max int val) == 107374182350
SUCCESS: All float and double tests passed.
[int] PASS
[float] STARTING TEST
--- SINGLE PRECISION TESTS ---
The single precision test involves calls to fabsf(),
if test fails check this function as well.
success: sinf(0.0f) == 0.0f
success: sinf(1.0f) == 0.84147f
success: asinf(1.0f) == 1.57079f
success: cosf(1.0f) == 0.54030f
success: acosf(1.0f) == 0.0f
success: sinf(0.1f) == 0.09983f
success: sqrt(2.0f) == 1.41421f
success: atan2f(1.0f, 1.0f) == 0.78539f
success: printf("%8.4f", 0.553415f) == 0.5534
success: printf("%8.4f", -0.553415f) == -0.5534
--- DOUBLE PRECISION TESTS ---
success: 1.0111 * 2.0 == 2.0222
success: (float) 1.55f == 1.55 (double)
success: sin(0.0) == 0.0
success: sin(1.0) == 0.84147098480
success: atan2(1.0, 1.0) == 0.785398
testing pow() with magic value
(44330.0 * (1.0 - pow((96286LL / 101325.0), 0.190295)));
success: result: 428.2293
success: printf("%8.4f", 0.553415) == 0.5534
success: printf("%8.4f", -0.553415) == -0.5534
SUCCESS: All float and double tests passed.
[float] PASS
[sensors] STARTING TEST
Running sensors tests:
sensor: accel
ACCEL: test start
ACCEL accel: x: -0.5675 y: 0.5848 z: -9.8895 m/s^2
OK: ACCEL passed all tests successfully
sensor: gyro
GYRO: test start
GYRO rates: x: 0.0051 y: -0.0411 z: 0.0029 rad/s
OK: GYRO passed all tests successfully
sensor: mag
MAG: test start
MAG values: x: -1.0303 y: -1.0202 z: 1.0330
OK: MAG passed all tests successfully
sensor: baro
BARO: test start
BARO pressure: 995.7500 mbar alt: 146.7016 m temp: 36.1600 deg C
OK: BARO passed all tests successfully
[sensors] PASS
[adc] STARTING TEST
10: 38 15: 3 16: 14 17: 0 18: 0
10: 69 15: 0 16: 11 17: 0 18: 0
10: 69 15: 0 16: 8 17: 0 18: 0
10: 67 15: 0 16: 10 17: 0 18: 0
10: 69 15: 0 16: 6 17: 0 18: 0
tests: ADC test successful.
[adc] PASS
[tone] STARTING TEST
Alarm 1 (disable with: tests tone 0)
[tone] PASS
[sleep] STARTING TEST
100 100ms sleeps
Sleep test successful.
[sleep] PASS
[time] STARTING TEST
Maximum jitter 3us
[time] PASS
[perf] STARTING TEST
perf: expect count of 4
test_count: 4 events
perf: expect count of 1
test_elapsed: 1 events, 355us elapsed, min 355us max 355us
perf: expect at least two counters
test_elapsed: 1 events, 355us elapsed, min 355us max 355us
test_count: 4 events
ms5611_buffer_overflows: 18972 events
ms5611_comms_errors: 9 events
ms5611_measure: 25333 events, 3909783us elapsed, min 150us max 214us
ms5611_read: 25332 events, 8071370us elapsed, min 236us max 11347us
hmc5883_buffer_overflows: 31653 events
hmc5883_comms_errors: 0 events
hmc5883_read: 31658 events, 10631825us elapsed, min 330us max 835us
mpu6050_read: 50668 events, 28114551us elapsed, min 537us max 780us
ADC samples: 765 events, 2831us elapsed, min 3us max 31us
sensor task update: 0 events, 0us elapsed, min 0us max 0us
[perf] PASS
[param] STARTING TEST
tests: parameter test PASS
[param] PASS
[bson] STARTING TEST
tests: PASS: decoder: bool1
tests: PASS: decoder: int1
tests: PASS: decoder: int2
tests: PASS: decoder: double1
tests: PASS: decoder: string1
tests: PASS: decoder: data1
[bson] PASS
[file] STARTING TEST
tests: 512KiB in 8370313 microseconds
SD writes: 1024 events, 8367518us elapsed, min 6506us max 50779us
tests: running unlink test
tests: unlink iteration #0
tests: unlink iteration #1
tests: unlink iteration #2
tests: unlink iteration #3
tests: unlink iteration #4
tests: unlink iteration #5
tests: unlink iteration #6
tests: unlink iteration #7
tests: unlink iteration #8
tests: unlink iteration #9
tests: unlink iteration #10
tests: unlink iteration #11
tests: unlink iteration #12
tests: unlink iteration #13
tests: unlink iteration #14
tests: unlink iteration #15
tests: unlink iteration #16
tests: unlink iteration #17
tests: unlink iteration #18
tests: unlink iteration #19
tests: unlink iteration #20
tests: unlink iteration #21
tests: unlink iteration #22
tests: unlink iteration #23
tests: unlink iteration #24
tests: unlink iteration #25
tests: unlink iteration #26
tests: unlink iteration #27
tests: unlink iteration #28
tests: unlink iteration #29
tests: unlink iteration #30
tests: unlink iteration #31
tests: unlink iteration #32
tests: unlink iteration #33
tests: unlink iteration #34
tests: unlink iteration #35
tests: unlink iteration #36
tests: unlink iteration #37
tests: unlink iteration #38
tests: unlink iteration #39
tests: unlink iteration #40
tests: unlink iteration #41
tests: unlink iteration #42
tests: unlink iteration #43
tests: unlink iteration #44
tests: unlink iteration #45
tests: unlink iteration #46
tests: unlink iteration #47
tests: unlink iteration #48
tests: unlink iteration #49
tests: unlink iteration #50
tests: unlink iteration #51
tests: unlink iteration #52
tests: unlink iteration #53
tests: unlink iteration #54
tests: unlink iteration #55
tests: unlink iteration #56
tests: unlink iteration #57
tests: unlink iteration #58
tests: unlink iteration #59
tests: unlink iteration #60
tests: unlink iteration #61
tests: unlink iteration #62
tests: unlink iteration #63
[file] PASS
----------------------------------------
T E S T S U M M A R Y
______ __ __ ______ __ __
/\ __ \ /\ \ /\ \ /\ __ \ /\ \/ /
\ \ __ \ \ \ \____ \ \ \____ \ \ \/\ \ \ \ _"-.
\ \_\ \_\ \ \_____\ \ \_____\ \ \_____\ \ \_\ \_\
\/_/\/_/ \/_____/ \/_____/ \/_____/ \/_/\/_/
All tests passed (12 of 12)
Good Work. Keep us updated with the maiden flight. Thanks for sharing your work.