Development Of Can Applications - Embest SBC8600B User Manual

Hide thumbs Also See for SBC8600B:
Table of Contents

Advertisement

Embest Technology Co., Ltd
compilation;
arm-linux-gcc led_acc.c -o led_acc
3) Download the compiled files to SBC8600B and enter the directory where the file
led_acc is saved, and then execute the following instruction to run LED
application;
./led_acc &

3.12.2 Development of CAN Applications

1) Defining Data to Be Sent;
The syntax for CAN frame definition is "<can_id>#{R|data}"; CAN_ID could be a 3-bit
(standard frame) or 8-bit (extended frame) hexadecimal format; Data could be a 0 to 8-bit
hexadecimal format (can be separated with separators ".").
Often used syntax:
char *cmd_str = "123#1122334455667788";
char *cmd_str = "123#11.22.33.44.55.66.77.88"
char *cmd_str = "12345678#112233"
2) Creating Sockets;
Before CAN network is ready to function, you need to create a socket first.
SocketCAN introduces a new protocol family, so it is necessary to include PF_CAN as a
parameter when calling the function socket(). Currently there are two CAN protocols
available, one is Raw Socket protocol, the other is BCM (Broadcast Manager).
For example:
s = socket(PF_CAN, SOCK_RAW, CAN_RAW);
After successfully creating a socket, you typically nened to use the function bind() to
create a binding between the socket and a CAN interface. After binding (CAN_RAW) or
Copyright © 2017 Embest Technology
Example Application
SBC8600B-UM-V2.0
90

Advertisement

Table of Contents
loading

Table of Contents