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

NXPhlite-v3 with Leitwert's serial dma #9392

Merged
merged 43 commits into from
Aug 14, 2018
Merged

Conversation

davids5
Copy link
Member

@davids5 davids5 commented May 1, 2018

This ties together the Now upstreamed DMA work from @laube and @janokle of leitwert on the current PX4 nuttx

From: #8030

This is a WIP for the NXP flight V3 HW based on the K66. It builds but is incomplete as it is missing key Nuttx support in the Kinetis architecture.

The drivers/kinetis/* is just stubbed out. There is SPI, or DMA support

Missing Components

  • FPU support in the OS

  • DMA (needs to be made consistent with NuttX CS and upstreamed, should also consider streaming)

  • SPI - Completed

  • CAN

  • VBAT - for bootloader app communication.

  • Timers PIT, LPTM, and FTM, PDB - for pwm, capture, tones, and hrt.

  • RESET up_systemreset(void) noreturn_function;

    Incomplete Drivers:

  • PWM supports only 1 chan per timer.

  • USB The K66 has 2 USB USB0 is FS (Nuttx has driver) USB1 is HS (No NuttX driver!)

  • UART lacking DMA kinetis_serial_dma_poll(void)
    Tested with RTS/CTS HS (RTS out of CPU is per character - Consider GPIO based SW flow control ala stm32)
    -[x] SBUS - tested working

  • TERMIOS for serial

  • RTC - up_rtc_getdatetime - Config issue fixed

  • SDHC DMA disabled will not work with it yet

OS/System dependant SW

  • Cannot use FPU yet on kinetis
  • Termios
  • tcgetattr
  • tcsetattr
  • cfsetspeed

PX4 FMUV2 Modules removed from build due to No External SPI

  • drivers/bma180

  • drivers/bmi160

    NOT Portable YET

  • MCU version

  • /Firmware/src/modules/systemlib/mcu_version.c

  • drivers/pwm_input

  • drivers/test_ppm

  • systemcmds/hardfault_log - needs bsram

  • modules/uavcan

  • uavcan

  • uavcan_stm32_driver - need Kinetis CAN driver

PX4 Drivers Needing porting

  • drivers/kinetis/*

  • [ X] drv_hrt.c

    • HRT
    • PPM
  • drv_input_capture.c

  • drv_io_timer.c

  • drv_led_pwm.cpp

  • drv_pwm_servo.c

  • drivers/kinetis/adc

  • drivers/kinetis/tone_alarm

  • 5/31 - Need to add tone control lib. - Done

@davids5
Copy link
Member Author

davids5 commented Jun 24, 2018

@dannyfpv - would you please test with 5b0ad4e on FMUv2 Pixhawk with 2 MB and Nxphlite

@davids5 davids5 force-pushed the leitwert-nxphlite-serial-dma branch from 76b3d64 to 9e4e19d Compare July 9, 2018 21:55
@davids5 davids5 force-pushed the leitwert-nxphlite-serial-dma branch 2 times, most recently from b8ed25e to 6215117 Compare July 23, 2018 19:29
@davids5 davids5 force-pushed the leitwert-nxphlite-serial-dma branch 3 times, most recently from f87e18d to fb89ad7 Compare August 10, 2018 20:06
@davids5 davids5 changed the title [WIP] Leitwert's nxphlite serial dma NXPhlite-v3 with Leitwert's serial dma Aug 11, 2018
@davids5 davids5 requested a review from dagar August 11, 2018 00:20
@dagar
Copy link
Member

dagar commented Aug 11, 2018

image

@davids5 davids5 force-pushed the leitwert-nxphlite-serial-dma branch from 1a428f0 to 53bb82d Compare August 13, 2018 15:43
@davids5
Copy link
Member Author

davids5 commented Aug 13, 2018

rebased on master

@davids5
Copy link
Member Author

davids5 commented Aug 13, 2018

@LorenzMeier -

I was a tad perplexed as to how the minimal changes done to PX4 to bring in Kinetis, could affect the V2 build spilling over by 1028 bytes. Boaty indicated it was the ROMFS.

There were 3 lines added to the rcS recently but it caused a 1028 spill over. This makes sense
From reading https://www.kernel.org/doc/Documentation/filesystems/romfs.tx

Another thing to note is that romfs works on file headers and data
aligned to 16 byte boundaries, but most hardware devices and the block
device drivers are unable to cope with smaller than block-sized data.
To overcome this limitation, the whole size of the file system must be
padded to an 1024 byte boundary.

@dagar and I spent some time looking at memory usage.
There is still the 9.5K to get back from mavlink.
There are 41 K of strings for the logger field decoding. ~3 K can be recovered by encoding the types as ordinals not strings in the orb_*._fields

@dagar volunteered to pymavlink PR doen, that will buy us some time, but may take time to come in upstream.

I can not get this branch merged until master get cleaned has some room.

@davids5 davids5 force-pushed the leitwert-nxphlite-serial-dma branch 2 times, most recently from 5d1c07f to 8380c96 Compare August 13, 2018 21:41
@davids5
Copy link
Member Author

davids5 commented Aug 13, 2018

rebased dropping
DO NOT MERGE TO MASTER: Lower avionics check thresholds 0de1f02

@@ -0,0 +1,45 @@
/****************************************************************************
*
* Copyright (C) 20158 PX4 Development Team. All rights reserved.
Copy link
Member

Choose a reason for hiding this comment

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

copyright

*/

#pragma once
#if defined(UAVCAN_KINETIS_NUTTX)
Copy link
Member

Choose a reason for hiding this comment

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

Can't we set the platform define automatically from ${CONFIG_ARCH_CHIP}?

Copy link
Member Author

Choose a reason for hiding this comment

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

@dagar I see your point and yes we could. But relative to
-DUAVCAN_${UAVCAN_PLATFORM_UPPER}_${OS_UPPER}=1
we have to consider the coupling of 2 libraries we do not have direct control over.

Uavcan use this set of defines in its drivers.

UAVCAN_KINETIS_NUTTX
UAVCAN_STM32_CHIBIOS
UAVCAN_STM32_NUTTX
UAVCAN_STM32_BAREMETAL
UAVCAN_STM32_FREERTOS

The choice was to stay consistent with uavcan. If we choose to use CONFIG_ARCH_CHIP it will break the stm32f7 usage. So defaulting it to stm32 and having the ability to override it seemed like a good choice for flexibility and decoupling.

So I would prefer to stick with it, unless you see otherwise.

@davids5
Copy link
Member Author

davids5 commented Aug 14, 2018

rebased on current master and copyright dates fixed

@davids5 davids5 force-pushed the leitwert-nxphlite-serial-dma branch from 8380c96 to 76e2493 Compare August 14, 2018 11:25
@dagar dagar merged commit cff3d55 into master Aug 14, 2018
@dagar dagar deleted the leitwert-nxphlite-serial-dma branch August 14, 2018 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants