Skip to main content
Explorer II
March 26, 2024
Solved

CANFD configuration with CAN 2.0 devices

  • March 26, 2024
  • 2 replies
  • 4221 views

I am using CANFD with an STM32H7 and a transceiver that is compatible with CANFD and CAN 2.0 (ISO1044BDR).

I can see that in the configuration the CANFD can be used as a CAN 2.0. 

What I want to know is what is the easiest way to integrate the flexibility between choosing of using CANFD or CAN 2.0 in my project. I'm planning on using a DIP switch to signal the MCU what I'm using. 
Or is there a way to keep the CANFD code and communicate with other CAN 2.0 devices - probably not as the packet is not the same and other parameters... 

The second question here is can I include both functionalities (CAN 2.0 and CANFD) and choose it at run time which one I want to use?

 

Thanks

    This topic has been closed for replies.
    Best answer by mƎALLEm

    I don't know... this is what you want to do.

    The MCU needs to know which mode will take as config, in your case with a switch, it could be something else, an information coming from the GUI or whatever. Changing from a mode to another needs to re-init the module. But as I've already said I don't see the reason to change it at run time

    2 replies

    Technical Moderator
    March 26, 2024

    Not sure I understood what do you want to do. Do you want to mix CAN2.0 and CANFD frames on the same bus?  you can refer to the attached documents about mixed network topology between CAN2.0 and CANFD. 

    "I can see that in the configuration the CANFD can be used as a CAN 2.0. "

    Yes indeed.

    I don't see a reason to switch at runtime between CANFD and CAN2.0 on the same bus.

    __silardgAuthor
    Explorer II
    March 26, 2024

    The device I'm developing should be able to communicate on a CANFD OR CAN 2.0. The same interface should be used (FDCAN1). This would be set with a DIP switch and the MCU on setup would choose what to use. 

    I don't want to change the firmware depending on what kind of application (CANFD or CAN 2.0) I need, that is why I would like to set it up via a DIP switch. 

    I understand that there is no hardware modification, only the firmware configuration. 

    I also have FDCAN2 available, is it a better option to setup CANFD on one and CAN 2.0 on the other and just use a DPDT switch to select which I need? 

    To make it fully clear. I want to use CANFD or CAN 2.0 on the bus. Not at the same time, but depending on the application I would choose one or the other. On the other side of the bus I would have a device that is compatible. 

    Technical Moderator
    March 26, 2024

    Do you want to setup the CAN peripheral according to your switch position at the startup but doesn't change during the communication and still at that config until the next reset?

    __silardgAuthor
    Explorer II
    March 26, 2024

    Okay, but is that the simplest and easiest way to do this? 

    mƎALLEmAnswer
    Technical Moderator
    March 26, 2024

    I don't know... this is what you want to do.

    The MCU needs to know which mode will take as config, in your case with a switch, it could be something else, an information coming from the GUI or whatever. Changing from a mode to another needs to re-init the module. But as I've already said I don't see the reason to change it at run time