arduino / ArduinoCore-renesas

MIT License
109 stars 74 forks source link

UNO R4: Add support for CAN Standard Frame Format (in addition to EFF) #36

Closed srolf closed 1 year ago

srolf commented 1 year ago

Please add in the UNO R4 CAN library the support for transmit/receive of CAN frames also in SFF.

Preferred would be an own parameter in the message creation which allows to define either SFF (maybe the default) or EFF.

Adding a hint towards the current CAN tutorials would be helpful, because it's not directly obvious to be forced/limited to EFF.

CAN 2.0A defines SFF. CAN 2.0B defines EFF. Most of the available MCP2515 libs are supporting SFF and EFF. CAN on Arduino Due by "due_can" lib supports SFF and EFF. In the automotive area SFF for communication is very common.

Lesani commented 1 year ago

@aentinger please please please

designer2k2 commented 1 year ago

+1 also from me for this!

The R4 is sitting now idle due to this, for me in automotive things its useless with only extended frame support.

Is anybody working on this? Or is there information around on how to add it?

aentinger commented 1 year ago

Your feature request(s) has been noted. I'll try to get some time scheduled for extending software-support for 11-Bit IDs.

srolf commented 1 year ago

Your feature request(s) has been noted. I'll try to get some time scheduled for extending software-support for 11-Bit IDs.

Thank you very much!

Out of curiosity: Maybe not possible, but I'm wondering if the CAN TXD/RXD pins can be remapped or are they "hard-wired"? Background: I was thinking about using a Minima and the Ethernet Shield Rev2 to create a gateway CAN<->ETH. But without remapping, I would expect issues with the SD-card reader on that shield.

aentinger commented 1 year ago

Maybe not possible, but I'm wondering if the CAN TXD/RXD pins can be remapped or are they "hard-wired"?

They can also be remapped to (some) other pins, the key is to search pinmux.inc for PIN_CAN_TXand PIN_CAN_RX. However, as the CAN objects are instantiated in the library (i.e. here) you'd need to change the library to change the pin-mapping.

srolf commented 1 year ago

you'd need to change the library to change the pin-mapping

Got it, thanks. I should work on my C++ skills... an alternative begin() would be helpful.

Lesani commented 1 year ago

you'd need to change the library to change the pin-mapping

Got it, thanks. I should work on my C++ skills... an alternative begin() would be helpful.

You should make a separate Feature Request to keep the two topics clean. In my use case I don't need different pins, but I agree, if the hardware can do it, it should be configurable somehow.

Lesani commented 1 year ago

Your feature request(s) has been noted. I'll try to get some time scheduled for extending software-support for 11-Bit IDs.

Thank you!

@aentinger would you be able to give a tentative timeline? I need to order housings, and they are different if I need to put shields on top of the arduino...

aentinger commented 1 year ago

Got it, thanks. I should work on my C++ skills... an alternative begin() would be helpful.

@srolf please create a separate feature request.

aentinger commented 1 year ago

Heads up everyone, mixed mode (supporting both 11-Bit standard CAN IDs and 29-Bit extended CAN IDs) is now being supported for Arduino Uno R4 WiFi and Minima. If you want to take a sneak preview take a look at https://github.com/arduino/ArduinoCore-renesas/pull/79 .

srolf commented 1 year ago

Thank you, a Minima with TJA1051 and tiny OLED is still standing here :-)