Skip to content

Conversation

marckleinebudde
Copy link
Collaborator

@marckleinebudde marckleinebudde commented Nov 17, 2022

This PR should add multichannel and CAN-FD support. Currently it's WIP.

src/main.c Outdated
struct gs_host_frame *msgbuf = calloc(CAN_QUEUE_SIZE, sizeof(struct gs_host_frame));
assert_basic(msgbuf);
can_init(channel, CAN_INTERFACE);
can_disable(channel);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we come up with a better way of handling the init? Rather have some type of indexed table with [channel][CAN_INTERFACE] instead of having to add defines here for each new channel.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean a read only array of structs, with a struct describing the HW configuration of a single channel. Sounds good. Which information do we need per channel?

memcpy(&param_u32, hcan->ep0_buf, sizeof(param_u32));
if (set_term(req->wValue, param_u32) == GS_CAN_TERMINATION_UNSUPPORTED) {
USBD_CtlError(pdev, req);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Termination GPIO is channel based. Should we stub that out here as part of the multichannel change?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should come after we thought about per channel configuration.

@marckleinebudde marckleinebudde force-pushed the multichannel branch 3 times, most recently from d1e0c57 to 203cfac Compare November 20, 2022 19:34
@marckleinebudde
Copy link
Collaborator Author

It's not yet stable, canfdtest -vg can0 stops after some minutes.

@marckleinebudde
Copy link
Collaborator Author

marckleinebudde commented Nov 20, 2022

changes:

  • renamed can-common.* to can_common.*

@marckleinebudde
Copy link
Collaborator Author

marckleinebudde commented Nov 20, 2022

changes:

  • fixed includes

@marckleinebudde
Copy link
Collaborator Author

changes:

  • import latest struct gs_host_frame with flex arrays from Linux kernel
  • USB: add some support for CAN-FD

@marckleinebudde marckleinebudde changed the title add support for multichannel add support for multichannel and CAN-FD Nov 21, 2022
@marckleinebudde
Copy link
Collaborator Author

marckleinebudde commented Dec 5, 2022

FYI: @lichtfeind will now work on STM32G0 support.

@pramilo
Copy link

pramilo commented Nov 14, 2024

Hi all

Can you pls clarify if this has finally been merged to main_dev - or - if we need to get code from [marckleinebudde]'s (https://github.com/marckleinebudde) fork?

The discussion seems to indicate support for the G0 is mature, but it's unclear if/what's been merged to this main branch.

Thanks,

@marckleinebudde
Copy link
Collaborator Author

It's not mainline. Please use https://github.com/marckleinebudde/candleLight_fw/tree/multichannel for now

@indrapippo
Copy link

It's not mainline. Please use https://github.com/marckleinebudde/candleLight_fw/tree/multichannel for now

Hi there! Multichannel means that this will rise can0 and can1 interfaces?

@marckleinebudde
Copy link
Collaborator Author

This means on STM32G0B1 devices you have 2 interfaces, can0 and can1. You need 2 PHYs on your HW for them to work.

ryedwards and others added 25 commits April 29, 2025 10:46
Add code to support the M_CAN core found on the newer STM32 devices.

Co-developed-by: Ryan Edwards <ryan.edwards@gmail.com>
Co-developed-by: Jonas Martin <j.martin@pengutronix.de>
Co-developed-by: Venelin Efremov <ghent360@iqury.us>
Co-developed-by: Phil Greenland <phil@beamconnectivity.com>
Co-developed-by: Marc Kleine-Budde <mkl@pengutronix.de>
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.