Skip to content

Commit 24913be

Browse files
committed
Pure documentation update
1 parent cd143bd commit 24913be

23 files changed

Lines changed: 2122 additions & 1497 deletions

Documents/src/1_mainpage.md

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,33 @@
11
# 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.
62

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.**
104

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.
138

149
If you are familiar with library, here is quick link to \ref changes.
1510

1611
\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.
2113

2214
**About library documentation**
2315

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 .
2519

2620
## Recommended hardware
2721

2822
See this for \ref secTRecHW and please read document \ref pageHWSetUp before purchasing any hardware.
2923

3024
## Hardware depended libraries
3125

32-
each hardware setup need a specific \ref secHWlib
26+
Each hardware setup need a specific \ref secHWlib
3327

3428
\section secRef References
3529

3630
- [NMEA2000 Standard](https://www.nmea.org/nmea-2000.html)
37-
- [List of NMEA 2000 registered devices](https://web.nmea.org/products/search)
3831
- [List of NMEA 2000 registrated companies](https://web.archive.org/web/20190529161431/http://www.nmea.org/Assets/20121020%20nmea%202000%20registration%20list.pdf)
3932
- [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)
4033
- [ISO address claim](https://web.archive.org/web/20150910070107/http://www.nmea.org/Assets/20140710%20nmea-2000-060928%20iso%20address%20claim%20pgn%20corrigendum.pdf)

Documents/src/2_libRef.md

Lines changed: 323 additions & 301 deletions
Large diffs are not rendered by default.

Documents/src/3_hwSetup.md

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@ of any errors in the document or any possible damages caused to your devices.
2626

2727
## Recommended hardware {#secTRecHW}
2828

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**.
3331
So you should have **at least 8 kB RAM in your processor**. If you have Arduino Mega board,
3432
it is OK for testing and for small projects, but I do not prefer to buy one for new project.
3533
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.
4139

4240
Some boards (or processors) have internal CAN controller. In board there will be simply
4341
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.
4543
Arduino DUE has also internal CAN controller. Never connect CAN Tx/CAN Rx pins directly to
4644
NMEA2000 bus. If you use board without internal CAN controller or you want to have second CAN
4745
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.
6563

6664
#### Recommended transceiver {#subsubRecTra}
6765

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.
7267

7368
I do not know why there has been so much problems with SN65HVD230 - according datasheet it
7469
should be fine. I have had problems with MCP2562 only twice. Once I mixed Vdd and Vcc - worked
7570
fine after connected them right. Another time I connected STBY pin to Vdd, which puts chip to stand by.
7671

7772
\note
7873
**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
81-
about it e.g., from Ground loop in Wikipedia
82-
<https://en.wikipedia.org/wiki/Ground_loop_(electricity)>.
74+
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)>.
8375
If you e.g.,feed NMEA2000 bus on center of the boat and you have unisolated device, which
8476
also has ground by sensor on front of the boat, you have created ground loop. It may work
8577
without problems or may not. You may have communication errors etc.
@@ -126,7 +118,7 @@ outside sources (EMI, ESD, electrical transients, etc.).
126118

127119
[MCHP 2562 Datasheet](http://ww1.microchip.com/downloads/en/devicedoc/20005167c.pdf)
128120

129-
#### Isolated transceiver {subsubIso}
121+
#### Isolated transceiver {#subsubIso}
130122

131123
Isolated tranceiver has either optical or galvanic (ISO1050) isolation. Those has to be
132124
powered from both sides with isolated power, so you need also at least two power supplies.
@@ -246,7 +238,7 @@ even variable. If you are interested, dig more information from internet.
246238
NMEA2000 bus is like ethernet so that you can have multiple devices on
247239
same bus, they all can send information to the bus and there is no bus
248240
master device. The biggest difference to traditional NMEA0183 connection
249-
is that only one device can send data.
241+
is that on NMEA0183 only one device can send data.
250242

251243
- [NMEA_2000](https://en.wikipedia.org/wiki/NMEA_2000)
252244
- [SAE_J1939](https://en.wikipedia.org/wiki/SAE_J1939)

Documents/src/4_gettingStarted.md

Lines changed: 49 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,111 @@
11
# Get your Project Started {#getStarted}
22

33
\tableofcontents
4-
@brief A short introduction how to get started
54

65
\section secMem Memory requirements
76

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:
1010

1111
- Approximate ROM 26.9 kB
1212
- Approximate RAM 3.4 kB
1313

14-
This is with simple TemperatureMonitor example. This can be squeezed by
14+
This was with simple TemperatureMonitor example. This can be squeezed by
1515
setting:
1616

1717
- 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+
```
2222

2323
- Defining ProductInformation to PROGMEM as in BatteryMonitor example.
2424
- Disabling all extra features. See NMEA2000_CompilerDefns.h
2525
- Disable interrupt receiving.
2626

2727
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.
2929

3030
\warning By squeezing memory, library can not fulfill certification requirements anymore.
3131

3232
\section secHWSet Hardware setup
3333

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
3636
external CAN controller, you can use e.g. MCP2515 CAN controller, which is supported by
3737
library (mcp_can).
3838

3939
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
4242
like MCP2551, MCP2562 or SN65HVD234.
4343
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.
4645

4746
Easiest for connecting to NMEA2000 bus is to use some ready shield. For more
4847
information on how to wire everything to the bus please see \ref pageHWSetUp
4948

5049
## Breakout Boards
5150

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.
54+
55+
56+
### Isolated breakout board
5357

54-
- <https://www.skpang.co.uk/products/teensy-can-bus-breakout-board-include-teensy-3-2>
58+
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.
5559

56-
### ESP32
60+
- **isolated** <https://copperhilltech.com/isolated-can-bus-breakout-board-3-3-vdc/>
5761

58-
- <https://www.tindie.com/products/fusion/can32-an-esp32-dev-board-with-can-bus-v21/>
62+
### Teensy 4.0, 4.1
63+
64+
- **unisolated** <https://www.tindie.com/products/fusion/dual-can-bus-adapter-for-teensy-40-41/>
65+
66+
### Teensy 4.0
67+
68+
- **unisolated** <https://copperhilltech.com/teensy-4-0-can-fd-to-usb-converter/>
5969

6070
### Arduino Due
6171

62-
- <http://skpang.co.uk/catalog/dual-can-bus-interface-for-arduino-due-p-1579.html>
72+
- **unisolated** <http://skpang.co.uk/catalog/dual-can-bus-interface-for-arduino-due-p-1579.html>
6373

6474
### Arduino Mega
6575

66-
- <https://wiki.seeedstudio.com/CAN-BUS_Shield_V1.2/>
76+
- **unisolated** <https://wiki.seeedstudio.com/CAN-BUS_Shield_V2.0/>
6777

6878
Note that there are several different shields for CAN bus available and others may use
6979
8 MHz chrystal instead of **default 16 MHz chrystal**. This must be set before including NMEA2000_CAN.h
7080

7181
## Schematics for standalone CAN transceiver
7282

7383
In case you build your tranceiver connection by yourself there are some connection examples
74-
under [documents](https://github.com/ttlappalainen/NMEA2000/tree/master/Documents).
84+
under [documents](https://github.com/ttlappalainen/NMEA2000/tree/master/Documents/Schematics).
7585

7686
### Teensy 3.2
7787

78-
- [Teensy_Actisense_listener_sender_schematics.pdf](https://github.com/ttlappalainen/NMEA2000/blob/master/Examples/TeensyActisenseListenerSender/Documents/Teensy_Actisense_listener_sender_schematics.pdf)
88+
- \ref subTEiso
89+
- \ref subTEunIso **unisolated**
7990

8091
### Arduino Due
8192

82-
- [ArduinoDUE_CAN_with_MCP2562.pdf](https://github.com/ttlappalainen/NMEA2000/blob/master/Documents/ArduinoDUE_CAN_with_MCP2562.pdf)
83-
- [ArduinoDue_CAN_with_SN65HVD234.jpg](https://github.com/ttlappalainen/NMEA2000/blob/master/Documents/ArduinoDue_CAN_with_SN65HVD234.jpg)
93+
- [ArduinoDUE_CAN_with_MCP2562.pdf](https://github.com/ttlappalainen/NMEA2000/blob/master/Documents/Schematics/ArduinoDUE_CAN_with_MCP2562.pdf) **unisolated**
94+
- [ArduinoDue_CAN_with_SN65HVD234.jpg](https://github.com/ttlappalainen/NMEA2000/blob/master/Documents/Schematics/ArduinoDue_CAN_with_SN65HVD234.jpg) **unisolated**
8495

8596
### Arduino Mega
8697

87-
- [ArduinoMega_CAN_with_MCP2515_MCP2551.pdf](https://github.com/ttlappalainen/NMEA2000/blob/master/Documents/ArduinoMega_CAN_with_MCP2515_MCP2551.pdf)
98+
- [ArduinoMega_CAN_with_MCP2515_MCP2551.pdf](https://github.com/ttlappalainen/NMEA2000/blob/master/Documents/Schematics/ArduinoMega_CAN_with_MCP2515_MCP2551.pdf) **unisolated**
8899

89100
### ATmegaxxM1
90101

91-
- [ATmegaxxM1 CAN example.pdf](https://github.com/ttlappalainen/NMEA2000/blob/master/Documents/ATmegaxxM1%20CAN%20example.pdf)
102+
- [ATmegaxxM1 CAN example.pdf](https://github.com/ttlappalainen/NMEA2000/blob/master/Documents/Schematics/ATmegaxxM1%20CAN%20example.pdf) **unisolated**
92103

93104
Library has been also used with Maple Mini board.
94105

95106
\section secHWlib Hardware depended libraries
96107

97-
You need at least Arduino Software 1.6.6 for this sample. I'll expect you are
108+
You need at least Arduino Software 1.8.19 for this sample. I'll expect you are
98109
familiar with Arduino and using libraries. When your Arduino environment is
99110
ready.
100111

@@ -104,18 +115,19 @@ ready.
104115
@note Take care that you use libraries under my Github, when available! Others may not work right
105116
with NMEA2000!
106117

107-
### Teensy 4.0/4.1 boards with internal CAN
118+
### Teensy 4.0/4.1 boards with internal CAN {#subT4Libraries}
108119

109120
- [NMEA2000_Teensyx](https://github.com/ttlappalainen/NMEA2000_Teensyx) library.
110121
- Remember also install [Teensyduino](https://www.pjrc.com/teensy/td_download.html) !
111122

112123
CAN library is included to the code so you do not need any extra CAN library with this. NMEA2000_Teensyx
113124
library will replace NMEA2000_teensy library in future. You can already start to use it with
114-
all Teensy boards by forcing it with define (see NMEA2000_CAN.h comment). For critical
115-
projects I prefer to use old library until this has been running under tests for a while.
125+
all Teensy boards by forcing it with define (see NMEA2000_CAN.h comment).
116126

117127
### Teensy 3.1/3.2 or 3.5/3.6 board with internal CAN
118128

129+
I prefer to move to use libraries as \ref subT4Libraries and force it by define. Old libraries are still as default.
130+
119131
- [NMEA2000_teensy](https://github.com/ttlappalainen/NMEA2000_teensy) library.
120132
- [FlexCAN](https://github.com/ttlappalainen/FlexCAN_Library) library.
121133
- 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
171183

172184
NMEA2000_socketCAN has been originally forked from <https://github.com/thomasonw/NMEA2000_socketCAN>
173185

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.
175187
Hopefully I have time to write more complete document. There is example NMEA2000ToNMEA0183, which
176188
has been tested with RPi 3B.
177189

@@ -193,9 +205,7 @@ sends it to PC. `NMEA2000/Examples/ArduinoGateway` allows you to mimic Actisense
193205
NGT-1 and connect e.g. a Raspberry Pi running Signal-K to the NMEA2000 bus with
194206
an Arduino or Teensy.
195207

196-
# Forcing CAN "driver"
197-
198-
was using Arduino Software older than 1.6.6)
208+
# Forcing CAN board dependent "driver"
199209

200210
In examples there are simple includes:
201211

@@ -204,10 +214,9 @@ In examples there are simple includes:
204214
#include <NMEA2000_CAN.h> // This will automatically choose right CAN library and create suitable NMEA2000 object
205215
```
206216

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.
209218

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)
211220

212221
Your file should start with:
213222

@@ -239,6 +248,8 @@ Your file should start with:
239248
```cpp
240249
#include <N2kMsg.h>
241250
#include <NMEA2000.h>
251+
#define ESP32_CAN_TX_PIN GPIO_NUM_16
252+
#define ESP32_CAN_RX_PIN GPIO_NUM_4
242253
#include <NMEA2000_esp32.h> // https://github.com/ttlappalainen/NMEA2000_esp32
243254
//
244255
tNMEA2000_esp32 NMEA2000;

0 commit comments

Comments
 (0)