Long time owner of Arduinos and first time posting. I just picked up an Arduino Due to use with an automotive project, and I'm having trouble configuring any of the serial ports for 8E1 which is required for interfacing with my car's communication bus.
It seems like the library I am using relies on HardwareSerial::begin(int, UARTClass::UARTModes)
but the Due has no method defined for opening the serial port with the UART Mode? The reference library for Serial.begin() seems to think it has a variable config but apparently not on the Due.
How can I make the serial connection operate the same as if on an AVR board I did Serial.begin(9600, SERIAL_8E1);
and get it communicating?
I saw a few posts similar to this issue but they all were either missing information via deleted comments, or didn't have a working code solution listed.
"HardwareSerial" is the "bottom layer" class on AVR, but on Due there are two classes below it (UARTClass and USARTClass), which is where the begin with modes are defined.
I'm not exactly sure what that means from a C++ perspective, but it sort-of look like your library is explicitly referencing HardwareSerial::begin when it should be ... doing something else.
This is what I feared - unfortunately the library that is specific to the bus I need to use for my project hasn't been updated in a long time and doesn't look like it is an easy conversion for Due use. It works fine on an Uno I had lying around but it seems to be layer after layer of incompatibility for using the Due. I might need to find an AVR board that also has dual CAN capability (like the Due) with a few leftover digital pins for serial communication over the non-CAN bus.
Which library is it?
And is there a sample program that you're using?
Adafruit has their "Grand Central M4" with a SAMD51 - that also supports dual CAN interfaces (in theory; I'm not sure they're both available on the board pinout.) Moreover, they have a smaller board explicitly designed to support CAN, so their library support is probably in better shape. (and SAMD51 is a "more current" chip, so ... fixes are more likely.)
I'm using a few things here. I am creating a CAN bus bridge to add a different instrument cluster to my car. Namely I am translating a CAN message that has to do with oil temperature. My car sends data that you can extrapolate the oil temperature from over the peripheral bus (in this case it's BMW's I-Bus) but not over the CAN bus.
So what I'm doing is capturing all of the messages on the CAN0 interface of the Due, and forwarding them along to CAN1, unless it matches a certain ID, in that case I modify it on the fly with data I pull from the I-Bus and then send it to CAN1. The CAN bus part works great. It's when we get into interfacing with the I-Bus that gets funky.
I want to use the Melexis TH3122.4 chip to interface with the I-Bus. There is already a third party library for interfacing directly with this chip for the purpose of sending messages on the BMW I-Bus or K-Bus (they are the same protocol), released a while ago. It does not support the Due though, and that's where I'm stuck.
I'm now looking at the Teensy 3.6 which is supported directly by the library, and has the dual CAN interfaces I need to make this project work.