PCAN-LIN Installation

RS-232 to CAN/LIN Interface
M.Maidhof
Support
Support
Posts: 1753
Joined: Wed 22. Sep 2010, 14:00

Re: PCAN-LIN Installation

Post by M.Maidhof » Thu 7. Dec 2017, 10:29

Hi,

please see protocol definition pdf page 110:

0x0A Slave not responding
0x08 Invalid frame checksum received

bit 6 of byte 3 will be set, that is why you will see 0x4A and 0x48

don´t care for errors on a wakeup signal, it is just there to wakeup other nodes, and you will get no responds.

BTW: please send a 3D subscriber as wakeup, instead of a 3D publisher with data.

regards

Michael

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

Re: PCAN-LIN Installation

Post by Oprogramer » Thu 7. Dec 2017, 11:05

Hello,

thank you for your helo.

To send a 3D subscriber as wakeup, i first change the mode of the PCAN-LIN to Master, then change the Set Slave Mask status of the ID 3D to subscriber and then send the message, with default values, with the write command.
Is that correct or how can i send a subscriber message?

Best regards

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

Re: PCAN-LIN Installation

Post by M.Maidhof » Thu 7. Dec 2017, 12:29

yes, correct. You must "OR" the LIN ID with 0x80 in your serial command to send a subscriber message.

regards

Michael

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

Re: PCAN-LIN Installation

Post by Oprogramer » Thu 7. Dec 2017, 13:56

Hi,

Thank you for the information.

I now send a 3D subscriber as wakeup. The command i use is: 0x02(stx) 0x01(sc) 0x81(cc) 0xBD (3D OR 0x80,ID) 0x3D(chk).
And i get a slave not responding error but after reseting the module to Slave i get messages again.

Do i need everytime a reseting of the module to load the changes and when i OR the LIN ID with 0x80 then i do not need to execute the set Slave Mask status to subscriber?

Best regards

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

Re: PCAN-LIN Installation

Post by M.Maidhof » Thu 7. Dec 2017, 14:25

you only need a master termination to send out a subscriber frame. But as long as 3D is set to publisher, it will be triggered by your subscriber.

regards

Michael

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

Re: PCAN-LIN Installation

Post by Oprogramer » Fri 8. Dec 2017, 14:42

Hello,

Thank you for your help :) !

Best regards

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

Re: PCAN-LIN Installation

Post by Oprogramer » Wed 13. Dec 2017, 21:03

Hello,

i have a problem to set the Slave Mask status to subscriber. When i change the slave mask status to publisher, that works. But when i change it again to subscriber, it dosent work.

My programflow is : i first set the checksum type, then change the Frame length and then set the slave mask status to subscriber. I get no errors and the checksum type and frame length is changing but not the slave mask status from publisher to subscriber.

Do i must do some steps before or after changing the slave mask status to subscriber?

Best regards

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

Re: PCAN-LIN Installation

Post by M.Maidhof » Thu 14. Dec 2017, 12:09

Hi,

please post the serial commands you are using, please post full details inclusive checksum.

regards

Michael

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

Re: PCAN-LIN Installation

Post by Oprogramer » Thu 14. Dec 2017, 23:22

Hello,

below is the program flow of my application as i described in my previous post. All commands are working except the command to change the slave mask status to subscriber but i get the error ok code when calling this method :?: . Changing the slave mask status to publisher works.

The commands are usually in methods and i just call the methods in the order below. ID and status are parameters of the method.

I also call the flash current configuration and reset module after the commands are executed. They also work, i checked the error code.

The error code when changing to subscriber is also error ok but it doesent change to subscriber?

Code: Select all


' Function to calculate the checksum

    Public Function calculateChecksum(ByVal barray() As Byte) As Byte
        Dim result As Byte = barray(1)

        For i = 2 To UBound(barray) - 1
            result = result Xor barray(i)
        Next
        Return result
    End Function

'[color=#FF0000]sets the slave mask status according to the parameters to subscriber or publisher for a given Id, parameters are slave status and id

Here just changing the status to publisher works, but when i change the status to subscriber it often doesent works.[/color]

[color=#FF0000]Dim ibuffer(6) As Byte

        ibuffer(0) = &H2    'STX
        ibuffer(1) = &H3    'SC
        ibuffer(2) = &HAE   'CC

        ibuffer(3) = &H1    'set mask for single id
        ibuffer(4) = id  'ID to set the status!!!
        ibuffer(5) = status 'status

        ibuffer(6) = calculateChecksum(ibuffer)     'CHK

        Try
            mySerialPort.Write(ibuffer, 0, 7)
        Catch ex As Exception
            Console.WriteLine("Exception: " & ex.Message.ToString())
        End Try[/color]

Last edited by Oprogramer on Fri 15. Dec 2017, 12:17, edited 1 time in total.

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

Re: PCAN-LIN Installation

Post by M.Maidhof » Fri 15. Dec 2017, 09:50

Hi,

I asked for the serial stream you sent to the PCAN-LIN, so please sent me the results of your code on the serial port. It is not my job to check your code for any error. This is not included in our free product support.

regards

Michael

Post Reply