You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Documents/src/1_mainpage.md
+9-16Lines changed: 9 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,40 +1,33 @@
1
1
# NMEA2000 library for C++ {#mainpage}
2
-
3
-
Object oriented NMEA2000 library for Teensy, ESP, Arduino, MBED and Rasberry type Boards.
4
-
These board types has been tested, but library can be used also in other systems by writing
5
-
compatible CAN driver and wrapper for other hw specific functions.
6
2
7
-
Library gives you easy way to make different kind of NMEA2000 bus devices like
8
-
sensor transducers (battery, temperature, wind, engine, etc.), NMEA2000 information displays,
9
-
NMEA2000->PC interface (like Actisense NGT1), NMEA0183->NMEA2000 or NMEA2000->NMEA0183 converter.
3
+
NMEA2000 library is object oriented C++ library for developing NMEA2000 bus devices. Library fulfills automatically NMEA 2000 mandatory requirements (see \ref secRefNMEA2000Certification) leaving only interesting data handling for developer. **Library has been used in several commercial certified NMEA2000 devices.**
10
4
11
-
Library fulfills NMEA 2000 mandatory functions and behavior. Devices using library can pass NMEA2000
12
-
certification tests. Library has been used in several commercial certified products.
5
+
Library provides you easy way to make different kind of NMEA2000 bus devices like sensor transducers (battery, temperature, wind, engine, etc.), NMEA2000 information displays,NMEA2000->PC interface (like Actisense NGT1), NMEA0183->NMEA2000 or NMEA2000->NMEA0183 converter.
6
+
7
+
I started library development on 2015 for Arduino based boards. Since that as far as I know it has been used and tested with Teensy, ESP, some Arduino, MBED and Rasberry Boards, but library can be used also in other systems by writing compatible CAN "driver" and necessary classes for other hw specific functions.
13
8
14
9
If you are familiar with library, here is quick link to \ref changes.
15
10
16
11
\warning
17
-
First of all - as normal - you can use library but there is not any guarantee and you use it with your own risk!
18
-
You connect your hardware always with your own risk. I wrote this documentation to help to
19
-
connect own hardware to NMEA2000 bus. I do not take any responsible of any errors in document
20
-
or any possible damages caused to your devices.
12
+
First of all - as normal - you can use library but there is not any guarantee and you use it with your own risk! You connect your hardware always with your own risk. I wrote this documentation to help to connect own hardware to NMEA2000 bus. I do not take any responsible of any errors in document or any possible damages caused to your devices.
21
13
22
14
**About library documentation**
23
15
24
-
This is a new doxygen generated documentation designed by Matthias Werner - great thanks to him for excellent work. Many parts are still based on my original documentation, which I created at beginning of the library. After several years experience I see a need for several updates. So the documentation project will continue with checking and updating. For more details see \ref libDocuGen
16
+
Great thanks to Matthias Werner for excellent original library documentation work. As my knowledge of NMEA2000 has been improved a lot since 2015, boards and breakboards has been changed I'll try to update document as necessary and keep it up to date. Also I hope that other developers will inform me errors, bad language, ununderstandable text, better links etc. to keep document usable.
17
+
18
+
Document will be automatically created in combination of document sources and code sources. For more details see \ref libDocuGen .
25
19
26
20
## Recommended hardware
27
21
28
22
See this for \ref secTRecHW and please read document \ref pageHWSetUp before purchasing any hardware.
-[List of NMEA 2000 registered devices](https://web.nmea.org/products/search)
38
31
-[List of NMEA 2000 registrated companies](https://web.archive.org/web/20190529161431/http://www.nmea.org/Assets/20121020%20nmea%202000%20registration%20list.pdf)
39
32
-[Device class and function codes](https://web.archive.org/web/20190531120557/https://www.nmea.org/Assets/20120726%20nmea%202000%20class%20&%20function%20codes%20v%202.00.pdf)
Copy file name to clipboardExpand all lines: Documents/src/3_hwSetup.md
+7-15Lines changed: 7 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,10 +26,8 @@ of any errors in the document or any possible damages caused to your devices.
26
26
27
27
## Recommended hardware {#secTRecHW}
28
28
29
-
I personally prefer to use Teensy 3.2, 3.5, 3.6, 4.0, 4.1 or ESP32 board. Those boards
30
-
have internal CAN controller and require only either unisolated MCP2562 or isolated ISO1050
31
-
transceiver for NMEA2000 connection.
32
-
With default settings library requires **about 23 kB rom and 3.3 kB RAM in normal operation**.
29
+
I personally prefer to use Teensy 4.0, 4.1 (or 3.2, 3.5, 3.6 which are at end of life) or ESP32 board. Those boards have internal CAN controller and require only either isolated ISO1050 or unisolated MCP2562 transceiver for NMEA2000 connection.
30
+
With default settings library requires roughly **about 30 kB rom and 4 kB RAM in normal operation**.
33
31
So you should have **at least 8 kB RAM in your processor**. If you have Arduino Mega board,
34
32
it is OK for testing and for small projects, but I do not prefer to buy one for new project.
35
33
Arduino Due is better, but it is physically bigger and eats more power than Teensies or ESP32.
@@ -41,7 +39,7 @@ and you have trouble to get it working, please do not set any issues.
41
39
42
40
Some boards (or processors) have internal CAN controller. In board there will be simply
43
41
CAN Tx/CAN Rx pins, which often works with 3.3 V levels. Good examples of this kind of boards
44
-
are recommended Teensy 3.2, 3.5, 3.6, 4.0, 4.1 or ESP32 boards.
42
+
are recommended Teensy 4.0, 4.1 (or 3.2, 3.5, 3.6 which are at end of life) or ESP32 boards.
45
43
Arduino DUE has also internal CAN controller. Never connect CAN Tx/CAN Rx pins directly to
46
44
NMEA2000 bus. If you use board without internal CAN controller or you want to have second CAN
47
45
controller e.g., for Teensy 3.2 or ESP32, you can use external one. Currently only supported is
@@ -65,21 +63,15 @@ controller to CAN bus levels.
65
63
66
64
#### Recommended transceiver {#subsubRecTra}
67
65
68
-
I recommend either unisolated MCP2562 or isolated ISO1050 transceiver. MCP2562 operates
69
-
with 5 V and it has own pin to define Tx/Rx logic levels for 3.3 V devices. ISO1050 has own
70
-
power pin for both sides so it also works with any logic levels. There is lot of issues with
71
-
SN65HVD230 transceiver. If you use that, please do not open issue – it is not library problem.
66
+
I recommend either isolated ISO1050 or unisolated MCP2562 transceiver. ISO1050 has own power pin for both sides so it also works with any logic levels. MCP2562 operates with 5 V and it has own pin to define Tx/Rx logic levels for 3.3 V devices. There is lot of issues with SN65HVD230 transceiver. If you use that, please do not open issue – it is not library problem.
72
67
73
68
I do not know why there has been so much problems with SN65HVD230 - according datasheet it
74
69
should be fine. I have had problems with MCP2562 only twice. Once I mixed Vdd and Vcc - worked
75
70
fine after connected them right. Another time I connected STBY pin to Vdd, which puts chip to stand by.
76
71
77
72
\note
78
73
**This is very important.**
79
-
If you use unisolated tranceiver like MCP2562, you may cause
80
-
ground loop in your boat. Ground loops may generate other weird problems. You can read more
If you use unisolated tranceiver like MCP2562, you may cause ground loop in your boat. Ground loops may generate other weird problems. You can read more about it e.g., from Ground loop in Wikipedia <https://en.wikipedia.org/wiki/Ground_loop_(electricity)>.
83
75
If you e.g.,feed NMEA2000 bus on center of the boat and you have unisolated device, which
84
76
also has ground by sensor on front of the boat, you have created ground loop. It may work
85
77
without problems or may not. You may have communication errors etc.
Copy file name to clipboardExpand all lines: Documents/src/4_gettingStarted.md
+49-38Lines changed: 49 additions & 38 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,100 +1,111 @@
1
1
# Get your Project Started {#getStarted}
2
2
3
3
\tableofcontents
4
-
@brief A short introduction how to get started
5
4
6
5
\section secMem Memory requirements
7
6
8
-
I have tried to measure memory used by library, but it is not so simple, since
9
-
there are some automated operations. With version 11.06.2017 I got results:
7
+
Roughly you need at last 8 kB ram and 40 kB ROM to fullfill all required NMEA2000 features with your own logic. Even requirements can be squeezed I do not prefer to do that to avoid unnecessary issues.
8
+
9
+
With version 11.06.2017 I measured and got results:
10
10
11
11
- Approximate ROM 26.9 kB
12
12
- Approximate RAM 3.4 kB
13
13
14
-
This is with simple TemperatureMonitor example. This can be squeezed by
14
+
This was with simple TemperatureMonitor example. This can be squeezed by
15
15
setting:
16
16
17
17
- Add below to setup() before NMEA2000.Open();
18
-
....
19
-
NMEA2000.SetN2kCANMsgBufSize(2);
20
-
NMEA2000.SetN2kCANSendFrameBufSize(15);
21
-
....
18
+
```shell
19
+
NMEA2000.SetN2kCANMsgBufSize(2); // This may cause loss of received fast packet messages.
20
+
NMEA2000.SetN2kCANSendFrameBufSize(15); // This may cause loss of important information to other bus devices.
21
+
```
22
22
23
23
- Defining ProductInformation to PROGMEM as in BatteryMonitor example.
24
24
- Disabling all extra features. See NMEA2000_CompilerDefns.h
25
25
- Disable interrupt receiving.
26
26
27
27
With those setting you can go down to appr. 19 kB ROM and 1.9 kB RAM. So for 2
28
-
kB devices like Arduino Uno, there is not much for your own code.
28
+
kB RAM devices like Arduino Uno, there is not much for your own code.
29
29
30
30
\warning By squeezing memory, library can not fulfill certification requirements anymore.
31
31
32
32
\section secHWSet Hardware setup
33
33
34
-
NMEA2000 is inherited from CAN. Many MCUs like Teensy >3.1, ESP32, Arduino Due has already
35
-
CAN controller inside. If your MCU does not have CAN controller inside or you need second
34
+
NMEA2000 is inherited from CAN. Many MCUs like Teensy >3.1, ESP32, Arduino Due has internal
35
+
CAN controller. If your MCU does not have internal CAN controller or you need second
36
36
external CAN controller, you can use e.g. MCP2515 CAN controller, which is supported by
37
37
library (mcp_can).
38
38
39
39
For final connection to the bus you need CAN bus_transceiver chip. Devices on NMEA2000
40
-
bus should be isolated to avoid ground loops. So if you take power from NMEA2000
41
-
bus and your device is not connected to ground enywhere else, you can use unisolated tranceiver
40
+
bus should be isolated to avoid ground loops. If you take power from NMEA2000
41
+
bus and your device is not connected to ground anywhere else, you can use unisolated tranceiver
42
42
like MCP2551, MCP2562 or SN65HVD234.
43
43
If you instead feed power to your device directly or e.g. use engine own sensors for measuring,
44
-
you have to use isolated tranceivers like ISO1050. Remember also use isolated power supply, if you take power
45
-
from bus and have any unisolated connection to anywhere on your whole system.
44
+
you have to use isolated tranceivers like ISO1050. Remember also use isolated power supply, if you take power from bus and have any unisolated connection to anywhere on your whole system.
46
45
47
46
Easiest for connecting to NMEA2000 bus is to use some ready shield. For more
48
47
information on how to wire everything to the bus please see \ref pageHWSetUp
49
48
50
49
## Breakout Boards
51
50
52
-
### Teensy 3.2
51
+
I prefer isolated connection NMEA2000 bus. See more \ref subsubIso.
52
+
53
+
For beginner simplest board would be board with MCU (like ESP32 or Teensy 4.0) with isolated transceiver. Unfortunately I have found only one Teensy 4.0 board with unisolated tranceiver. Next simplest is breakout board that fits directly to main board pins, but even those does not exist isolated. But it is not much work to connect 4 wires and use existing isolated board.
This can be used with any main board having internal CAN controller like Teensy 4.0, 4.1 (or 3.2, 3.5, 3.6 which are at end of life), ESP32 Arduino DUE boards.
- Remember also install [Teensyduino](https://www.pjrc.com/teensy/td_download.html) !
@@ -171,7 +183,7 @@ other related libraries. See origin for MBED port on <https://github.com/thomaso
171
183
172
184
NMEA2000_socketCAN has been originally forked from <https://github.com/thomasonw/NMEA2000_socketCAN>
173
185
174
-
There is a document [Preparing your Raspberry Pi for the NMEA2000 library.pdf](https://github.com/ttlappalainen/NMEA2000/blob/master/Documents/Preparing%20your%20Raspberry%20Pi%20for%20the%20NMEA2000%20library.pdf) for starting up with RPi.
186
+
There is a document [Preparing your Raspberry Pi for the NMEA2000 library.pdf](https://github.com/ttlappalainen/NMEA2000/blob/master/Documents/Pdf/Preparing%20your%20Raspberry%20Pi%20for%20the%20NMEA2000%20library.pdf) for starting up with RPi.
175
187
Hopefully I have time to write more complete document. There is example NMEA2000ToNMEA0183, which
176
188
has been tested with RPi 3B.
177
189
@@ -193,9 +205,7 @@ sends it to PC. `NMEA2000/Examples/ArduinoGateway` allows you to mimic Actisense
193
205
NGT-1 and connect e.g. a Raspberry Pi running Signal-K to the NMEA2000 bus with
194
206
an Arduino or Teensy.
195
207
196
-
# Forcing CAN "driver"
197
-
198
-
was using Arduino Software older than 1.6.6)
208
+
# Forcing CAN board dependent "driver"
199
209
200
210
In examples there are simple includes:
201
211
@@ -204,10 +214,9 @@ In examples there are simple includes:
204
214
#include<NMEA2000_CAN.h>// This will automatically choose right CAN library and create suitable NMEA2000 object
205
215
```
206
216
207
-
If that can not be used (like with Arduino IDE older than 1.6.6) or you would like to control naming and used "driver",
208
-
you can manually include necessary files. Specially if you want to use secondary CAN bus on your system.
217
+
If above can not be used (like with Arduino IDE older than 1.6.6) or you would like to control naming and used "driver", you can manually include necessary files. Specially you need that, if you want to use secondary CAN bus on your system.
209
218
210
-
## For use with Teensy 4.x (also with 3.1/3.2/3.5/3.6)
219
+
## For use with Teensy 4.x (also with end of life boards 3.1/3.2/3.5/3.6)
0 commit comments