Skip to content

Commit

Permalink
Merge pull request #9982 from SamantazFox/teensy-can
Browse files Browse the repository at this point in the history
canio: Add support for i.MX 10xx series of chips
  • Loading branch information
tannewt authored Jan 21, 2025
2 parents 25ef665 + 69c88eb commit 04d9c53
Show file tree
Hide file tree
Showing 15 changed files with 814 additions and 2 deletions.
5 changes: 5 additions & 0 deletions locale/circuitpython.pot
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,7 @@ msgstr ""

#: ports/atmel-samd/common-hal/canio/Listener.c
#: ports/espressif/common-hal/canio/Listener.c
#: ports/mimxrt10xx/common-hal/canio/Listener.c
#: ports/stm/common-hal/canio/Listener.c
msgid "Filters too complex"
msgstr ""
Expand Down Expand Up @@ -2140,6 +2141,10 @@ msgstr ""
msgid "Unable to read color palette data"
msgstr ""

#: ports/mimxrt10xx/common-hal/canio/CAN.c
msgid "Unable to send CAN Message: all Tx message buffers are busy"
msgstr ""

#: ports/espressif/common-hal/mdns/Server.c
#: ports/raspberrypi/common-hal/mdns/Server.c
msgid "Unable to start mDNS query"
Expand Down
4 changes: 4 additions & 0 deletions ports/mimxrt10xx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ SRC_SDK += drivers/adc_12b1msps_sar/fsl_adc.c \
drivers/tempmon/fsl_tempmon.c
endif

ifeq ($(CIRCUITPY_CANIO), 1)
SRC_SDK += drivers/flexcan/fsl_flexcan.c
endif

ifeq ($(CHIP_FAMILY), MIMXRT1176)
SRC_SDK += devices/$(CHIP_FAMILY)/drivers/fsl_anatop_ai.c \
devices/$(CHIP_FAMILY)/drivers/fsl_dcdc.c \
Expand Down
1 change: 1 addition & 0 deletions ports/mimxrt10xx/boards/teensy41/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ CHIP_VARIANT = MIMXRT1062DVJ6A
CHIP_FAMILY = MIMXRT1062
FLASH = W25Q64JV
CIRCUITPY__EVE = 1
CIRCUITPY_CANIO = 1
CIRCUITPY_USB_HOST = 1
CIRCUITPY_SETTABLE_PROCESSOR_FREQUENCY = 1
18 changes: 18 additions & 0 deletions ports/mimxrt10xx/boards/teensy41/pins.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,5 +179,23 @@ static const mp_rom_map_elem_t board_module_globals_table[] = {
{MP_OBJ_NEW_QSTR(MP_QSTR_TX7), MP_ROM_PTR(&pin_GPIO_EMC_31)},
{MP_OBJ_NEW_QSTR(MP_QSTR_RX8), MP_ROM_PTR(&pin_GPIO_B1_13)},
{MP_OBJ_NEW_QSTR(MP_QSTR_TX8), MP_ROM_PTR(&pin_GPIO_B1_12)},

// CAN and CAN-FD
{MP_OBJ_NEW_QSTR(MP_QSTR_CAN1_RX), MP_ROM_PTR(&pin_GPIO_AD_B1_09)},
{MP_OBJ_NEW_QSTR(MP_QSTR_CAN1_TX), MP_ROM_PTR(&pin_GPIO_AD_B1_08)},

{MP_OBJ_NEW_QSTR(MP_QSTR_CAN2_RX), MP_ROM_PTR(&pin_GPIO_AD_B0_03)},
{MP_OBJ_NEW_QSTR(MP_QSTR_CAN2_TX), MP_ROM_PTR(&pin_GPIO_AD_B0_02)},

{MP_OBJ_NEW_QSTR(MP_QSTR_CAN3_RX), MP_ROM_PTR(&pin_GPIO_EMC_37)},
{MP_OBJ_NEW_QSTR(MP_QSTR_CAN3_TX), MP_ROM_PTR(&pin_GPIO_EMC_36)},

// "CAN" is an alias for CAN1
{MP_OBJ_NEW_QSTR(MP_QSTR_CAN_RX), MP_ROM_PTR(&pin_GPIO_AD_B1_09)},
{MP_OBJ_NEW_QSTR(MP_QSTR_CAN_TX), MP_ROM_PTR(&pin_GPIO_AD_B1_08)},

// "CANFD" is an alias for CAN3
{MP_OBJ_NEW_QSTR(MP_QSTR_CANFD_RX), MP_ROM_PTR(&pin_GPIO_EMC_37)},
{MP_OBJ_NEW_QSTR(MP_QSTR_CANFD_TX), MP_ROM_PTR(&pin_GPIO_EMC_36)},
};
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);
Loading

0 comments on commit 04d9c53

Please sign in to comment.