SK Pang electronics CAN-UART2 CAN to UART Converter Board User Guide
- June 13, 2024
- SK Pang electronics
Table of Contents
CAN-UART Rev v3.0
CAN to UART Converter Board
V3.0 July 2023
Product name | CAN to UART Converter Board |
---|---|
Model number | CAN-UART2 |
Manufacturer | SK Pang Electronics Ltd |
Introduction
This board convers CAN message into UART and vice versa. CAN and UART baud rate is programable via a CAN message. The UART’s voltage level can be 3.3v or 5.0v selectable via solder bridges. On board RGB LED for status indication. Firmware upgradable via UART or ICSP.
1.1. Features
- Programmable CAN baud rate
- Programmable UART baud rate
- RGB LED status indictor
- Firmware upgradable via UART or ICSP
- Selectable UART logic voltages (3.3v or 5v)
- 8v to 24v supply voltage with reverse polarity protection
- Powerful dsPIC33CK256MP502 micro-controller
- Programmable CAN ID for receive and transmit
- CAN configuration message at 0x7E5
- CAN FD compatible. Requires firmware upgrade
1.2. CAN and Power Connection
The CAN and power are connected via J3.
1.3. 120Ω Terminator
There is a 120 Ω resistor has been fitted to the board. To use the
terminator solder a 2way header pin to JP1 then insert a jumper.
1.4. UART Connection and Voltage Select
The factory default UART logic voltage is 3.3v
The UART connection is via J3. The UART voltage is selectable via JP2,3 Solder
the bridges on the left for 3.3v. Solder the bridges on the right for Sv.
Photo shown 3.3v been selected.
WARNING : Do NOT connect a Sv UART when the UART voltage has been set to
3.3v. This will damage the board.
1.5. RGB LED
There is a RGB LED fitted to the board. This colour and functions are:
Colour and State | Function |
---|---|
RGB sequence | Booting up |
Flashing green | Operational |
Flashing blue | CAN Receive data, UART transmit |
Flashing red | UART receive, CAN transmit |
Fast flashing blue | Firmware upgrade or baudrate changed, waiting for power |
cycle
Solid red| Unit fault
CAN to UART Usage
Default board ID(Tx) is 0x400 and the board listens on 0x401 with Standard ID
(11-bit). This ID can be re-program to used Extended ID (29-bit).
The board has a factory default of baudrate of 500kbps for CAN and 115200bps
for UART.
On receiving UART message, it is buffered until 8 characters are received then
it is sent out on the CAN-bus with a CAN ID of 0x400. If a CR (return) and LF
(line feed) is received before 8 characters it will be sent out straight away.
The board is waiting for a CAN message on CAN ID of 0x401. When a message is
received it is sent out on the UART with the message length determined by the
CAN message DLC.
For example:
UART received message
Hello + CR + LF
It will send out on the CAN-bus
ID:0x900 Len:8 Data:98 65 6C 6C 6F OD OA
CAN received message and transmit to UART
CAN listen on 0x401
ID:0x901 Len:8 Data:98 45 4C 9C 9F OD OA 00 It will sent out HELLO + CR LF
Reset to Factory Defaults
The board can be reset to factory defaults.
1.6. Procedure
With the power removed from the board, place a jumper on JP8, across RAO and
3.3v Power up the board. Wait until the LED is flashing blue. Remove the
jumper and power cycle the board.
BOARD CONFIGURATION Data Format
The board configuration can be changed by sending a CAN frame with ID of 0x7E5
1.7. Unit Configuration
CAN ID| DLC| D0| D1| D2| D3| D4| D5|
D6| D7
---|---|---|---|---|---|---|---|---|---
0x7E5| 8| BOARDID0 CMD| BOARD ID1| BOARD ID2| BOARD_ ID3| Data0| Data1|
Data2| Data3
BOARD_ID0_CMD
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|
CMD | BOARD_ID0 |
Bit | Field | Description |
---|---|---|
7-5 | CMD | 000(0) = Set new node ID (Tx) 001(1) = Set new listen ID (Rx) 010(2) |
= Set CAN baudrate 011(3) = Set UART baudrate 100(4) = Reboot 101(5) = Print
version on UART
4-0| BOARD_ID0| Board ID<28:24>
BOARD_ID1
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|
BOARD ID<23:16>
BOARD_ID2
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|
Board ID<15:8>
BOARD_ID3
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|
Board ID<7:0>
Data0
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|
0 | 0 | IDEN | NBID |
CMD=0,1
Bit | Field | Description |
---|---|---|
7-6 | NA | Must be 0 |
5 | IDEN | 0 = Standard Identifier 1 = Extended Identifier |
4-0 | NBID | New board ID<28:24> |
Data1 CMD=0,1
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|
New board ID<23:16>
Data2 CMD=0,1
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|
New board ID<15:8>
Data3
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|
DATA3
DATA3 : CMD=0,1
Bit | Field | Description |
---|---|---|
7-0 | New board ID<7:0> |
DATA3:CMD=2SetCANbaudrate
Bit | Field | Description |
---|---|---|
7-4 | NA | Must be 0 |
3-0 | Baudrate | 000 = 125kbps |
001 = 250kbps
010 = 500kbps
011 = 1000kbps
DATA3 : CMD=3 Set UART baudrate
Bit | Field | Description |
---|---|---|
7-4 | NA | Must be 0 |
3-0 | Baudrate | 000 = 9600bps |
001 = 14400bps
010 = 19200bps
011 = 38400bps
DATA3:CMD=4Reboot
Bit | Field | Description |
---|---|---|
7-1 | NA | Must be 0 |
0 | Reboot | 1 = Reboot board |
DATA3 : CMD=5 Print version on UART
Bit | Field | Description |
---|---|---|
7-1 | NA | Must be 0 |
0 | Version | 1 = Print version out |
Examplel: Current board ID is 0x400. Set new board ID to 0x312 with Standard
Identifier.
ID:7E5 DLC:8 Data:00 00 04 00 00 00 03 12
Example2: Current board ID is 0x412. Set new board ID to 0x12345678 with
Extended Identifier.
ID:7E5 DLC:8 Data:00 00 04 12 32 34 56 78
Example3: Current board ID is 0x400. Set new listen ID to 0x312 with Standard
Identifier.
ID:7 ES
DLC:8 Data:20 00 04 00 00 00 03 12
Example4: Current board ID is 0x412. Set new listen ID to 0x12345678 with
Extended Identifier.
ID:7E5 DLC:8 Data:20 00 04 12 32 34 56 78
Note Data° bit 5 is set for Extended Identifier.
ExampleS: Current board ID is 0x400. Set new CAN baudrate to 1000kbps.
ID:7E5 DLC:8 Data:40 00 04 00 00 00 00 03
After a valid new CAN baudrate is received the blue LED will flash
continuously and a power cycle is required in order to use the new CAN
baudrate.
101 = 115200bps Example6: Current board ID is 0x400. Set new UART baudrate to
14400kbps. ID:7E5 DLC:8 Data:40 00 04 00 00 00 00 01
After a valid new UART baudrate is received the blue LED will flash five times
and the board will power cycle.
Example7: Current board ID is 0x400. Set to reboot the board. Data3 Reboot 001
= Reboot ID:7E5 DLC:8 Data:80 00 04 00 00 00 00 01
Example7: Current board ID is 0x400. Set to print out versions. ID:7E5 DLC:8
Data:80 00 04 00 00 00 00 01
1.8. Defaults
The board is shipped with the following defaults:
Board ID (CAN Tx ID) : 0x400 Listen ID (CAN Rx ID) : 0x401 CAN Baudrate :
SOOkbps UART Baudrate : 115200bps 10 pins : All input
Firmware Update
The board firmware can be updated via the UART. This requires a FTDI UART to
USB board. Ensure the voltage level matches on the FTDI board matches the CAN-
UART board.
Power down the board and place a jumper JP8, across RAO and GND Power up the
board. Wait until the LED is flashing blue.
1.9. Update via Serial Download the java Unified Bootloader Host Application
from:
https://wwl.microchip.com/downloads/aemDocuments/documents/MC
U16/ProductDocuments/SoftwareTools/Unifiedllost-1.19.0.zip
Unzip the file and change into the directory:
cd UnifiedHost-1.19.0
Start the app by: java -jar UnifiedHost-1.19.1.
jar Select Device Architecture as PIC24 MCUs \ dsPiC33 DSCs
Now click File | Open/Load File
(*.hex) to load the firmware hex file.
Select the required firmware hex file.
Now click Settings|Serial.
Select the correct COM Port for your FTDI board.
Select the Bits per second to be 115200:
Now click Apply.
Now click Read Device 1 follow by Program 2.
Check the Status shows Finished executing requested operations and no error
shown.
Remove jumper from board and power cycle.
SK Pang Electronics Ltd Ó 2023
www.skpang.co.uk
References
- SK Pang Electronics Ltd - Electronic supply for engineer and hobbyist
- Empowering Innovation | Microchip Technology