Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial CTU-CAN-FD core support. #2007

Merged
merged 3 commits into from
Jul 5, 2024
Merged

Add initial CTU-CAN-FD core support. #2007

merged 3 commits into from
Jul 5, 2024

Conversation

enjoy-digital
Copy link
Owner

@enjoy-digital enjoy-digital commented Jul 5, 2024

Add CTU-CAN-FD core support: https://gitlab.fel.cvut.cz/canbus/ctucanfd_ip_core with:

  • LiteX wrapper around it.
  • litex_json2dts support.

Tested with simple SN65HVD230 transceivers on PMOD on:

  • Arty A7 with VexRiscv-SMP + Linux + CTU-CAN-FD Linux driver + cantools.
  • Arty Z7 with Zynq7000 + Linux + CTU-CAN-FD Linux driver + cantools.

Communication has been tested when connected to a USB <-> CAN cable but also for dump of CAN frames on a Tesla Model 3.

Integration example on Arty:

# Import Core.
from litex.build.generic_platform import *
from litex.soc.cores.can.ctu_can_fd import CTUCANFD

[...]

# Define CAN IOs on PMOD.
_ios = [
    ("can", 0,
        Subsignal("tx",  Pins("pmodc:2")),
        Subsignal("rx",  Pins("pmodc:3")),
        IOStandard("LVCMOS33"),
    ),
    ("can", 1,
        Subsignal("tx",  Pins("pmodb:2")),
        Subsignal("rx",  Pins("pmodb:3")),
        IOStandard("LVCMOS33"),
    ),
]

[...]

# CAN Core Instance.
can0 = CTUCANFD(platform, platform.request("can", 0))
self.add_module("can0", can0)
self.bus.add_slave("can0", can0.bus, SoCRegion(origin=0xb0010000, size=0x10000, mode="rw", cached=False))
self.irq.add("can0")

@enjoy-digital enjoy-digital merged commit 7ec35eb into master Jul 5, 2024
2 checks passed
enjoy-digital added a commit to litex-hub/litex-boards that referenced this pull request Jul 5, 2024
@AndrewD
Copy link
Collaborator

AndrewD commented Jul 5, 2024

Fantastic, thanks @enjoy-digital !

@disdi
Copy link

disdi commented Jul 5, 2024

Thanks @enjoy-digital for taking this in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants