GPIO, full name: General Purpose Input/Output, is a general-purpose pin that can be dynamically configured and controlled during software operation. On the RK platform, except for some pins with specialized purposes (such as DDR, MIPI, etc.), other pins, if not configured for reuse, default reuse status is GPIO. RK's GPIO driver provides the standard GPIO interface for Linux. There is a set of sysfs nodes in Linux that operate GPIO in user mode. The application layer mainly implements GPIO programming by manipulating these nodes.
YY3568 is connected to two LED lights, namely GPIO3-A4 and GPIO02-B2, as shown in the following figure:
Under the general Linux framework, all GPIO are numbered with numbers. For chips on the RK platform, the numbering calculation method is: (gpio controller number -0) * 32+(port number -'A ') * 8+index number. The controller number of GPO3-A4 is 3, the port number is A, and the index number is 4, so the numbering is (3-0) 32+08+4=100
Set GPIO 100 to user mode operation
echo 100 > /sys/class/gpio/export
Set GPIO 100 as output
echo out > /sys/class/gpio/gpio100/direction
Set the voltage level with GPIO 100 as the output
High level
echo 1 > /sys/class/gpio/gpio100/value
Low level
echo 0 > /sys/class/gpio/gpio100/value
Set GPIO 100 as input
echo in > /sys/class/gpio/gpio100/direction
When GPIO 100 is used as the input, read its voltage level, where 1 is high and 0 is low
cat sys/class/gpio/gpio100/value
Cancel GPIO 100 user mode operation
echo 100 > /sys/class/gpio/unexport
# mkdir /mnt/usb
# mount /dev/block/sda2 /mnt/youyeetoo
# cd /mnt/usb
# ls
ls /dev/ttyS*
2. Device file for serial port 4:/dev/ttyS4
3. Output the following command in debugging the serial port and check it in the SSCOM tool (note that the baud rate of the serial port is 1500000):
2. Device file for serial port 8:/dev/ttyS8
3. Output the following command in debugging the serial port and check it in the SSCOM tool (note that the baud rate of the serial port is 9600)
2. In debugging the serial port terminal, use "i2ctest - y 1" to scan the devices mounted on i2c1
3. In debugging the serial port terminal, use "i2cdump - f - y 1 0x68" to view the values of all registers in the device
4. In debugging the serial port terminal, use "i2cget - f - y 1 0x68 0x75" to view the value of the device's 0x75 register
2. In debugging the serial port terminal, use "i2ctest - y 5" to scan the devices mounted on i2c1
3. In debugging the serial port terminal, use "i2cdump - f - y 5 0x68" to view the values of all registers in the device
4. In debugging the serial port terminal, use "i2cget - f - y 5 0x68 0x75" to view the value of the device's 0x75 register
CAN (Controller Area Network) is an efficient and reliable communication protocol used for real-time control and data exchange. It was originally developed by the German company BOSCH and has now become an international standard ISO 11898. The CAN bus adopts a multi master competitive bus structure, supporting multiple nodes to simultaneously send and receive data, with error detection and automatic retransmission functions, which can effectively improve the reliability and real-time performance of the system. CAN is widely used in fields such as automotive, industrial automation, and robotics, and is an indispensable part of modern electronic systems.
ifconfig -a
canconfig can0 down
canconfig can0 type can bitrate 1000000 dbitrate 3000000 on
canconfig can0 up
canconfig can0 start
//Or
canconfig can0 down
canconfig can0 type can bitrate 1000000 loopback on
canconfig can0 up
canconfig can0 start
cansend can0 -v -i 12 13 12 12
candump can0