Longan-Labs / Serial_CAN_Arduino

MIT License
50 stars 22 forks source link

error "set can rate fail" #2

Open mertensbart20 opened 5 years ago

mertensbart20 commented 5 years ago

Hello,

I connect the serial CAN bus on an arduino mega 2560 as described in the file recv.ino but I get the message "set can rate fail". I just wanted to test the code without already reading a CAN-bussystem. What is the cause of this message?

Thanks in advance, Bart

Neuroquila-n8fall commented 5 years ago

I've ran into a similar Problem. You should check the abilities of your mega concerning change interrupt capable pins. I had to switch my config over to pin 10 and 11 for RX/TX on my Yún for example to have it working. The initialization should succeed while not connected to a bus!

Please refer to: https://arduino.stackexchange.com/questions/9481/why-is-my-interrupt-code-not-working Ports 2 and 3 are not able of receiving change interrupts.

mertensbart20 commented 5 years ago

Thanks, that was indeed the problem.

For the next part I just want to read messages from the CAN-bus of my electric car, a Nissan Leaf. I know the CAN-H and CAN-L cables and the baudrate is 500k. If I then use your example recv.ino should I be able to read the CAN-bus messages?

Thanks in advance, Bart

On Fri, Jul 5, 2019 at 11:57 AM Dave Ginsbach notifications@github.com wrote:

I've ran into a similar Problem. You should check the abilities of your mega concerning change interrupt capable pins. I had to switch my config over to pin 10 and 11 for RX/TX on my Yún for example to have it working. The initialization should succeed while not connected to a bus!

Please refer to:

https://arduino.stackexchange.com/questions/9481/why-is-my-interrupt-code-not-working http://url Ports 2 and 3 are not able of receiving change interrupts.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Longan-Labs/Serial_CAN_Arduino/issues/2?email_source=notifications&email_token=AEVHHM7VUSDCQGXFDUEPBGDP54LKJA5CNFSM4H52QIXKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZJDQNA#issuecomment-508704820, or mute the thread https://github.com/notifications/unsubscribe-auth/AEVHHM3IXO3HMRLLH43YIYTP54LKJANCNFSM4H52QIXA .

mertensbart20 commented 5 years ago

Hello,

I got it up and running and receiving CAN-bus messages. But I have a question about the ID's. I see that CAN-ID's when received are all counted together. To seperate them in decimal form can I do the following:

Thanks in advance, Bart

On Sat, Jul 6, 2019 at 8:25 AM Bart Mertens mertensbart20@gmail.com wrote:

Thanks, that was indeed the problem.

For the next part I just want to read messages from the CAN-bus of my electric car, a Nissan Leaf. I know the CAN-H and CAN-L cables and the baudrate is 500k. If I then use your example recv.ino should I be able to read the CAN-bus messages?

Thanks in advance, Bart

On Fri, Jul 5, 2019 at 11:57 AM Dave Ginsbach notifications@github.com wrote:

I've ran into a similar Problem. You should check the abilities of your mega concerning change interrupt capable pins. I had to switch my config over to pin 10 and 11 for RX/TX on my Yún for example to have it working. The initialization should succeed while not connected to a bus!

Please refer to:

https://arduino.stackexchange.com/questions/9481/why-is-my-interrupt-code-not-working http://url Ports 2 and 3 are not able of receiving change interrupts.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Longan-Labs/Serial_CAN_Arduino/issues/2?email_source=notifications&email_token=AEVHHM7VUSDCQGXFDUEPBGDP54LKJA5CNFSM4H52QIXKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZJDQNA#issuecomment-508704820, or mute the thread https://github.com/notifications/unsubscribe-auth/AEVHHM3IXO3HMRLLH43YIYTP54LKJANCNFSM4H52QIXA .

Neuroquila-n8fall commented 5 years ago

In CAN networks, like on I2C networks, it is mandatory that every participant has its own ID. You should handle the IDs in byte format (0x1234) when comparing because the ID is calculated with the first 4 bytes of a message.

Unfortunately It seems my module is faulty. I can't establish a serial connection any more and moved on to using a SPI module and another UNO since I couldn't get it to work on the YÚN anymore.

mertensbart20 commented 5 years ago

Thanks for the info,

May I ask which board you are using now? I'd like to use it with a MKR Wifi 1010 but the current board is not compatible. I tried this one https://store.arduino.cc/mkr-can-shield but with this I can't get any messages.

Greetings, Bart

On Mon, Jul 8, 2019 at 9:10 AM Dave Ginsbach notifications@github.com wrote:

In CAN networks, like on I2C networks, it is mandatory that every participant has its own ID. You should handle the IDs in byte format (0x1234) when comparing because the ID is calculated with the first 4 bytes of a message.

Unfortunately It seems my module is faulty. I can't establish a serial connection any more and moved on to using a SPI module and another UNO since I couldn't get it to work on the YÚN anymore.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Longan-Labs/Serial_CAN_Arduino/issues/2?email_source=notifications&email_token=AEVHHMZB5GILKUP76LOMNWDP6LSADA5CNFSM4H52QIXKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZMFXIQ#issuecomment-509107106, or mute the thread https://github.com/notifications/unsubscribe-auth/AEVHHM3Q6I7CAQTU6P2VQ4LP6LSADANCNFSM4H52QIXA .

Neuroquila-n8fall commented 5 years ago

That MKR Shield should definitely work! But beware: in most applications outside the diagnostics ports the termination resistor (120Ohms) must be switched OFF

I am using a "NiRen" CanBus module where it was required to switch the 8mhz crystal with a 16mhz one before it worked.

I'm still intrigued why the longan module doesn't work. It's the most elegant solution with its dedicated microcontroller and serial comm ...

KevinKigan commented 5 years ago

Hello I have the same problem but when i put, for example, in the pins 14 and 15 (Tx, Rx) and change this pins in the code the issue continue.

This is my code: obd.txt Sorry but i'm new user.

The answer is this:

set can rate fail mask fail - 0 set mask fail set filt fail begin

I don't know that i do. Thanks for your time and y hope yours answers

ZIPhuan commented 2 years ago

Hello I have the same problem but when i put, for example, in the pins 14 and 15 (Tx, Rx) and change this pins in the code the issue continue.

This is my code: obd.txt Sorry but i'm new user.

The answer is this:

set can rate fail mask fail - 0 set mask fail set filt fail begin

I don't know that i do. Thanks for your time and y hope yours answers

Hello We have the same problem. Have you solve it? Thanks for your time

mertensbart20 commented 2 years ago

Hello,

Sorry, but I was not able ot solve the problem. And I have given up on the project :-(

Hope you have more success, Bart

On Wed, Jan 26, 2022 at 9:16 PM ZIPhuan @.***> wrote:

Hello I have the same problem but when i put, for example, in the pins 14 and 15 (Tx, Rx) and change this pins in the code the issue continue.

This is my code: obd.txt https://github.com/Longan-Labs/Serial_CAN_Arduino/files/3512191/obd.txt Sorry but i'm new user.

The answer is this:

set can rate fail mask fail - 0 set mask fail set filt fail begin

I don't know that i do. Thanks for your time and y hope yours answers

Hello We have the same problem. Have you solve it? Thanks for your time

— Reply to this email directly, view it on GitHub https://github.com/Longan-Labs/Serial_CAN_Arduino/issues/2#issuecomment-1022566130, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEVHHM6NVZYBSEG3FMQAQJ3UYBJCRANCNFSM4H52QIXA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>