Recently, a customer wanted to use the AiPi-SCP-4.3 for an electric vehicle's odometer, but it did not have a CAN interface. In simple terms, the CAN interface is a communication bus commonly used in automobiles and is now also used in electric vehicles.
Ⅰ. CAN Bus OverviewThe CAN bus, full name Controller Area Network, is a serial asynchronous half-duplex communication protocol developed by Bosch in the 1980s. It was initially designed to address communication issues between multiple controllers in automotive electronics and has become an important communication standard in the automotive, industrial automation, and medical equipment fields.
The CAN bus is widely used in automotive electronics, such as engine control units, transmission control units, windows, lights, air conditioning, wipers, and other body control devices, as well as safety systems like ABS (Anti-lock Braking System), ESP (Electronic Stability Program), and airbags.
Ⅱ. Introduction of AiPi-SCP-4.3The AiPi-SCP-4.3 uses the Ai-M61-32S wireless module as the control core, driving a 4.3-inch (480*272) RGB LCD screen to display necessary information. It can change the screen display interface via buttons and is suitable for applications in electric or bicycles.
The AiPi-SCP-4.3 features an external RS485 communication interface, powered by a Type-C interface, with the remaining IO ports brought out as GPIO interfaces for easy expansion.
01 Test Preparation
Prepare the following materials to begin testing the CAN bus:
AiPi-SCP-4.3 Board + Screen x1
CAN to TTL Module x1
USB to CAN Module x1
Dupont Wires x2
Type-C Data Cable
USB to CAN Module Driver
CAN Test Software
Ai-M61 Firmware Burning Software
Test FirmwareInstruction Manual
02 Firmware Burning
After downloading the test firmware, burn it into the AiPi-SCP-4.3.
Entering Download Mode
Hold the download button
Press and release the reset button
Release the download button
03 Wiring Diagram
04 User Instructions
- Using the Upper Computer
- Connecting Devices
After opening the upper computer software, it will automatically enter the connection interface. If the driver is installed successfully and the USB-TO-CAN module is connected to the computer, the following information will be displayed:
(If the module information is not displayed, reinstall the driver or reconnect the USB-TO-CAN module.)
- Interface Description
05 Sending Data
- Data Description
The firmware data is 8-bit hexadecimal data, with the following structure:
- Attribute Code Description
This firmware includes 10 attributes, each corresponding to 10 messages displayed on the screen. The attributes and their codes are as follows:
- Modifying Displayed Speed
Click the “Add Message” icon or right-click in the send window -> “New Message” to open the message configuration window.
In the message configuration window, set the following information: ID: 1, Cycl Time: 1000ms, Data to the following 8-bit data:
AA AA 01 00 00 01 55 55
After clicking OK, the instruction will appear in the send window, and the speed on the AiPi-SCP-4.3 screen will change to 1.
- Modifying Speed Again
Double-click the instruction you just created, and in the message configuration window, change the 5th value in the Data field to the corresponding speed, for example, 80 km/h in hexadecimal is: 0X50.
After clicking OK, the battery level on the AiPi-SCP-4.3 screen changes to 80km/h.
- Modify Battery Level
Similarly, add a data entry with an ID of 2 (different message IDs must be unique), set the battery level to 25% (the hexadecimal value for 25 is 0X19), and the corresponding data frame is as follows:
AA AA 04 00 00 19 55 55
After clicking “OK”, the battery level on the AiPi-SCP-4.3 screen will be updated to 25%.
The main function of this firmware is to display CAN transmission data and is not for CAN performance testing.
For data with only 2 digits displayed, the data must not exceed 100, such as battery level and speed.
Since this version of the SDK is not open, the CAN source code is not open-source.
Comments
Please log in or sign up to comment.