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

Backport all CAN-related changes from upstream NuttX #186

Draft
wants to merge 43 commits into
base: px4_firmware_nuttx-10.1.0+
Choose a base branch
from

Conversation

JacobCrabill
Copy link
Member

Summary

Extension of #185 to include all CAN related development from upstream NuttX beyond PX4's forked 10.1.0+ version.

Open to discussion on how many of these changes we'd like to backport, and how many we'd prefer to leave out. For now, I tried to backport everything that touched PX4-supported CAN drivers or the SocketCAN layer.

Impact

Adds the following features / fixes:

  • SocketCAN drivers for arch/stm32 (bxCAN and FDCAN)
  • SocketCAN drivers arch/stm32h7 (FDCAN) (duplicated from Backport STM32H7 FDCAN #185)
  • Adds CAN error definitions
  • Changes to network layer around CAN connections
  • Bugfix(es) to IMXRT FlexCAN driver
  • Board updates related to various CAN drivers; example configs
  • Additional CONFIG options for net/can
  • Bug fix to STM32F7 CAN3

Testing

None yet

JacobCrabill and others added 26 commits July 27, 2022 17:33
Adds an FDCAN driver for STM32H7 MCUs using the SocketCAN interface
Note that pinmap.h, irq.h, fdcan.h still need to be updated with proper
register definitions for the FDCAN3 peripheral present in
STM32H7[2|3][3|5] MCUs
This file is used by the libcanutils and can be isolated in apps

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
…k free MBs

CAN_ESR2 register was having problems of havng the correct values when
the bus was busy (with 3 and more nods). The register bit fields were
incorrectly indicating that there is no free MB and would not updated
itself from this state which was causing the applications to freeze on
write. This change relies only on a software control which should avoid
the problems described above.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
This commit adds option for Teensy 4.x board to initialize CAN3 as can0.
The reason of this is the CAN FD capability of CAN3. This commit also
disables tickless mode support for pikron-bb configuration as this option
started causing hard faults which are yet to be solved.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
…only those connections that are bound to the device.

tcp_timer: eliminated false decrements of conn->timer in case of multiple network adapters.
The false timer decrements sometimes provoked TCP spurious retransmissions due to premature timeouts.
@JacobCrabill JacobCrabill force-pushed the pr-backport-all-can-changes branch from be60696 to e596450 Compare July 28, 2022 00:35
This reverts commit 9ce3fab.

PR reference: apache/nuttx#5467

In order for this commit to be valid, the following other PRs must also
be back-ported first:
- apache/nuttx#5434

Additional PRs that fix related bugs:
- apache/nuttx#5462
- apache/nuttx#5466
JacobCrabill added a commit to PX4/PX4-Autopilot that referenced this pull request Jul 28, 2022
Point to the branch of PX4/NuttX#186
Adds SocketCAN drivers for all STM32 targets
Includes other fixes and improvements to CAN drivers in NuttX
@PetervdPerk-NXP
Copy link
Member

PetervdPerk-NXP commented Jul 29, 2022

You might want to backport this patch as well.
apache/nuttx@51a845c
It allows you to listen with multiple applications to the same CAN peripheral

We could also consider upgrading the NuttX kernel in general.
I can compile Apache/NuttX master against my own PX4 branch but needs some further testing.
https://github.com/petervdperk-nxp/firmware/tree/nuttx_master_10.3+_s32k3

@JacobCrabill
Copy link
Member Author

You might want to backport this patch as well. apache/incubator-nuttx@51a845c It allows you to listen with multiple applications to the same CAN peripheral

We could also consider upgrading the NuttX kernel in general. I can compile Apache/NuttX master against my own PX4 branch but needs some further testing. https://github.com/petervdperk-nxp/firmware/tree/nuttx_master_10.3+_s32k3

I have a similar branch compiling against NuttX 10.3; I'm a little concerned about that route, though, just based on the amount of churn / rapid changes to upstream NuttX.

@davids5
Copy link
Member

davids5 commented Jul 30, 2022

I have a similar branch compiling against NuttX 10.3; I'm a little concerned about that route, though, just based on the amount of churn / rapid changes to upstream NuttX.

I could not agree more.

@PetervdPerk-NXP
Copy link
Member

I have a similar branch compiling against NuttX 10.3; I'm a little concerned about that route, though, just based on the amount of churn / rapid changes to upstream NuttX.

Although I agree with rapid changes and poor QA control in upstream NuttX.
I'll prefer to still to aim to periodically (i.e. anually) base off Upstream NuttX to get also some nice features in, right now we would get things like Task-aware debugging, Tracing etc. but also to ensure that transitioning to a new kernel doesn't have a major impact each time.

Furthermore right now we can build PX4 with both upstream NuttX (10.3+) and PX4 NuttX (10.1+), which is perfect to do some A/B testing and addressing the issues we encounter to Apache/incubator-nuttx.

Co-authored-by: Peter van der Perk <peter.vanderperk@nxp.com>
PX4BuildBot pushed a commit that referenced this pull request Aug 24, 2024
CC:  modlib/modlib_depend.c "modlib/modlib_bind.c", line 741: warning #186-D: pointless comparison of
          unsigned integer with zero
            if (rel->r_offset < 0)
                              ^

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
PX4BuildBot pushed a commit that referenced this pull request Aug 27, 2024
"ioexpander/gpio.c", line 529: warning #186-D: pointless comparison of
          unsigned integer with zero
            if (pintype < GPIO_INPUT_PIN || pintype >= GPIO_NPINTYPES)
                        ^

Signed-off-by: guoshichao <guoshichao@xiaomi.com>
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.