Go Down

Topic: NMEA 2000 Shield (Read 178420 times) previous topic - next topic

timolappalainen

Looks like you would have two copies of NMEA2000 libraries with different names under your libraries. Search e.g. NMEA2000.h from your libraries and check that it founds only one.

FXVT

Bonjour Timo,

Well... the NMEA2000 was actually unique.
But the problem was around the libraries directories indeed.
I have erased the previous NMEA2000 directory, then re-downloaded and added the library into the Adruino IDE and the error disappeard.

Merci beaucoup. :)
Regards.
FXVT

FXVT

Bonjour Timo,

I use a MultiDevice Sketch (2 devices: Engine and Battery)  and the problem is that the ProductInformation is not always reliable on the B&G Triton (Menu Parameters/Sources/Engine or Battery).
Most of the time, it does'nt recognise the devices.

I meet different cases:

- No product found: The Triton does not recognise any "Arduino Device", but it is ok for the other regular devices (pilot, VHF, MFD...) (Picture N°1). Off course, it does'nt display anything from the Arduino

- The Device Name is strange, like "???00?????????????POX!..." : In this case, despite a strange name, it is Ok, the Triton displays correct datas coming from the Arduino  (Pictures 2, 3, 5)

- The Device Name is OK: The device name displayed by the Triton is faithful to the name set in the NMEA2000.SetProductInformation. Of course, in this last case, the Triton can display the datas (Pictures 4, 5). Nevertheless I have never had the correct name for 2 devices at the same time.
The best result I have is when the 2 devices have been both recognized with strange names.

I don't change anything in my sketch, and I have to switch on/off several times the whole network and the instuments to get sometime a correct display.

Anyway, the datas (RPM, Voltage, T°) are always correctely send on the network, because the Raymarine devices (A78 MFD and i70) always recieve and display these datas, even if they don't recognise the device's names send by the Arduino.
The trouble is only with the B&G Triton who need to get a device name to be able to display its datas.

I use an Arduino Mega with Canbus Shield who work well when using single-device sketches.

Merci.
Regards.
FX

timolappalainen

- Do you use interrupt with NMEA2000 library? With interrupts library is more reliable, since it buffers frames on both send and receive side.

- Take care you have big enough buffers. As default with mcp you should have 50 frame buffer, which should be big enough on small systems. You can set buffer sizes on setup() with commands
  NMEA2000.SetN2kCANSendFrameBufSize(150);
  NMEA2000.SetN2kCANReceiveFrameBufSize(150);
Call those before calling anything else for library.

- Have you tested without using multidevice system? It is still open for me is it even possible to do NMEA certification with my multidevice support. There is no requirement that device sending different types should act as multi device - specially, if device is just for your own.

Other data will be sent to bus right, since you do it. NMEA 2000 logic and communication requires that you do not loose input frames, which means that it is best to use interrupting and never ever have a delay() in your code. If you use other libraries for sensors, you should also check that they do not have delay or spent do long for reading data. E.g. normal DallasTemperature library in synchronous mode may cause long delays, so that e.g. product information requests will be lost.

Again I prefer to check e.g. Teensy 3.2 or higher - less power consuming, more flash/RAM, faster, smaller layout, better CAN.

FXVT

Bonjour Timo,

I have clearly understood concerning the Teensy vs Mega. And if I have too much troubles, I will change for a Teensy, who is moreover faster.

As far as I know, I don't use interrupts  neither delay in my sketch.
But it is possible that the libraries I use contain such instruction. I use Freqcount.h.

I also use DallasTemperature.h with the lowest temperature resolution (9 bits, 0,5°C) to get the fastest response (93.75 ms)

I will edit my sketch with the buffer adjustements and try that as soon as I return to the boat.

Merci.
Regards.
FX

timolappalainen

You have to use DallasTemperature in async. I use it with full 12 bit resolution and max. off time is 10 ms, which is still much - you may get 24 frames on that time. With 93 ms off time othere systems may give up with fast packets.

I have one old one wire code, which I can send you, if you send me personal message. I still use a lot 1-wire, but not with direct pin. Instead I use "DS2482-100 Single-Channel 1-Wire Master" chip to take of most 1-wire communication and i2c_t3c library with Teensy, so that I have 1-wire communication totally interrupt handled.

Freqcount does not cause delays.

Johndublon

 I am  looking for the motor temperature sensor to connect to my axiom 7 via NMEA 2000   i can use external sensor I just need the simple programming script is anyone have it ?

timolappalainen

There is example TemperatureMonitor on NMEA2000 library, which sends data to the bus. You just need to add code for temperature sensor you use. If you are going to use 1-wire sensor and Teensy, send me your email by personal message, so I can send you sketch, which sends several different 1-wire sensor values to the bus.

Christer_A

Hj,
I have an Arduino UNO with a Seeed CANBUS shield (SPI) that does som brute nmea2k transmissions for testing.
Seven nmea2000 messages separated with a 5ms delay. After the seven messages it starts over again after a 100ms delay….
I have checked with an Actisense and it is OK and nmea2000 messages are decoded OK.

Receiver1 is an Adafruit Metro M0 with a Seeed CANBUS shield (SPI). CAN Library from CoryJFowler.

Receiver2 is an Adafruit Huzzah ESP with built in CAN and with an CANBUS transceiver. ESP32 CAN Library from MIWAGNER.

Almost identical code in the receivers except for the Library differens. Both receivers decode OK (checked with Actisense).
BUT... Receiver1 is faster with about 7-9ms between messages and the ESP32 is slower with more than 25ms.

Should't the ESP32 be much faster ??


/Christer
 

Christer_A

In my previous message here, when I wrote faster or slower i meant the time as seen on the PCmonitor after "Serial.print".

I have used many "Serial.print" in the code. The same for receiver1 and receiver2.
It turns out that on the ESP32 it is the number of "Serial.print" that slows down the ESP32.

Is there a way to speed up this ?

(Does not seem to be a nmea2000 question…)

timolappalainen

(Does not seem to be a nmea2000 question…)
Not really.

Note that NMEA2000 is not that simple. Some MFD:s are happy, if they just get some PGN without knowing anything about the device. So it is possible to just fool and send PGNs with some source e.g. 100 to the bus, and some MFD:s can show it. Some refuses to show data, if they does not get right response for requests to that source. That is what my NMEA 2000 library is for. It handles required communication and you just need to send or handle other PGNs.

Christer_A

Thanks for the reply.
I am not a programmer by profession but enjoy "playing"  with microcontrollers.
So my code is probably "clumsy"...
And I am also a  sailor since 30 years. So the combo nmea/microcontrollers is interesting.
At home, during winter, I have a nmea2000 network running with:
Garmin Echomap GPS Plotter, 12V power, Garmin GND10 bridge between nmea2000 and Nexus bus network, Garmin AIS receiver, Actisense nmea2000 and... my microcontroller with Arduino Ide. The Nexus bus has an Nexus NX server and also Multicontrol instrument.
So it is very close to my sailing boat.
The microcontroller can read the nmea2k data (as far as I have written the code for the usual PGNs).
I can send data and the Garmin GPS Plotter will show the data. Also the GND10 bridge will translate to the Multicontrol instrument, and the NX server translates to nmea0183 OK as well.

If the nmea2000 network only consists of the GPS plotter and an Arduino just listening, the GPSplotter does not send anything.

My initial idea was to have a homebuilt "Race Computer" that has my boats VPP-performance and then displays target boatspeed, actual boatspeed and wind data.

Your nmea2000 library is very professional !!!    It is just that I would like to try learn basics myself.



Go Up