This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 3b219fb2da3fd524a34f47591e3c07b8363db740 Author: Michal Lenc <michall...@seznam.cz> AuthorDate: Thu Feb 25 23:27:34 2021 +0100 boards/arm/imxrt/teensy-4.x: allow configuration of all CANs Signed-off-by: Michal Lenc <michall...@seznam.cz> --- boards/arm/imxrt/teensy-4.x/README.txt | 14 ++++++-------- boards/arm/imxrt/teensy-4.x/configs/can-4.1/defconfig | 12 ++++-------- boards/arm/imxrt/teensy-4.x/src/imxrt_flexcan.c | 17 ++++++++++------- 3 files changed, 20 insertions(+), 23 deletions(-) diff --git a/boards/arm/imxrt/teensy-4.x/README.txt b/boards/arm/imxrt/teensy-4.x/README.txt index 86fb3ce..b6e9374 100644 --- a/boards/arm/imxrt/teensy-4.x/README.txt +++ b/boards/arm/imxrt/teensy-4.x/README.txt @@ -138,8 +138,9 @@ Configuration sub-directories can-4.1: This is an nsh configuration (see above) for Teensy-4.x with added support of - CAN driver. FlexCAN3 is chosen as default, the change can be made at System - type peripheral selection. + CAN driver. All FlexCANs (CAN1, CAN2, CAN3) are chosen as default. FlexCAN3 + is FD capable. Please note that device driver name if counted from zero. + That means for CAN1 -> can0, CAN2 -> can1 and CAN3 -> can2 Bitrate and sample point can be also changed at System type peripheral selection, basic values are 1 MHz for bitrate and 0.80 for sample point. The FlexCAN driver @@ -147,15 +148,12 @@ Configuration sub-directories The configuration also includes CAN utilities as candump and cansend. - CAN_FD supported but not enabled. For CAN_FD please select following: - - CAN_FD = y - NET_CAN_CANFD = y - NET_CAN_SOCK_OPTS = y - This configuration can be easily changed to work with Teensy 4.0 by selecting CONFIG_TEENSY_40=y. + This configuration runs over LPUART1 (pins 24 and 25 on Teensy). Communication + over USB console can be turn on, but it couses problems with FlexCAN. + netnsh-4.1: This configuration is similar to the nsh configuration except that is diff --git a/boards/arm/imxrt/teensy-4.x/configs/can-4.1/defconfig b/boards/arm/imxrt/teensy-4.x/configs/can-4.1/defconfig index 664e35e..cfecc87 100644 --- a/boards/arm/imxrt/teensy-4.x/configs/can-4.1/defconfig +++ b/boards/arm/imxrt/teensy-4.x/configs/can-4.1/defconfig @@ -5,7 +5,6 @@ # You can then do "make savedefconfig" to generate a new defconfig file that includes your # modifications. # -# CONFIG_NET_CAN_CANFD is not set # CONFIG_NET_ETHERNET is not set # CONFIG_NET_IPv4 is not set CONFIG_ARCH="arm" @@ -21,17 +20,16 @@ CONFIG_ARMV7M_ICACHE=y CONFIG_ARMV7M_USEBASEPRI=y CONFIG_BOARD_LOOPSPERMSEC=104926 CONFIG_BUILTIN=y -CONFIG_CAN=y CONFIG_CANUTILS_CANDUMP=y CONFIG_CANUTILS_CANSEND=y -CONFIG_CDCACM=y -CONFIG_CDCACM_CONSOLE=y CONFIG_FS_PROCFS=y CONFIG_IDLETHREAD_STACKSIZE=2048 +CONFIG_IMXRT_FLEXCAN1=y +CONFIG_IMXRT_FLEXCAN2=y CONFIG_IMXRT_FLEXCAN3=y CONFIG_IMXRT_LPUART1=y -CONFIG_IMXRT_USBDEV=y CONFIG_INTELHEX_BINARY=y +CONFIG_LPUART1_SERIAL_CONSOLE=y CONFIG_MAX_TASKS=16 CONFIG_NET=y CONFIG_NETDEVICES=y @@ -40,7 +38,7 @@ CONFIG_NETDEV_LATEINIT=y CONFIG_NETDEV_STATISTICS=y CONFIG_NET_CAN=y CONFIG_NET_CAN_NOTIFIER=y -CONFIG_NET_SOCKOPTS=y +CONFIG_NET_CAN_SOCK_OPTS=y CONFIG_NET_STATISTICS=y CONFIG_NET_TIMESTAMP=y CONFIG_NFILE_DESCRIPTORS=8 @@ -49,7 +47,6 @@ CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_LINELEN=64 CONFIG_NSH_READLINE=y -CONFIG_NSH_USBCONSOLE=y CONFIG_RAM_SIZE=1048576 CONFIG_RAM_START=0x20200000 CONFIG_SCHED_HPWORK=y @@ -58,5 +55,4 @@ CONFIG_START_DAY=14 CONFIG_START_MONTH=3 CONFIG_SYSTEM_NSH=y CONFIG_TEENSY_41=y -CONFIG_USBDEV=y CONFIG_USER_ENTRYPOINT="nsh_main" diff --git a/boards/arm/imxrt/teensy-4.x/src/imxrt_flexcan.c b/boards/arm/imxrt/teensy-4.x/src/imxrt_flexcan.c index d12d133..8d08c46 100644 --- a/boards/arm/imxrt/teensy-4.x/src/imxrt_flexcan.c +++ b/boards/arm/imxrt/teensy-4.x/src/imxrt_flexcan.c @@ -50,31 +50,34 @@ int imxrt_can_setup(void) { int ret; -#ifdef CONFIG_IMXRT_FLEXCAN3 +#ifdef CONFIG_IMXRT_FLEXCAN1 /* Call arm_caninitialize() to get an instance of the CAN interface */ - ret = imxrt_caninitialize(3); + ret = imxrt_caninitialize(1); if (ret < 0) { canerr("ERROR: Failed to get CAN interface\n"); return -ENODEV; } -#elif CONFIG_IMXRT_FLEXCAN2 + +#endif +#ifdef CONFIG_IMXRT_FLEXCAN2 ret = imxrt_caninitialize(2); if (ret < 0) { canerr("ERROR: Failed to get CAN interface\n"); return -ENODEV; } -#elif CONFIG_IMXRT_FLEXCAN1 - ret = imxrt_caninitialize(1); + +#endif +#ifdef CONFIG_IMXRT_FLEXCAN3 + ret = imxrt_caninitialize(3); if (ret < 0) { canerr("ERROR: Failed to get CAN interface\n"); return -ENODEV; } -#else - return -ENODEV; + #endif UNUSED(ret); return OK;