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

Is there possibility to switch between CAN ALT and DEF during runtime? #23

Open
johnnykow1234 opened this issue Dec 21, 2023 · 1 comment

Comments

@johnnykow1234
Copy link

I have very interesting Board with STM32F105RBT6 chip which has... three cans.
On the board i have three transceivers and these are connected to the chip in the following way:

  • first one - PB12/PB13 - CAN2 DEF
  • second one - PB8/PB9 - CAN1 ALT
  • third one - PB5/PB6 - CAN2 ALT

I wrote some code for that. Here is the setup part


STM32_CAN first(CAN1, ALT);
STM32_CAN second(CAN2, DEF);
STM32_CAN third(CAN2, ALT);

void setup() {
  first.begin(false);
  first.setBaudRate(125000);

  second.begin(false);
  second.setBaudRate(500000);  //500KBPS

  third.begin(false);
  third.setBaudRate(500000);  //500KBPS
}

And obviously the first one and the second one work without any issues. The third one is dead. Theoretically the board is running fine, but there are no messages on the can bus from the third one (i have arduino based board connected to it and i am sniffing messages).

The question is: is there any way to make that working with that library? I have no doubts that it can work in some way because the board was previously used as a OBD tool - i just deciced to transform it to some other device.

@michpro
Copy link

michpro commented Jun 11, 2024

The STM32F105RB datasheet clearly informs that it has TWO CAN interfaces, not THREE. You yourself wrote "PB5/PB6 - CAN2 ALT" ... these are alternate pins for CAN2, not the third CAN interface, so CAN2 can be connected to pins PB12/PB13 or PB5/PB6 but never to both pairs at the same time.

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

No branches or pull requests

2 participants