Advertisement

Quick Links

Product name
Model number
Manufacturer
PiCAN FD LIN Rev B 1.0
PiCAN FD and LIN-Bus
USER GUIDE V1.0
PICAN FD and LIN-Bus Board for Raspberry Pi
RSP-PICANFDLIN
SK Pang Electronics Ltd
SK Pang Electronics Ltd Ó 2022
www.skpang.co.uk
1

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the RSP-PICANFDLIN and is the answer not in the manual?

Questions and answers

Summary of Contents for SK Pang Electronics RSP-PICANFDLIN

  • Page 1 PiCAN FD LIN Rev B 1.0 PiCAN FD and LIN-Bus USER GUIDE V1.0 Product name PICAN FD and LIN-Bus Board for Raspberry Pi Model number RSP-PICANFDLIN Manufacturer SK Pang Electronics Ltd SK Pang Electronics Ltd Ó 2022 www.skpang.co.uk...
  • Page 2: Table Of Contents

    Screw Terminals ............................4 1.4. CAN-BUS 120W Terminator ........................4 1.5. LEDs ..................................4 1.6. Optional ................................4 Software Installation ....................1.7. Installing CAN Utils ............................5 1.8. Bring Up the Interface ..........................5 Python Installation and Use ..................1.9. LIN-Bus Usage ..............................7 1.10. ASCII Command Set ............................8 1.11. LIN-BUS GUI ..............................9 SK Pang Electronics Ltd Ó 2022 www.skpang.co.uk...
  • Page 3: Introduction

    • Conforms to ISO11898-1:2015 • High speed SPI Interface • CAN connection via 4way screw terminal • 120Ω terminator ready • LED indicator (GPIO04) • Four fixing holes, comply with Pi Hat standard • SocketCAN driver, appears as can0 and can1 to application • Interrupt RX on GPIO25 1.2. LIN-Bus Features • LED indicator • LIN master or slave. Setting via jumper • LIN provided by dsPIC33 micro-controller with updatable firmware • Communicate to the Pi via ASCII text commands on ttyS0 2. Hardware Installation Before installing the board make sure the Raspberry Pi is switched off. Carefully align the 40way connector on top of the Pi. Use spacer and screw (optional items) to secure the board. SK Pang Electronics Ltd Ó 2022 www.skpang.co.uk...
  • Page 4: Screw Terminals

    +12v 1.4. CAN-BUS 120 W Terminator There is a 120W fitted to the board. To use the terminator solder a 2way header pin to JP2 then insert a jumper. 1.5. LEDs There is a red LED (LED1) fitted to the board. This is connected to GPIO04. LED2 is LIN-bus indication which is controlled by the dsPIC33. 1.6. Optional SMPS. Switch mode power supply module option, this is a 5v module that can power the board and the Raspberry Pi. It has an input voltage range of 7v to 24v. 3. Software Installation It is best to start with a brand new Raspbian image. Download the latest from: After first time boot up, do an update and upgrade first. sudo apt-get update sudo apt-get upgrade sudo reboot Add these lines to the end of file: enable_uart=1 dtparam=spi=on SK Pang Electronics Ltd Ó 2022 www.skpang.co.uk...
  • Page 5: Installing Can Utils

    /sbin/ip link set can0 up type can bitrate 500000 dbitrate 2000000 fd on sample-point .8 dsample-point .8 Connect the PiCAN FD LIN board to your CAN network. To send a CAN 2.0 message use : cansend can0 7DF#0201050000000000 This will send a CAN ID of 7DF. Data 02 01 05 – coolant temperature request. To send a CAN FD message with BRS use : cansend can0 7df##15555555555555555 To send a CAN FD message with no BRS use : cansend can0 7df##05555555555555555 Connect the PiCAN to a CAN-bus network and monitor traffic by using command: candump can0 SK Pang Electronics Ltd Ó 2022 www.skpang.co.uk...
  • Page 6: Python Installation And Use

    /sbin/ip link set can0 up type can bitrate 500000 dbitrate 2000000 fd on sample-point .8 dsample-point .8 Now start python3 and try the transmit with CAN FD and BRS set. python3 import can bus = can.interface.Bus(channel='can0', bustype='socketcan',fd = True) msg = can.Message(arbitration_id=0x7de,is_fd = True, bitrate_switch = True,data=[0,0,0,0,0,0x1e,0x21,0xfe, 0x80, 0, 0,1,0]) bus.send(msg) SK Pang Electronics Ltd Ó 2022 www.skpang.co.uk...
  • Page 7: Lin-Bus Usage

    PiCAN FD LIN Rev B 1.0 To received messages and display on screen type in: notifier = can.Notifier(bus, [can.Printer()]) Documentation for python-can can be found at : https://python-can.readthedocs.io/en/stable/index.html More expamles in github: https://github.com/skpang/PiCAN-FD-Python-examples 1.9. LIN-Bus Usage LIN-bus is communicated to the Pi over the UART on ttyS0 port at 115200 8-N-1 setting. Using Coolterm for Raspberry Pi or a text base terminal. Set the port to /dev/ttyS0 / 115200 8-N-1 and connect. On the terminal type in ‘v’ and press enter. Type in ‘V’ and press enter. You should see a reply like this screen: SK Pang Electronics Ltd Ó 2022 www.skpang.co.uk...
  • Page 8: Ascii Command Set

    1.10. ASCII Command Set To control the LIN-bus port a simple ASCII command is sent from the Pi to the PICAN FD LIN board. Commands The command requires a carriage return character (0x0D). All values are in hex. Get hardware version Get firmware version Open LIN port Close LIN port Set LIN baudrate Set baudrate to 9600 S2 Set baudrate to 10400 Set baudrate to 19200 (default) Transmit a LIN frame with Classic checksum taaxdddddddddddddddd LIN address in hex Data length 0 to 8 bytes Data byte value in hex Transmit a LIN frame with Enhanced checksum Taaxdddddddddddddddd LIN address in hex Data length 0 to 8 bytes Data byte value in hex Monitor mode. All LIN traffic will be sent to the Pi with a prefix of M Request/respond mode. An address value will be sent on the bus and respond will pass onto the Pi. raa aa LIN address in hex Example 1. Controlling NCV7430 RGB LED SK Pang Electronics Ltd Ó 2022 www.skpang.co.uk...
  • Page 9: Lin-Bus Gui

    PiCAN FD LIN Rev B 1.0 To set the NCV7430 first it needs to be initialized with these values 23 C0 00 00 7F. Command string: t234C000007F To set the LED to blue, sent this string 24 C0 00 00 10 31 00 00 FF Command string: t248C0000010310000ff To set the LED to red, sent this string 24 C0 00 00 10 31 00 FF 00 Command string: t248C00000103100ff00 Example 2. Reading a window mirror switch To read the status of a window mirror switch we need to use the r command with an address of 0x49. Command string: Expected respond: M0A4900C000F8FFFFFF0BF1 Monitor command 0x0A in hex means 10 bytes responds length including the address Address in hex dd Data in hex 1.11. LIN-BUS GUI A simple GUI interface is available to download from github: https://github.com/skpang/PiCAN_LIN_GUI_demo To run the program start a terminal and type in: python3 pican-lin.py You should see a screen shown below: SK Pang Electronics Ltd Ó 2022 www.skpang.co.uk...
  • Page 10 PiCAN FD LIN Rev B 1.0 1. Click the Connect button to connect to the PiCAN FD LIN board. 2. Check the Status box is updated. Example 1. Controlling NCV7430 RGB LED To set the NCV7430 first it needs to be initialized with these values 23 C0 00 00 7F. First open the port. In the Commands box type in: Click ‘Send Once’ then type in: t234C000007F Click ‘Send Once’ To set the LED to blue, sent this string 24 C0 00 00 10 31 00 00 FF In the Commands box type in: t248C0000010310000ff Click ‘Send Once’ SK Pang Electronics Ltd Ó 2022 www.skpang.co.uk...
  • Page 11 PiCAN FD LIN Rev B 1.0 Check the LED turned blue. To set the LED to red, sent this string 24 C0 00 00 10 31 00 FF 00 In the Commands box type in: t248C0000010310000ff Click ‘Send Once’ Check the LED turned red. SK Pang Electronics Ltd Ó 2022 www.skpang.co.uk...
  • Page 12 PiCAN FD LIN Rev B 1.0 Example 2. Reading a window mirror switch To read the status of a window mirror switch type in the Commands box: Click ‘Send Once’ Click ‘Send Once’ 100 in the Interval box and Click Start. You should see the request is sent out every 100ms with reply on the list box. Press the window switches and you should see the data value return changes. SK Pang Electronics Ltd Ó 2022 www.skpang.co.uk...

Table of Contents