Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KakuteF7 board support #12440

Merged
merged 16 commits into from
Jul 16, 2019
Merged

KakuteF7 board support #12440

merged 16 commits into from
Jul 16, 2019

Conversation

bkueng
Copy link
Member

@bkueng bkueng commented Jul 9, 2019

This brings support for the Holybro KakuteF7 board.

Validated:

  • ACM0/USB
  • SPI: ICM20689, OSD chip and SD card.
  • PWM1-6, oneshot and PWM400 (also checked the reboot behavior)
  • I2C (with internal baro BMP280)
  • RC (SBUS)
  • onboard LED
  • all UART's with MAVLink (except uart7, which is for ESC telemetry)
  • Buzzer
  • voltage and current readout

Not working:

  • Frksky telemetry (don't know why yet)
  • Current readout with the Tekko 4-in-1 ESC (this is a hardware-problem. betaflight uses ESC telemetry to get the current measurement).

Not tested:

  • external LED pin

Flash space: we're really tight, I needed to disable ekf2, which would overflow by 91KB.

Other changes

Buzzer

The buzzer works a bit differently on the KakuteF7: it is only binary. The startup sound sounds more like something is wrong on that, so I added an option to disable it.
I also reduced the missing SD card tone from infinitely to 2 repetitions.

RC Port

The board RC port is simplified by using NuttX ioctl's. This removes the need for RC_UXART_BASE, and allows for runtime-configurable RC port (disabled by default, a board needs to define an RC serial port for it to become configurable).
A board can still configure its default RC port with one or more of the following options:

#define RC_SERIAL_SWAP_RXTX
#define RC_SERIAL_SINGLEWIRE
#define RC_INVERT_INPUT(_invert_true) px4_arch_gpiowrite(GPIO_SBUS_INV, _invert_true)

Goes together with PX4/PX4-Bootloader#138.

Important: the last commit (13f97e5) disables double fp for the m7 toolchain, since not all m7 boards have the hw-support (such as the STM32F745 used here). This needs to be resolved before merging this PR.

I'll do a follow-up with a Kopis 2 airframe config.

@dagar
Copy link
Member

dagar commented Jul 9, 2019

Important: the last commit (13f97e5) disables double fp for the m7 toolchain, since not all m7 boards have the hw-support (such as the STM32F745 used here). This needs to be resolved before merging this PR.

The timing could be awkward (the toolchain is needed early), but we might be able to use NuttX CONFIG_ARCH_DPFPU.

@bkueng bkueng force-pushed the kakutef7 branch 2 times, most recently from f249337 to ad645b7 Compare July 9, 2019 16:47
@bkueng
Copy link
Member Author

bkueng commented Jul 9, 2019

The timing could be awkward (the toolchain is needed early), but we might be able to use NuttX CONFIG_ARCH_DPFPU.

That works indeed but I'm not sure if it's good to depend on NuttX config at this place.

@dagar
Copy link
Member

dagar commented Jul 9, 2019

Yes that's what I meant by awkward, but I think in this case we can get away with it. We already reconstitute the full defconfig and parse the config flags at cmake configure time to allow using NuttX variables in the build system.

The other idea is splitting the m7 platform toolchain (https://github.com/PX4/Firmware/blob/master/platforms/nuttx/cmake/Platform/Generic-arm-none-eabi-gcc-cortex-m7.cmake). It's simply using whatever is set in the board which then sets CMAKE_SYSTEM_PROCESSOR. https://github.com/PX4/Firmware/blob/fdcb0f06d6faca68bc08cbce2eb1eb88d10852e1/cmake/px4_add_board.cmake#L187

@dagar
Copy link
Member

dagar commented Jul 9, 2019

@bkueng
Copy link
Member Author

bkueng commented Jul 10, 2019

Yes that's what I meant by awkward, but I think in this case we can get away with it. We already reconstitute the full defconfig and parse the config flags at cmake configure time to allow using NuttX variables in the build system.

Ok let's try this then.

Can you add to Jenkins "Compile All Boards"?

Done.

@dagar
Copy link
Member

dagar commented Jul 10, 2019

@PX4/testflights could you test this PR on a pixhawk 4 mini? A quick test flight should be sufficient. Mainly checking the RC changes.

@dagar dagar requested a review from a team July 10, 2019 13:26
Copy link
Member

@davids5 davids5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bkueng - See inline comments.

boards/holybro/kakutef7/nuttx-config/scripts/script.ld Outdated Show resolved Hide resolved
boards/holybro/kakutef7/src/board_config.h Outdated Show resolved Hide resolved
boards/holybro/kakutef7/src/led.c Outdated Show resolved Hide resolved
boards/holybro/kakutef7/src/spi.cpp Show resolved Hide resolved
boards/holybro/kakutef7/src/led.c Outdated Show resolved Hide resolved
boards/holybro/kakutef7/src/timer_config.c Outdated Show resolved Hide resolved
boards/holybro/kakutef7/src/board_config.h Outdated Show resolved Hide resolved
boards/px4/fmu-v5/nuttx-config/nsh/defconfig Show resolved Hide resolved
@dagar dagar added this to Low priority in Devcall via automation Jul 10, 2019
@Tony3dr Tony3dr added this to Ready for testing in Test Flights Jul 10, 2019
@davids5
Copy link
Member

davids5 commented Jul 10, 2019

@PX4/testflights -
Testing
Bench test with RC: PPM, SBUS, DSM - Go no go testing with QGC radio calibration

  • RDDRONEK66
  • FMUV5
    • Pixhawk4
    • PixhawkMini
    • CUAV:Nano
    • CUAV:V5+
  • FMUV4 Pixracer RC14 or RC15
  • FMUv2 mro 2.4.6

davids5
davids5 previously approved these changes Jul 10, 2019
Copy link
Member

@davids5 davids5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bkueng - thank you for the changes.

On the LED stuff you may save some code space with removing the table

g_ledmap[led] - > GPIO_nLED_BLUE and dump xlat and CONFIG_ARCH_LEDS

#ifdef CONFIG_ARCH_LEDS
static bool nuttx_owns_leds = true;
//                                B  R  S  G
//                                0  1  2  3
static const uint8_t xlatpx4[] = {1, 2, 4, 0};
#  define xlat(p) xlatpx4[(p)]
static uint32_t g_ledmap[] = {
	GPIO_nLED_BLUE,    // Indexed by BOARD_LED_BLUE
};

#else
...

@Junkim3DR
Copy link

Tested on Pixhawk 4 mini v5

Modes Tested

  • Position mode: Good.
  • Altitude mode: Good.
  • Stabilized mode: Good.
  • Mission Plan mode (Automated): Good.
  • RTL (Return To Land): Good.

Test
Arm and Takeoff in position mode, once in the air, test mode switched and vehicle behavior.

Notes
No issue noted, good flight in general.

Log
https://review.px4.io/plot_app?log=c651ccff-fe65-4ef0-b4f8-ff3ef2566ba8

@dannyfpv
Copy link

dannyfpv commented Jul 10, 2019

Tested on Pixhawk 4 v5

Bench test with RC taranis qx7:
PPM d4r receiver calibration test: Successful no issues
SBUS xsr receiver calibration test: Successful no issues

Tested on Pixhawk 4 mini v5
PPM d4r receiver calibration test: Successful no issues
SBUS xsr receiver calibration test: Successful no issues

Tested on CUAV:Nano mini v5
PPM d4r receiver calibration test: Successful no issues
SBUS xsr receiver calibration test: Successful no issues

Tested on CUAV:v5+
PPM d4r receiver calibration test: Successful no issues
SBUS xsr receiver calibration test: Successful no issues

Tested on RDDRONEK66
PPM d4r receiver calibration test: Successful no issues
SBUS xsr receiver calibration test: Successful no issues

Tested on pixhawk1 v2
PPM d4r receiver calibration test: Successful no issues
SBUS x4r receiver calibration test: Successful no issues

Tested on pixracer v4
PPM d4r receiver calibration test: Successful no issues
SBUS xsr receiver calibration test: Successful no issues

@davids5 I will do the remainder FC tomorrow morning. Let us know if you need any additional information.

On all of these boards '$USE_IO = no' will hold.
A board only needs to define:
 #define RC_SERIAL_PORT                     "/dev/ttyS4"

Then it can optionally define one or more of the following:
 #define RC_SERIAL_SWAP_RXTX
 #define RC_SERIAL_SINGLEWIRE
 #define RC_INVERT_INPUT(_invert_true) px4_arch_gpiowrite(GPIO_SBUS_INV, _invert_true)
The parameter will only be available if the board defines an 'RC' serial
port in SERIAL_PORTS (in default.cmake).
The 'if [ $LOG_FILE = /dev/null ]' block can be removed, because
STARTUP_TUNE is already set in that case.
…config

Not all m7 boards support double, as for example the STM32F745.
The combination of 'if mycmd' and a logical expression is not supported in
NuttX.
@bkueng
Copy link
Member Author

bkueng commented Jul 11, 2019

Thanks for the reviews and testing.
I rebased and accounted for the dcache changes (#12435).

@davids5
Copy link
Member

davids5 commented Jul 11, 2019

@bkueng - did you test the tunes case for params on SD card and a mount fail?

@bkueng
Copy link
Member Author

bkueng commented Jul 11, 2019

@bkueng - did you test the tunes case for params on SD card and a mount fail?

I tested the mount failure with the different settings for CBRK_BUZZER. If the params are on SD, CBRK_BUZZER will be the default, and therefore trigger the error beep.

@davids5
Copy link
Member

davids5 commented Jul 11, 2019

Why the comment about the beeper not being PWM? it is on TIM4_CH4 TONE_ALARM_TIMER=4

image

@bkueng bkueng removed this from Low priority in Devcall Jul 11, 2019
@bkueng
Copy link
Member Author

bkueng commented Jul 15, 2019

@dannyfpv did you have a chance to test the remaining boards already?

Why the comment about the beeper not being PWM? it is on TIM4_CH4 TONE_ALARM_TIMER=4

@davids5 as discussed, the beeper HW is different and does not support frequencies.

@Tony3dr
Copy link

Tony3dr commented Jul 15, 2019

@dannyfpv did you have a chance to test the remaining boards already?
@bkueng all the boards were tested on PPM d4r receiver & SBUS xsr receiver. All the RC calibrations were successful.

@davids5 davids5 self-requested a review July 16, 2019 04:54
@bkueng bkueng merged commit f613581 into master Jul 16, 2019
Test Flights automation moved this from Ready for testing to Done Jul 16, 2019
@bkueng bkueng deleted the kakutef7 branch July 16, 2019 06:09
@bys1123
Copy link
Contributor

bys1123 commented Sep 11, 2019

Do you have any idea make this support local_position_estimator? Thanks!

@bkueng
Copy link
Member Author

bkueng commented Sep 16, 2019

Do you have any idea make this support local_position_estimator? Thanks!

LPE is deprecated, you can use EKF2 if you add a mag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Test Flights
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

7 participants