Monday, June 24, 2019

Doom on the NanoPI



For one of my products I'm working with the NanoPI which is very similar to Raspberry PI but more powerful. It is developed by FriendlyElec and has a large family of boards. My board has the following specifications




  • CPU: Allwinner H3, Quad-core Cortex-A7@1.2GHz
  • GPU: Mali400MP2@600MHz,Supports OpenGL ES2.0
  • DDR3 RAM: 1GB
  • eMMC: 8GB
  • Wireless: 802.11 b/g/n
  • Bluetooth: 4.0 dual mode
  • Antenna Interface: Shared by WiFi and Bluetooth, IPX interface
  • Connectivity: 10/100/1000M Ethernet
  • Audio: 3.5mm jack/Via HDMI
  • Microphone: onboard microphone
  • IR: onboard IR receiver
  • USB Host: USB 2.0 x 3, 2 x USB Type A and 1 x 2.54mm pitch pin-header
  • MicroSD Slot: x1
  • MicroUSB: power input and data transmission, OTG
  • Audio Output: HDMI 1.4 1080P, CVBS
  • DVP Camera Interface: 24pin, 0.5mm pitch FPC seat
  • Serial Debug Port: 4Pin, 2.54mm pitch pin-header
  • GPIO: 40pin, 2.54mm pitch pin-header, compatible with RasberryPi 2's GPIO. It contains UART, SPI, I2C, I2S/PCM, SPDIF-OUT and IO
  • User Button: 1 x Power Button and 1 x Reset Button
  • LED: 1 x Power LED and 1 x System Status LED
  • PCB Dimension: 64 x 60 mm, ENIG
  • Power Supply: DC 5V/2A
  • OS/Software: u-boot, Debian, Ubuntu-MATE, Ubuntu-Core

Interestingly today the Raspberry Foundation announced the more powerful RaspberryPI 4 model B. It has some powerful features along with multiple RAM versions, the cost is similar to existing model. The base model costs $35 and upwards based on more RAM. Some of the new features include different RAM versions (LPDDR4) (1-4GB options), 4K video display over 2 micro hdmi slots, BT 5.0, 2 x USB 3.0 ports and USB type C power port.  It has the following specifications:


DOOM On NanoPI


NanoPI has a small form factor and is pretty fast. I've been running different experiments with it but one thing that I completely missed was to run Doom on it! So here are the steps if you want to run Doom on NanoPi 

Step 1: Install Dependencies 

 sudo apt-get install libsdl-mixer1.2-dev libsdl-net1.2-dev python-imaging

Step 2: Download Doom
wget https://www.chocolate-doom.org/downloads/2.2.1/chocolate-doom-2.2.1.tar.gz

Step 3: Extract Downloaded file

tar xzf chocolate-doom-2.2.1.tar.gz

Step 4: Configure and Make
cd chocolate-doom-2.2.1
./configure
make

Step 5: Install (This will take a few minutes)
sudo make install

Step 6: Download Doom Data WAD File
wget http://www.doomworld.com/3ddownloads/ports/shareware_doom_iwad.zip

Step 7: Unzip WAD

unzip shareware_doom-iwad.zip
In case you don't have unzip install it using:
sudo apt-get install unzip

Step 8: Run Doom Setup:

chocolate-doom-setup

Step 9: Run and Enjoy!
chocolate-doom -iwad DOOM1.WAD



Reference:
This post used content from https://www.makeuseof.com/tag/run-doom-raspberry-pi/

Thursday, June 13, 2019

Physical Port access for NanoPi using Python on Debian


There are two ways to access GPIOs easily on NanoPi.


  1. In C language using WiringNP which is a port of the WiringPi library written for the Raspberry PI's BCM2835. 
  2. In Python using RPi.GPIO_NP which is a port of the RPi.GPIO library for the Raspberry PI. The problem is that this python distribution is only integrated in the FriendlyCore OS images and is not available to be installed directly for python in other images like Debian using pip or pip3. So in order to run RPi.GPIO_NP library for debian distro for NanoPi here are the following steps:


Step 1: Download 

  • git clone https://github.com/chainsx/RPi.GPIO.NP
Step 2: Installation
  • sudo apt-get update
  • sudo apt-get install python-dev
  • cd RPi.GPIO.NP
  • python setup.py install
  • sudo python setup.py install
Step 3: Restart NanoPi

Step 4: Test
  • type python to open the CLI for python
  • >> import RPi.GPIO
  • >>
  • If there is no import error, the library has been successfully installed
Step 5: Test Program

#!/usr/bin/env python
import RPi.GPIO as GPIO
import time
PIN_NUM = 7
 
GPIO.setmode(GPIO.BOARD)
GPIO.setup(PIN_NUM,GPIO.OUT)
while True:
        GPIO.output(PIN_NUM,True)
        time.sleep(1)
        GPIO.output(PIN_NUM,False)
        time.sleep(1)

Pictures:





Links:
https://github.com/chainsx/RPi.GPIO.NP
https://github.com/auto3000/RPi.GPIO_NP