Skip to content

Commit

Permalink
ports/mimxrt: Add machine.CAN driver.
Browse files Browse the repository at this point in the history
  • Loading branch information
kwagyeman authored and iabdalkader committed Dec 3, 2023
1 parent 93c6af9 commit 59b60d5
Show file tree
Hide file tree
Showing 8 changed files with 958 additions and 1 deletion.
5 changes: 5 additions & 0 deletions ports/mimxrt/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ ifeq ($(MICROPY_PY_MACHINE_SDCARD),1)
SRC_HAL_IMX_C += $(MCU_DIR)/drivers/fsl_usdhc.c
endif

ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES), MIMXRT1021 MIMXRT1052 MIMXRT1062 MIMXRT1064 MIMXRT1176))
SRC_HAL_IMX_C += $(MCU_DIR)/drivers/fsl_flexcan.c
endif

ifeq ($(MCU_SERIES),$(filter $(MCU_SERIES), MIMXRT1015 MIMXRT1021 MIMXRT1052 MIMXRT1062 MIMXRT1064 MIMXRT1176))
SRC_HAL_IMX_C += \
$(MCU_DIR)/drivers/fsl_qtmr.c \
Expand Down Expand Up @@ -188,6 +192,7 @@ SRC_C += \
led.c \
machine_adc.c \
machine_bitstream.c \
machine_can.c \
machine_i2c.c \
machine_i2s.c \
machine_led.c \
Expand Down
3 changes: 2 additions & 1 deletion ports/mimxrt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ MIMXRT1064_EVK boards.
Features:
- REPL over USB VCP
- machine.ADC
- machine.CAN
- machine.I2C
- machine.LED
- machine.Pin
Expand All @@ -27,7 +28,7 @@ Features:
Known issues:

TODO:
- More peripherals (Counter, I2S, CAN, etc)
- More peripherals (Counter, I2S, etc)
- More Python options

## Build Instructions
Expand Down
13 changes: 13 additions & 0 deletions ports/mimxrt/boards/OPENMV_RT1060/mpconfigboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ extern void mimxrt_hal_bootloader(void);

#define MICROPY_PY_NETWORK_HOSTNAME_DEFAULT "openmvrt1060"

#define MICROPY_PY_MACHINE_CAN (1)

#define MICROPY_HW_USB_MSC (1)
#define MICROPY_HW_USB_VID 0x1209
#define MICROPY_HW_USB_PID 0xabd1
Expand Down Expand Up @@ -134,6 +136,17 @@ extern void mimxrt_hal_bootloader(void);
{ 0 }, { 0 }, \
{ IOMUXC_GPIO_AD_B0_12_LPI2C4_SCL }, { IOMUXC_GPIO_AD_B0_13_LPI2C4_SDA },

// Define the mapping hardware CAN # to logical CAN #
// Bus HW-CAN Logical CAN
// External FLEXCAN2 -> 0

#define MICROPY_HW_CAN_INDEX { 2 }
#define MICROPY_HW_NUM_CAN_IRQS (1)

#define IOMUX_TABLE_CAN \
{ 0 }, { 0 }, \
{ IOMUXC_GPIO_AD_B0_02_FLEXCAN2_TX }, { IOMUXC_GPIO_AD_B0_03_FLEXCAN2_RX },

#define USDHC_DUMMY_PIN NULL, 0
#define MICROPY_USDHC1 \
{ \
Expand Down
Loading

0 comments on commit 59b60d5

Please sign in to comment.