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

N2K out but no N2K in. #419

Open
dansonamission opened this issue Aug 3, 2024 · 3 comments
Open

N2K out but no N2K in. #419

dansonamission opened this issue Aug 3, 2024 · 3 comments

Comments

@dansonamission
Copy link

Hello

Have been using this library for a while now and have a few working projects using Adafruit CAN Feathers as well as our own RP2040 boards. Yesterday I tried to use a Adafruit QT Py with a Adafruit CAN BFF (MCP2515), after much trial and error the board will transmit NMEA 2000 ok, but it will not receive anything.

To test the CAN I loaded the CAN_BUS_SHIELD Receive_check example and can see all the CAN messages being received in the serial console.

Is there anything obvious to check that I might have missed as I've been staring at it for too long now?

Thanks

@ttlappalainen
Copy link
Owner

Did you defined IRQ and receive buffer size properly?

@dansonamission
Copy link
Author

It’s an issue when we define the interrupt pin. With no pin defined the receive works ok. It’s actually a MCP25625, same as the adafruit CAN feather which we have no issues with.

We’re using default buffers, but have also been using the arduino gateway example which has buffers defined.

@ttlappalainen
Copy link
Owner

So your problem is actually that interrupt with your board does not work. CAN_BUS_SHIELD Receive_check works, since it does not use interrupts. You can use also NMEA2000 library without interupt, but then you have to take care that you call tNMEA2000::ParseMessages faster than possible message burst. If I remember right MCP2515 has 8 frame receive buffer and CAN can have about 2 message/ms, so you should call it at least with 4 ms period to avoid frame loss. If you have some other libraries causing delays, you will most probably loose some important messages time to time. With interrupting frames will be buffered to larger receive buffer.

Even with interrupting system it is good to keep tNMEA2000::ParseMessages period low to have good timing. Delay between two tNMEA2000::ParseMessages calls should not exceed 200 ms even randomly.

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