Forum: Projekte & Code NMEA2000 nach NMEA0183 Converter


von Philipp D. (phili)


Angehängte Dateien:

Lesenswert?

Dear Community,

enclosed you will find an NMEA2000 to NMEA0183 message converter. 
Currently the converter itself only supports PGN 0x01F805, coding the 
actual GPS position. This PGN is then translated into an 0183 GPGLL 
message.

I required the converter to interface an old VHF radio (supporting only 
NMEA0183) to the new NMEA2000 bus we installed into out boat.

In the .rar archive you will additionally find the NMEA2000 protocol
stack i wrote. It supports transmission and reception of NMEA2000 
messages.
As the NMEA2000 protocol is not as open as some people claim, the most 
difficult part at the moment is to interpert and decypher the 
representation of many CAN datafields for different messages.

You can find a lot of information in the appendix of all Maretron 
datasheets (www.maretron.com).

Additionally I am using the transmission part of the NMEA2000 stack with 
an old speedometer that I converted to NMEA2000. It works pretty very 
well. Unfortunately the sources are not sufficiently well documented to 
be published yet.

I will be improving the stack in the near future and add more comments 
on how it works.

Liebe Grüße
Phili

von NunEinGast (Gast)


Lesenswert?

Hi Philipp,

are there any news on your converter ? New developments, extensions ....

Thanks

Frank

von tom lafleur (Gast)


Lesenswert?

Philip

I am very interested in this project, can you keep me informed of your 
progress with your stack.

I also have a lot of information on J1939 that NMEA2000 is based on that 
maybe of help to you. Including PNG data formats.

also, you are using part of a "Multi-Tasking Core for ATMEL 
microcontrollers", where did this come from??

thanks

tom lafleur

lafleur @ lafleur.us  <--- please use this address

von Eric (Gast)


Lesenswert?

I realize that this posting is over a year old but have you done any 
further work on the N2K standard that you would be willing to release?

Thanks in Advance if you read this.

Eric

von Andreas H. (andy78)


Lesenswert?

Hallo

Ich komme bei den Message id nicht weiter kann mir da jemand helfen.
habe den obigen Code ausprobiert.


uint8_t mcp2515_read_id(uint32_t *id)
{
  uint8_t first;
  uint8_t tmp;

  first = spi_putc(0xff);
  tmp   = spi_putc(0xff);


  if (tmp & (1 << IDE)) {
    spi_start(0xff);
    *((uint16_t *) id + 1)  = (uint16_t) first << 5;
    *((uint8_t *)  id + 1)  = spi_wait();
    spi_start(0xff);

    *((uint8_t *)  id + 2) |= (tmp >> 3) & 0x1C;
    *((uint8_t *)  id + 2) |=  tmp & 0x03;

    *((uint8_t *)  id)      = spi_wait();

    return 1;
  }
  else {
    car1=2;
    spi_start(0xff);

    *((uint8_t *)  id + 3) = 0;
    *((uint8_t *)  id + 2) = 0;

    *((uint16_t *) id) = (uint16_t) first << 3;

    spi_wait();
    spi_start(0xff);

    *((uint8_t *) id) |= tmp >> 5;

    spi_wait();

    return 0;
  }
}




void mcp2515_write_id(const uint32_t *id)
{
  uint8_t tmp;

  spi_start(*((uint16_t *) id + 1) >> 5);

  // naechsten Werte berechnen
  tmp  = (*((uint8_t *) id + 2) << 3) & 0xe0;
  tmp |= (1 << IDE);
  tmp |= (*((uint8_t *) id + 2)) & 0x03;

  // warten bis der vorherige Werte geschrieben wurde
  spi_wait();

  // restliche Werte schreiben
  spi_putc(tmp);
  spi_putc(*((uint8_t *) id + 1));
  spi_putc(*((uint8_t *) id));
}

priority=6
PGN=0x1F010; (Date/TIME)
Source_address=10


message.id = ((uint32_t)(message_container->priority & 0x07) << 26) | 
(((uint32_t)message_container->PGN & 0x01FFFF) << 8) | source_address;



Ergebniss messageid=0x1003 das stimmt doch nicht???

die Daten kommen richtig im Datafeld.

Nur die ID nicht.

Wie wird die berechnet???


Danke

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.