ttlappalainen / NMEA2000_mcp

Inherited object for use NMEA2000 library for Arduino Boards with MCP2515 CAN bus controller.
19 stars 18 forks source link

Arduino MKR Zero & MKR Can Shield -> SREG not defined, cli(), sei() #4

Open ghost opened 5 years ago

ghost commented 5 years ago

I use the Arduino MKR Zero (SAMD21 Cortex-M0+ based) and the MKR Can shield (MCP2515 based) with your librarys. The hardware works, I can read NMEA2000 packets interpreted as standard can extended packets using a can library.

I used the Actisense Listener example provided with the library, and only put these lines before including anything for configuring the MCP2515 correctly:

define USE_N2K_CAN 1

define N2k_SPI_CS_PIN 3

define N2k_CAN_INT_PIN 7

define USE_MCP_CAN_CLOCK_SET 16

The compiler was not able to compile NMEA2000_mcp.cpp for the ARM, because it has no SREG, so I commented it out. I also had to replace cli() and sei() with noInterrupts() and interrupts(). Then I was able to compile it, but I did not receive any messages. I think the changes I made are not complete.

Has anyone tried it with the MKR Zero and CAN Shield yet? I think this would be the perfect hardware.

ttlappalainen commented 5 years ago

I still like Teensy more...

The changes should be OK with quick look. I should add defines for NMEA2000_mcp.cpp - others has also used mcp_can on different environment.

Do you use mcp_can library from my git? I am not sure of status from other sources and mine can also handle both transmit and receive with interrupt. You could also try to leave int pin undefined, so it should use just polling, which is enough on the tests.

I have not heard others using MKR.

ghost commented 5 years ago

I have to use the MKR Zero, because I do not built the electronics from scratch, I just add NMEA2000 functionality to an already existing project... Yes I use your mcp_can library. I will try leaving the int pin undefined in the evening.

ralfhille commented 5 years ago

Is this issue solved? I want to use the Arduino MKR WIFI 1010 and the MKR CAN shield. My current solution works with MEGA and CAN shield from Seed, but i want to chnage to smaller Hardware.

Or can i use the teensy 3.6. I read that the Teensy 3.6 has CAN onb board. Is this with Transceiver and Controller?

ttlappalainen commented 5 years ago

Should be. I have modified NMEA2000_mcp to use SREG only with Mega and Uno.

All Teensy 3.2 and up has internal can controller and requires tranceiver ship. I have used MCP2562 without any problem. With ISO1050 tranceiver you can make isolated system.

michydk commented 2 years ago

As a feedback to @ttlappalainen, and to those that find this tread in the future: I have with success, used a Arduino MKR Wi-Fi 1010 and the MKR CAN shield on a NMEA2000 network, using ttlappalainen's NMEA2000 library and a Raymarine axiom 7 as MFD

I have 3 ds18b20 (one-wire Temperatur sensor) connected on a one-wire bus, then senses temperatures on my old VP 2003t engine.

For testting purpose, the alarm is set to 26 C, in case you wondered..;)

I can highly recommend ttlappalainen's excellent document "Connecting_hardware_to_NMEA2000.pdf", specially the troubleshooting section : IMG_20220112_143630 IMG_20220112_144549

A little more info here: https://sillydiy.blogspot.com/2022/01/measuring-boat-engine-temperature-wih.html

oskarbob commented 2 months ago

Cannot find a trace of "Connecting_hardware_to_NMEA2000.pdf" anywhere. Where did you see this?

ttlappalainen commented 2 months ago

It is old document and moved as part of NMEA2000 library document: https://ttlappalainen.github.io/NMEA2000/page_h_w_set_up.html

oskarbob commented 2 months ago

Thank you.

On 2024-07-22 20:25, Timo Lappalainen wrote:

It is old document and moved as part of NMEA2000 library document: https://ttlappalainen.github.io/NMEA2000/page_h_w_set_up.html [1]

-- Reply to this email directly, view it on GitHub [2], or unsubscribe [3]. You are receiving this because you commented.Message ID: @.***>

Links:

[1] https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fttlappalainen.github.io%2fNMEA2000%2fpage_h_w_set_up.html&c=E,1,_99QL2EMbOHFlHE8O8KQa65x5Wp02U4Yu9FrIRjWC6yatu28S17DtoG8UZV-iK1-papfqaoYsj2aKEQvGv629lz_B2refQ2J22drwBPS8pFNy1c,&typo=1 [2] https://github.com/ttlappalainen/NMEA2000_mcp/issues/4#issuecomment-2244128762 [3] https://github.com/notifications/unsubscribe-auth/AP3VP5DG24B57ZXL3Q3WMRLZNW5ITAVCNFSM6AAAAABLJIXLCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBUGEZDQNZWGI