boards/arm/imxrt/teensy-4.x: add option to have CAN3 as can0

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>
This commit is contained in:
Michal Lenc 2021-08-29 22:59:14 +02:00 committed by Alan Carvalho de Assis
parent 1ec0258407
commit e180f32020
3 changed files with 29 additions and 9 deletions

View File

@ -24,4 +24,10 @@ config TEENSY_41
endchoice # Board configuration
config IMXRT_FLEXCAN3_AS_CAN0
bool "Initialize CAN3 bus as can0"
---help---
This configuration option ensures that if more that one CAN bus is set on
that CAN 3 (with FD capability) will be initialized as can0.
endif

View File

@ -9,6 +9,7 @@
# CONFIG_NSH_DISABLE_DATE is not set
# CONFIG_NSH_DISABLE_PRINTF is not set
# CONFIG_NSH_DISABLE_TRUNCATE is not set
CONFIG_ALLOW_GPL_COMPONENTS=y
CONFIG_ARCH="arm"
CONFIG_ARCH_BOARD="teensy-4.x"
CONFIG_ARCH_BOARD_TEENSY_4X=y
@ -31,11 +32,6 @@ CONFIG_CANUTILS_CANDUMP=y
CONFIG_CANUTILS_CANSEND=y
CONFIG_CAN_FD=y
CONFIG_CLOCK_MONOTONIC=y
CONFIG_DEBUG_ERROR=y
CONFIG_DEBUG_FEATURES=y
CONFIG_DEBUG_FULLOPT=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEBUG_WARN=y
CONFIG_DEV_LOOP=y
CONFIG_DEV_ZERO=y
CONFIG_DRIVERS_VIDEO=y
@ -58,7 +54,11 @@ CONFIG_IDLETHREAD_STACKSIZE=2048
CONFIG_IMXRT_ENET=y
CONFIG_IMXRT_ENET_NRXBUFFERS=16
CONFIG_IMXRT_ENET_NTXBUFFERS=8
CONFIG_IMXRT_FLEXCAN1=y
CONFIG_IMXRT_FLEXCAN2=y
CONFIG_IMXRT_FLEXCAN3=y
CONFIG_IMXRT_FLEXCAN3_AS_CAN0=y
CONFIG_IMXRT_FLEXCAN_TXMB=1
CONFIG_IMXRT_LPSPI4=y
CONFIG_IMXRT_LPUART1=y
CONFIG_IMXRT_SNVS_LPSRTC=y
@ -128,9 +128,8 @@ CONFIG_RAM_START=0x20200000
CONFIG_READLINE_CMD_HISTORY=y
CONFIG_RR_INTERVAL=10
CONFIG_SCHED_CPULOAD=y
CONFIG_SCHED_CPULOAD_EXTCLK=y
CONFIG_SCHED_LPWORK=y
CONFIG_SCHED_TICKLESS=y
CONFIG_SCHED_TICKLESS_ALARM=y
CONFIG_SCHED_USER_IDENTITY=y
CONFIG_SCHED_WAITPID=y
CONFIG_SERIAL_TERMIOS=y
@ -147,6 +146,6 @@ CONFIG_SYSTEM_PING6=y
CONFIG_SYSTEM_PING=y
CONFIG_SYSTEM_TEE=y
CONFIG_TEENSY_41=y
CONFIG_USEC_PER_TICK=10
CONFIG_USEC_PER_TICK=1000
CONFIG_USER_ENTRYPOINT="nsh_main"
CONFIG_VIDEO_FB=y

View File

@ -50,6 +50,19 @@
int imxrt_can_setup(void)
{
int ret;
#ifdef CONFIG_IMXRT_FLEXCAN3_AS_CAN0
# ifdef CONFIG_IMXRT_FLEXCAN3
ret = imxrt_caninitialize(3);
if (ret < 0)
{
canerr("ERROR: Failed to get CAN interface\n");
return -ENODEV;
}
# endif
#endif
#ifdef CONFIG_IMXRT_FLEXCAN1
/* Call arm_caninitialize() to get an instance of the CAN interface */
@ -70,7 +83,8 @@ int imxrt_can_setup(void)
}
#endif
#ifdef CONFIG_IMXRT_FLEXCAN3
#ifndef CONFIG_IMXRT_FLEXCAN3_AS_CAN0
# ifdef CONFIG_IMXRT_FLEXCAN3
ret = imxrt_caninitialize(3);
if (ret < 0)
{
@ -78,6 +92,7 @@ int imxrt_can_setup(void)
return -ENODEV;
}
# endif
#endif
UNUSED(ret);
return OK;