⬆️ ⬇️

CHIP - $ 9 Raspberry Pi Killer

image

On Geektimes'ah already flew information about how a 9-dollar Linux computer collected more than $ 2,000,000 on a kickstarter. I also supported this project at the time of the fundraising and the other day my copy of this device flew to me



This computer is equipped with Allwinner R8 processor on the ARM architecture with a frequency of 1 GHz, 512 MB of RAM, 4 GB of internal flash-memory, and also has built-in Wi-Fi with support for b / g / n standards and on-board bluetooth 4.0. As interfaces, there are one USB port, a composite AV output for connecting to a TV or any display with support for composite video input, micro-USB for power supply and firmware for CHIP itself, a connector for connecting an external battery, and pads with GPIO ports. However, using the latter, you can connect additional HDMI or VGA adapters, which are purchased separately for $ 15 and $ 10, respectively

imageimage

There is also an extension PocketC.HIP, which allows you to make a mini-computer completely mobile, by connecting the battery and keyboard with a display.

image



The device flew packed in a paper envelope, inside which is a nice square cardboard box containing a mini-computer





And here is the contents of the box



')

My copy was supplied with a glamorous AV cable of pink color





And behind it stands a translucent body, covering the processor





It works all under the modification of Linux Debian as the OS, I note that the overall performance is not great. Bluetooth and Wi-Fi work perfectly, without any problems, the wireless keyboard and mouse from iMac were connected and connected to the Internet. With USB, too, no problems, flash drive, mouse, as well as the stick from the wireless Logitech F710 gamepad were determined and worked fine. By the way, as for the games, I tried to turn it into a miniature emulator of gaming platforms, installed the mednafen emulator, which supports many old gaming systems, and compiled the mednaffe GUI sources for it. Performance and quality can be seen in this video.





Well, for a snack, try to direct the ports of the GPIO, for example, we blink a LED through it. To do this, we connect an LED through a resistor of 100-200 ohm anode to the 5th output of the U13 pad and the cathode to the 13th output of the U14 pad as in the diagram





or how did i





All further actions can be performed directly on the device, and can be done remotely by connecting to the device via ssh. By default, the username and password of the chip are in the system, you just need to find out the IP address of the device.

ssh chip@192.168.1.109 


The PCF8574A controller is responsible for managing the I / O ports. It is controlled through manipulations with the / sys / class / gpio / gpio408 files, access to which is possible only from under the root, so you need to switch to it beforehand

 su 


Consider two ways to control, through the console and using the C program. So, we blink the LED from the console. Go to the directory / sys / class / gpio

 cd /sys/class/gpio 


Enable GPIO and enable port output

 echo 408 > export echo out > gpio408/direction 


Now we can set the value in the port by writing the values ​​in gpio408 / value

 echo 1 > gpio408/value #   echo 0 > gpio408/value #   


At the end, memorable to deactivate work with GPIO

 echo in > gpio408/direction echo 408 > unexport 


And now everything is the same, but in the C language. Create the projects directory in the home directory, and blink in it.

 cd ~/ mkdir projects cd projects mkdir blink cd blink 


Run the nano text editor and create a new file (ctrl + o) with the name main.c, so get syntax highlighting right away.

 nano 


And, actually, the listing program

 #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <unistd.h> int main() { int fd; //    GPIO fd = open("/sys/class/gpio/export", O_WRONLY); if (fd < 0) { return -1; } write(fd, "408", 3); close(fd); //     fd = open("/sys/class/gpio/gpio408/direction", O_RDWR); if (fd < 0) { return -1; } write(fd, "out", 4); close(fd); //       fd = open("/sys/class/gpio/gpio408/value", O_RDWR); if (fd < 0) { return -1; } int i; for (i = 0; i < 1000; ++i) { write(fd, "1", 2); sleep(3); write(fd, "0", 2); sleep(3); } //    GPIO fd = open("/sys/class/gpio/unexport", O_WRONLY); if (fd < 0) { return -1; } write(fd, "408", 3); close(fd); return 0; } 


Next, compile and run as root.

 gcc main.c -o blink ./blink 


This is the end of a small review of a small computer, although there are still a lot of opportunities. With its capabilities and such a low price, it turned out to be a solid competitor for the Raspberry Pi

Source: https://habr.com/ru/post/390917/



All Articles