I'd like to use the CANopen SDK demo that comes with MCUXpresso (for the EVKMIMMXRT1060) but I would like to change the peripheral from FLEXCAN_2 to FLEXCAN_1. What are all the steps i need to do to change the demo code to output the CAN signals from the FLEXCAN_1 peripheral? Specifically, I'd like to use these two pins:
CAN1TX---GPIO_AD_B1_08
CAN1RX---GPIO_AD_B1_09
Please advise me as to all the steps I would need to do to configure this peripheral and get CAN signals out of it.
I've already modified the BOARD_InitPins() function in the pin_mix.c file and added these commands:
IOMUXC_SetPinMux(
IOMUXC_GPIO_AD_B1_08_FLEXCAN1_TX, /* GPIO_AD_B0_14 is configured as FLEXCAN2_TX */
1U); /* Software Input On Field: Force input path of pad GPIO_AD_B1_08 */
IOMUXC_SetPinMux(
IOMUXC_GPIO_AD_B1_09_FLEXCAN1_RX, /* GPIO_AD_B0_15 is configured as FLEXCAN2_RX */
1U); /* Software Input On Field: Force input path of pad GPIO_AD_B1_09 */
IOMUXC_SetPinConfig(
IOMUXC_GPIO_AD_B1_08_FLEXCAN1_TX, /* GPIO_AD_B1_08 PAD functional properties : */
0x10B0u); /* Slew Rate Field: Slow Slew Rate
Drive Strength Field: R0/6
Speed Field: medium(100MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
IOMUXC_SetPinConfig(
IOMUXC_GPIO_AD_B1_09_FLEXCAN1_RX, /* GPIO_AD_B1_09 PAD functional properties : */
0x10B0u); /* Slew Rate Field: Slow Slew Rate
Drive Strength Field: R0/6
Speed Field: medium(100MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
What else do I need to do?
It's very disappointing that given the iMXRT1060 is advertised as having three (3) CAN ports and a CANOpen library provided with the SDK does not allow one to just change which port one can use. That's VERY DISAPPOINTING
For that reason I will NOT use the EmSA CANOpen library. I will be modifying an open source CANOpen library. It makes no technical sense for there not to be a way to use ANY one of the three (3) CAN peripherals. No sense whatesoever!!!
Hello Ahmed,
First of all, please accept my apologies for my late reply. We have been under a big workload.
Regarding your question, unfortunately this customization is not possible because FlexCAN2 is initialized in MCO_Init API which is part of the CANOpen library integrated within MCUXpresso SDK. You can find the related manual in the following path of the SDK package.
SDK_2.7.0_EVK-MIMXRT1060\middleware\canopen\doc
I am sorry for the inconvenience this may cause you.
Best regards,
Felipe
@FelipeGarciaI'm not sure why you refer the person asking the question re: changing peripherals, not sure why you refer them back to EmSA manual. Going back to the manual will NOT help them resolve the issue.
I'm running my software on the Teensy 4.0, so I don't have access to that same GPIO_AD_B0_14_FLEXCAN2_TX and GPIO_AD_B0_15_FLEXCAN2_RX that is used in the example. Can I still use FLEXCAN2 but use the
CAN2.0 CANRX2 ---GPIO_AD_B0_03 and
CAN2.0 CANTX2 ---GPIO_AD_B0_02
peripherals instead? If so, what would I need to do to accomplish this?
I'm desperately trying to get CANopen on the Teensy 4.0, so I appreciate any help.
I also notice that evkmimxrt1020 uses FLEXCAN1 and does compile onto the iMXRT1062 mcu that I have, could I leverage that library instead to use FLEXCAN1 but change the pinmux to use a different set of pins?
Thank you very much.