PCAN-LIN Installation

RS-232 to CAN/LIN Interface
Oprogramer
Posts: 29
Joined: Mon 6. Nov 2017, 13:31

Re: PCAN-LIN Installation

Post by Oprogramer » Tue 5. Dec 2017, 10:07

Hi,

when i transmit a subscriber frame, should i use the identifier of the Master? It is possible just to write a message on the Bus, like a Broadcast message?


Thank you for your help

Best regards

M.Maidhof
Support
Support
Posts: 1753
Joined: Wed 22. Sep 2010, 14:00

Re: PCAN-LIN Installation

Post by M.Maidhof » Tue 5. Dec 2017, 10:14

Hi,

for a wakeup you could use any frame, because no node will receive due to the sleep mode of all connected LIN nodes. As written before a 0x3D will be a good solution.

regards

Michael

Oprogramer
Posts: 29
Joined: Mon 6. Nov 2017, 13:31

Re: PCAN-LIN Installation

Post by Oprogramer » Tue 5. Dec 2017, 10:31

hi,

thank you i will implement this as recomended. I have a last question, how can i set 8 bytes data for a ID in the range of 0x00 to 1F. When i use Set Slave ID + Data configuration, i can just add 2 Bytes Data but i need to add 8 Bytes for this IDs.

Best regard

M.Maidhof
Support
Support
Posts: 1753
Joined: Wed 22. Sep 2010, 14:00

Re: PCAN-LIN Installation

Post by M.Maidhof » Tue 5. Dec 2017, 11:26

Hi,

you also have to set the frame configuration for all used IDs 0-0x1F to 8 bytes.

regards

Michael

Oprogramer
Posts: 29
Joined: Mon 6. Nov 2017, 13:31

Re: PCAN-LIN Installation

Post by Oprogramer » Tue 5. Dec 2017, 15:04

Hi,

I tried to set the frame Length of ID 0 to 8 Bytes and set values for the Data with Set Slave ID + Data Configuration.
I can change the size of the frame and get error ok but when i assigne values to the Data i get the followed error message:

Error message: 02 01 01 00

My Code:

Code: Select all

 
Dim i_buffer(13) As Byte
        i_buffer(0) = &H2   'STX
        i_buffer(1) = &H4   'SC
        i_buffer(2) = &HA9  'CC 
        i_buffer(3) = &H1   'Active(1)
        i_buffer(4) = &H0   'ID
        i_buffer(5) = &H1A  'P1
        i_buffer(6) = &H0   'P2 
        i_buffer(7) = &H0   'P3
        i_buffer(8) = &H0   'P4
        i_buffer(9) = &H0   'P5 
        i_buffer(10) = &H0  'P6
        i_buffer(11) = &H0  'P7
        i_buffer(12) = &H0  'P8
        i_buffer(13) = &HB6 'CHK

        Try
            SerialLIN.Write(i_buffer, 0, 14)
        Catch ex As Exception
            Console.WriteLine("Exception : " & ex.Message.ToString())
        End Try
Did i forget some steps and is theire any other way to change the Data values with PCAN-LIN Protocol Definitions?

Best regards

M.Maidhof
Support
Support
Posts: 1753
Joined: Wed 22. Sep 2010, 14:00

Re: PCAN-LIN Installation

Post by M.Maidhof » Tue 5. Dec 2017, 17:56

Hi,

to set the ID 0x00 to 8 bytes in the frame configuration, you can use the following stream:

0x02 0x03 0xAB 0x04 0x00 0x08 0xA4

PCAN-LIN will return: 0x02 0x01 0x00 0x01

see page 76 of the PCAN-LIN protocol definiton pdf.

regards

Michael

Oprogramer
Posts: 29
Joined: Mon 6. Nov 2017, 13:31

Re: PCAN-LIN Installation

Post by Oprogramer » Tue 5. Dec 2017, 23:14

Hi,

I can set the size of the frame configuration. It works. But what i need is to assigne the Values of 8 Byte Data for the ID, who is Publishing. In my example i need to configure ID 0x00 to 8 Bytes(that works) and assigne 8 Byte Data 0x1A 0x00 0x00 0x00 0x00 0x00 0x00 0x00 (dont worked with Set Slave ID + Data Configuration).

Can you tell me how can i assign 8 Byte Data to the slaves ID, only assigning 2 Bytes Data works with Set Slave ID + Data configuration for ID 0x00.

Best regards

Oprogramer
Posts: 29
Joined: Mon 6. Nov 2017, 13:31

Re: PCAN-LIN Installation

Post by Oprogramer » Wed 6. Dec 2017, 11:45

Hi,

I solved the problem. I calculated a wrong checksum.

I have a question about initialization the LIN interface with configured parameters. When i change some values e.g. the size of the frame or the Slave Mask Status and then do an Initialization According to Current Parameters, then this command sets the default values and my change are deleted. But when i flash the changes to the memory without Initialization According to Current Parameters then the changes are updated.

How can i update the changes without flashing it to the memory? Initialization According to current Parametes doesnt work.

Best regards

M.Maidhof
Support
Support
Posts: 1753
Joined: Wed 22. Sep 2010, 14:00

Re: PCAN-LIN Installation

Post by M.Maidhof » Wed 6. Dec 2017, 13:42

Hello,

yes, the command "initialize to current parameters" will only keep:
- termination settings
- bitrate settings
- checksum type setting

scheduler entries will be erased, and frame length will be set back to default value.

You have to save the settings before you call initialize to current parameters, to keep all settings.

regards

Michael

Oprogramer
Posts: 29
Joined: Mon 6. Nov 2017, 13:31

Re: PCAN-LIN Installation

Post by Oprogramer » Wed 6. Dec 2017, 17:29

Hello,

Thank you for your help.

As you recommended i used the identifier 0x3D and fill the data with default values(0x00 for all byte parameter) to do a Wake up. Then i send this message and switch the PCAN-LIN again to slave mode. But then i got the followed error codes (02 A1 4A EB) and (02 A1 48 E9).

How can i interpret the error codes above, they are not listend in the PCAN-LIN Protocol definitions and did i something wrong?
M.Maidhof wrote:Hi,

for a wakeup you could use any frame, because no node will receive due to the sleep mode of all connected LIN nodes. As written before a 0x3D will be a good solution.

regards

Michael

Post Reply