Go Down

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

mavromatis

Change your printing code to:
Code: [Select]

OutputStream->print("Lowrance Temperature (");
OutputStream->print(TempInstance);
OutputStream->print(") source: ");
OutputStream->print((unsigned char)TempSource);

and try with different sources (engine, water, cabin) and report the results.

L is integer literal and defines value to be treated as long. Actually for PGNs should have been UL
So it looks like the TempSource is the issue -- the TempInstance is correct:

DEBUG:: Lowrance Temperature (Instance: 3 source: 0) // 3 is engine rm
DEBUG:: Lowrance Temperature (Instance: 4 source: 0) // 4 is cabin




timolappalainen

Please do not quote everything.

Change code to:
TempSource=(tN2kTempSource)(b & 0x0f);
TempInstance=( (b & 0xf0) >> 4 );

Heikkif

Hi Timo and all,

I tend to built a depth alarm for NMEA 2000 first and later maybe something more ambitious. Have arduino due board and in the mail is coming http://copperhilltech.com/can-bus-mini-breakout-board/. I guess for NMEA-bus that 120 Ohm resistor has to picked off as bus has its own terminations. When trying to verify examples in Timos library following error is generated:


Arduino: 1.8.3 (Windows 10), Board: "Arduino Due (Programming Port)"





C:\Users\heikki\AppData\Local\Temp\arduino_build_230965\sketch\DataDisplay.ino.cpp.o: In function `__static_initialization_and_destruction_0':

C:\Users\heikki\Documents\Arduino\libraries\NMEA2000-master\src/NMEA2000_CAN.h:78: undefined reference to `tNMEA2000_due::tNMEA2000_due()'

collect2.exe: error: ld returned 1 exit status

Using library NMEA2000-master at version 1.1.141 in folder: C:\Users\heikki\Documents\Arduino\libraries\NMEA2000-master
Using library due_can-master at version 2.0.1 in folder: C:\Users\heikki\Documents\Arduino\libraries\due_can-master
exit status 1
Error compiling for board Arduino Due (Programming Port).



Left some jargon of in between the error message in order to make message shorter. What could possibly go wrong here?

Br:  Heikki

timolappalainen

Reload the NMEA2000_due (https://github.com/ttlappalainen/NMEA2000_due) library. I can produce that error if I remove file NMEA2000_due.cpp from path libraries\NMEA2000_due-master so I expect you are missing that file.

Heikkif

I will try as Timo suggested. There is a file like that in the location with size of 3KB.

timolappalainen

Then you could also try to remove completely your NMEA2000_due-master directory. Then it should give error:
In file included from xxx\Arduino\Examples\xxx\xxx:x:x

xxx\Arduino\libraries\NMEA2000/NMEA2000_CAN.h:77:26: fatal error: NMEA2000_due.h: No such file or directory

 #include <NMEA2000_due.h>

If not you have NMEA2000_due.h somewhere, where it should not be.

Heikkif

Now examples seem to verify correctly. Since my adventure with arduino is 5 days old I uninstalled and deleted everything related to arduino and downloaded everything again. Strangely enough computer still had stuff for due board left.

marcop20

Hi Timo, I'm using your library and I want to congratulate you first and foremost for the work you've done.

We come to the question ......

I joined n2k at my Lowrance Elite Ti and although I can see the device and all the data stream I can not see product information.

In their place I see blank fields, and in the selection of sources I see three question marks

I see that another user with the Lowrance HDS (page 14) had the same problem and then seems to have resolved it.

You could help me please

I'm using the latest version of your library, arduino-mega and shield can-bus V1.2

timolappalainen

Hi, and thanks.

I did not find your reference for "Lowrance HDS" - I made just quick search with "Lowrance" and "HDS".

Have you tested that with e.g. example TemperatureMonitor and not done any memory squeezing prefered for Uno board? You could also try does it help to enable interrupt by adding line
Code: [Select]
#define N2k_CAN_INT_PIN xx
before any includes. xx is the pin where interrupt has been connected on CAN_BUS shield.

You could also enable rows on example:
Code: [Select]
  delay(5000); // add this row to have time to open serial monitor
  Serial.begin(115200);
  NMEA2000.SetForwardStream(&Serial);
  NMEA2000.SetForwardType(tNMEA2000::fwdt_Text); // Show in clear text. Leave uncommented for default Actisense format.


And record the communication and email me.

In principle MDF devices should query "Product information", when they see new device on the bus. There are two way to do that and current version of library support only PGN request. I will publish new version of library within few days after finishing tests. That support also responding to query done by "Request group function" for "Product information". Meanwhile there are two possibilities:
1. Email me directly so I can send you a test release, which has that support.
2. Add to loop() code to send ProductInformation in every 1-2 sec.
Code: [Select]
#define ProductInformationSendPeriod 2000
void loop() {
  static unsigned long ProductInformationSendTime=millis()+ProductInformationSendPeriod ;
    if ( ProductInformationSendTime<millis() ) {
       NMEA2000.SendProductInformation();
       ProductInformationSendTime=millis()+ProductInformationSendPeriod ;
    }
}


Even if 2. will work, I prefere to test without it with new release. And I would like to get anyway the information for the solution.

marcop20

Hi Timo .....
I solved Method 2, that is, sending the ProductInformation every two seconds as recommended by you.
Anyway I attach you the log obtained on Arduino's serial monitor.

Code: [Select]

CAN device ready
Start address claim for device 0
Pri:6 PGN:60928 Source:22 Dest:255 Len:8 Data:1,0,C0,FF,0,84,32,C0
Pri:3 PGN:127488 Source:22 Dest:255 Len:8 Data:0,F8,43,FF,FF,7F,FF,FF
Pri:3 PGN:129026 Source:22 Dest:255 Len:8 Data:1,FC,D0,4E,A,0,FF,FF
Pri:3 PGN:127488 Source:22 Dest:255 Len:8 Data:0,F8,43,FF,FF,7F,FF,FF
Pri:3 PGN:129026 Source:22 Dest:255 Len:8 Data:1,FC,D0,4E,A,0,FF,FF
Pri:3 PGN:127488 Source:22 Dest:255 Len:8 Data:0,F8,43,FF,FF,7F,FF,FF
Pri:3 PGN:129026 Source:22 Dest:255 Len:8 Data:1,FC,D0,4E,A,0,FF,FF
Pri:3 PGN:127488 Source:22 Dest:255 Len:8 Data:0,F8,43,FF,FF,7F,FF,FF
Pri:3 PGN:129026 Source:22 Dest:255 Len:8 Data:1,FC,D0,4E,A,0,FF,FF
Pri:6 PGN:127508 Source:22 Dest:255 Len:8 Data:1,F8,4,FF,7F,FF,FF,1
Pri:6 PGN:127508 Source:22 Dest:255 Len:8 Data:0,64,5,A,0,FF,FF,0
Pri:6 PGN:130316 Source:22 Dest:255 Len:8 Data:1,1,4,74,7D,4,84,B
Pri:6 PGN:130312 Source:22 Dest:255 Len:8 Data:1,1,4,F2,72,23,73,FF
Pri:6 PGN:130311 Source:22 Dest:255 Len:8 Data:1,4,F2,72,B6,35,F6,3
Pri:6 PGN:130310 Source:22 Dest:255 Len:8 Data:1,C1,70,95,74,F6,3,FF
Pri:6 PGN:127513 Source:22 Dest:255 Len:8 Data:1,D2,1,9A,1,5F,82,61
Pri:6 PGN:127506 Source:22 Dest:255 Len:9 Data:1,1,1,56,5B,8C,5,D2,0
Pri:2 PGN:127257 Source:22 Dest:255 Len:8 Data:1,E3,FD,A3,1,AF,FA,FF
Pri:6 PGN:127489 Source:22 Dest:255 Len:26 Data:0,A0,19,B,E,C5,8A,8D,5,39,0,4C,6B,75,0,FF,FF,FF,FF,FF,1,0,0,0,7F,7F
Pri:6 PGN:127493 Source:22 Dest:255 Len:8 Data:0,FC,4C,1D,3B,D,5,FF
Pri:3 PGN:126992 Source:22 Dest:255 Len:8 Data:1,0,93,44,0,73,F4,24
Pri:6 PGN:129029 Source:22 Dest:255 Len:47 Data:1,93,44,0,73,F4,24,0,80,2,D6,50,2E,57,8,0,80,76,D2,4E,5C,1F,3,A0,37,A0,0,0,0,0,0,10,1,C,50,0,32,0,DC,5,0,0,1,F0,0,C8,0
Pri:6 PGN:129539 Source:22 Dest:255 Len:8 Data:1,6C,78,0,B0,FF,FF,7F
Pri:2 PGN:127250 Source:22 Dest:255 Len:8 Data:0,1A,9B,F4,FD,C0,3,FD
Pri:6 PGN:129038 Source:22 Dest:255 Len:27 Data:41,15,CD,5B,7,80,86,45,D0,C0,B5,BB,F,7,40,D,D0,7,FF,FF,FF,E0,93,0,0,F1,FF
Pri:6 PGN:127501 Source:22 Dest:255 Len:8 Data:2,CD,FF,FF,FF,FF,FF,FF
Pri:6 PGN:130314 Source:22 Dest:255 Len:8 Data:0,2,0,0,A0,F,0,FF
Pri:2 PGN:127245 Source:22 Dest:255 Len:8 Data:1,F9,97,FC,69,3,FF,FF
Pri:6 PGN:127501 Source:22 Dest:255 Len:8 Data:3,FF,DF,FF,FF,FF,FF,FF
Pri:3 PGN:127488 Source:22 Dest:255 Len:8 Data:0,F8,43,FF,FF,7F,FF,FF
Pri:3 PGN:129026 Source:22 Dest:255 Len:8 Data:1,FC,D0,4E,A,0,FF,FF
Pri:3 PGN:127488 Source:22 Dest:255 Len:8 Data:0,F8,43,FF,FF,7F,FF,FF
Pri:3 PGN:129026 Source:22 Dest:255 Len:8 Data:1,FC,D0,4E,A,0,FF,FF
Pri:3 PGN:127488 Source:22 Dest:255 Len:8 Data:0,F8,43,FF,FF,7F,FF,FF
Pri:3 PGN:129026 Source:22 Dest:255 Len:8 Data:1,FC,D0,4E,A,0,FF,FF
Pri:3 PGN:127488 Source:22 Dest:255 Len:8 Data:0,F8,43,FF,FF,7F,FF,FF
Pri:3 PGN:129026 Source:22 Dest:255 Len:8 Data:1,FC,D0,4E,A,0,FF,FF
Pri:3 PGN:127488 Source:22 Dest:255 Len:8 Data:0,F8,43,FF,FF,7F,FF,FF
Pri:3 PGN:129026 Source:22 Dest:255 Len:8 Data:1,FC,D0,4E,A,0,FF,FF
Pri:3 PGN:127488 Source:22 Dest:255 Len:8 Data:0,F8,43,FF,FF,7F,FF,FF
Pri:3 PGN:129026 Source:22 Dest:255 Len:8 Data:1,FC,D0,4E,A,0,FF,FF
Pri:6 PGN:127508 Source:22 Dest:255 Len:8 Data:1,F8,4,FF,7F,FF,FF,1
Pri:6 PGN:127508 Source:22 Dest:255 Len:8 Data:0,64,5,A,0,FF,FF,1
Pri:6 PGN:130316 Source:22 Dest:255 Len:8 Data:1,1,4,74,7D,4,84,B
Pri:6 PGN:130312 Source:22 Dest:255 Len:8 Data:1,1,4,F2,72,23,73,FF
Pri:6 PGN:130311 Source:22 Dest:255 Len:8 Data:1,4,F2,72,B6,35,F6,3
Pri:6 PGN:130310 Source:22 Dest:255 Len:8 Data:1,C1,70,95,74,F6,3,FF
Pri:6 PGN:127513 Source:22 Dest:255 Len:8 Data:1,D2,1,9A,1,5F,82,61
Pri:6 PGN:127506 Source:22 Dest:255 Len:9 Data:1,1,1,56,5B,8C,5,D2,0
Pri:2 PGN:127257 Source:22 Dest:255 Len:8 Data:1,E3,FD,A3,1,AF,FA,FF
Pri:6 PGN:127489 Source:22 Dest:255 Len:26 Data:0,A0,19,B,E,C5,8A,8D,5,39,0,4C,6B,75,0,FF,FF,FF,FF,FF,1,0,0,0,7F,7F
Pri:6 PGN:127493 Source:22 Dest:255 Len:8 Data:0,FC,4C,1D,3B,D,5,FF
Pri:3 PGN:126992 Source:22 Dest:255 Len:8 Data:1,0,93,44,0,73,F4,24
Pri:6 PGN:129029 Source:22 Dest:255 Len:47 Data:1,93,44,0,73,F4,24,0,80,2,D6,50,2E,57,8,0,80,76,D2,4E,5C,1F,3,A0,37,A0,0,0,0,0,0,10,1,C,50,0,32,0,DC,5,0,0,1,F0,0,C8,0
Pri:6 PGN:129539 Source:22 Dest:255 Len:8 Data:1,6C,78,0,B0,FF,FF,7F
Pri:2 PGN:127250 Source:22 Dest:255 Len:8 Data:0,1A,9B,F4,FD,C0,3,FD
Pri:6 PGN:129038 Source:22 Dest:255 Len:27 Data:41,15,CD,5B,7,80,86,45,D0,C0,B5,BB,F,7,40,D,D0,7,FF,FF,FF,E0,93,0,0,F1,FF
Pri:6 PGN:127501 Source:22 Dest:255 Len:8 Data:2,CD,FF,FF,FF,FF,FF,FF
Pri:6 PGN:130314 Source:22 Dest:255 Len:8 Data:0,2,0,0,A0,F,0,FF
Pri:2 PGN:127245 Source:22 Dest:255 Len:8 Data:1,F9,97,FC,69,3,FF,FF
Pri:6 PGN:127501 Source:22 Dest:255 Len:8 Data:3,FF,DF,FF,FF,FF,FF,FF
Pri:3 PGN:127488 Source:22 Dest:255 Len:8 Data:0,F8,43,FF,FF,7F,FF,FF
Pri:3 PGN:129026 Source:22 Dest:255 Len:8 Data:1,FC,D0,4E,A,0,FF,FF
Pri:3 PGN:127488 Source:22 Dest:255 Len:8 Data:0,F8,43,FF,FF,7F,FF,FF

marcop20

Timo...
I forgot ..... if you have a version of the new library I would be happy to test it.
And .... thanks again for all the work you did

timolappalainen

Method 2 is not right and good solution. Also your record did not had any message from Lowrance. Was it connected? Sorry I forgot to say that you have to comment line
Code: [Select]
// NMEA2000.EnableForward(false); // Disable all msg forwarding to USB (=Serial)
And you should:
- Program Mega with some dummy program, which does not communicate with N2k bus
- Turn Lowrance on. Should not have any Temerature monitor info!
- Open Mega serial monitor
- Program TemperatureMonitor to Mega
- Now it Mega should start after delay(5000) - did you add it - to initialize it on the bus

Also leave peridical SendProductInformation away from this test. I would like to get list of conversation between Mega and Lowrance. I am looking for, which message it uses for query.

You can send you email with private message, so I can send code to you.

marcop20

Hi Timo ....
I compared the two logs obtained with and without the modification in the loop .....

It looks like PGN: 126996 is not sent



pkeiramo

Hello Timo and thanks for the great job you have done!

I'm trying out to use your NMEA0183 library and NMEA0183ToN2k.ino example within it.

I can't compile it because it seems that HardwareSerial.availableForWrite() method is not implemented for Arduino Due. How did you get around this? I understood that you have used Due also.

I have Arduino Time library, Standard C++ library for Arduino and NMEA2000 library.

timolappalainen

They did implemented that for Due some time ago, but it has been left halfway. But you just need to add to both:
"C:\Users\<your account>\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\cores\arduino\Print.h"
and
"C:\Users\<your account>\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\cores\arduino\HardwareSerial.h"

virtual definition under public methods:
public:
...
    virtual int availableForWrite(void) = 0;
...

Then it compiles with DUE too. Note that path depends of your core version, but you understand what files I mean.

Go Up