PINE64 PinePhone (pine64-pinephone)



Find and report PinePhone related issues here. Join the chat if you have questions.



The PinePhone is a smartphone by PINE64. The postmarketOS vendor and device names are "pine64" and "pinephone" respectively. The back panel can be lifted off by pulling at the notch on the bottom-right corner of the phone. This exposes the battery, microSD and SIM slots, and DIP switches. It comes with a 3000mAh battery and uses the same form-factor as the Samsung Galaxy J7 (2015) for replacement.

The PinePhone will boot from a bootable microSD card if it is present otherwise it will fall back to booting from internal eMMC.

Contributors

 * MartijnBraam
 * z3ntu
 * bshah
 * ollieparanoid
 * (and many more!)

Installation
The recommended installation method is flashing a pre-built installer image to the SD card, as described in the Installation article.

Apparently for some users the touch screen does not work with the v22.12 installation image. If you are affected, please help tracking this down in. You can work around this by using a v22.06 installer image and upgrading to the latest release. Or by building your own image with pmbootstrap.

As of writing, CPU idle states are not entered when booting from eMMC on both v22.12 and edge, leading to fast battery drain. A workaround is installing to SD card. Help with resolving this is appreciated, see e.g. discussions in.

It is also possible to flash postmarketOS to the PinePhone with JumpDrive.

Serial console
The PinePhone has a serial port in the headphone connector, it's activated by the 6th contact on the DIP switch. If the switch is on then the headphone connector is in audio mode, if it's off then it's in UART mode.

The uart is 115200n8

The pinout for the serial connector on the headphone jack is:


 * Tip: RX
 * Ring: TX
 * Sleeve: GND

The serial connection is 3.3V

You can also buy the debug cable from PINE64 Store. The store cable uses a 4 ring plug, as seen in the PDF, but a 3 ring plug works just as well.



Hardware switches
There's a 6 contact DIP switch on the back of the phone underneath the back cover. The 6 switches are for enabling/disabling hardware components. The switch has tiny numbers 1-6 beneath the contacts, moving the contact up sets that contact on.

Expansion port
There is a 2x3 grid of pogo pins on the back of the PinePhone for connecting a back cover with extra hardware like an extended battery case or a keyboard case. The pinout for this connector:

The VBUS pin is powered by USB and is 5V. The second power pin is VBAT, which connects to the battery voltage. The I2C and interrupt lines have pull-ups on the phone side. The I2C lines are pulled up to 3V3 by the phone.

Cameras
Currently only the rear camera (OV5640) has mainline Linux support, a driver for the front camera (GC2145) is being developed in the kernel fork for the phone development.

Megapixels is the defacto camera program for the PinePhone, and supports both the front and rear cameras, autofocus for the rear camera, and postprocessing options to make the images better.

Another alternative is to use. The camera hardware pipeline is controlled with  and the result is on



Camera Flash
Please note, that the driver for the sgm3140 is not yet included in the main kernel source and as such is not available for use yet without compiling the module yourself.

The camera flash consist out of a SG Micro SGM3140 "500mA Buck/Boost Charge Pump LED Driver" and a EHP-C04 LED. It supports Flash and Torch mode, the first being brighter but only for 200-300ms, when it switches to Torch mode automatically. Torch mode is lower brightness but can be turned on continuously.

Controlling the flash from user space is possible via sysfs and via v4l2:

WiFi
The wifi uses the rtl8723cs driver and is functional. There is still an issue with the driver not reloading correctly when the SoC is put into suspend mode, this can be worked around by reloading the kernel module:

Bluetooth
Main article: Bluetooth.

The bluetooth connection is handled by the wifi chipset. It is functional but there is no integration in Plasma Mobile yet. To pair a bluetooth device start the bluetooth service and use bluetoothctl to connect.

To use bluetooth headphones with pulseaudio, the package  is required.

Modem
Receiving and sending text messages works, The calls work but there are some issues left with the audio routing. Mobile data is functional. For information on audio routing and setting up the modem in Phosh, see the specific article.

To bring up mobile data run the following commands (for plasma mobile):

Or use only modemmanager which integrates better with Phosh.

In order to connect to the serial console of the modem, you need a terminal application. One option is to use.

Connect to the console by issuing:

The command  returns OK:

The command  returns some version information from the modem:

The command  (Digital Audio Interface Configure) is used to configure the digital audio interface. returns the current configuration:

Some more details on how to configure the modem is available here. The reference for the available commands is the EC25 & EC21 AT Commands Manual.

VoLTE
The EG25 modem in the PinePhone comes preloaded with VoLTE profiles for a few providers. The modem can handle VoLTE fully internally so nothing complicated is required on the postmarketOS side. PostmarketOS tries to set the VoLTE profile automatically. If that fails it can also be set manually:

After this process VoLTE should be used when available. To check the status while in a call you can run the CLCC command:

The "1" in the 4th column on the second CLCC row means it's currently calling with VoLTE, when it's "0" it's calling over the legacy phone network.

GNSS/GPS
The Quectel EG25-G modem has a builtin GNSS receiver for GPS, GLONASS, Galileo and BeiDou. The default configuration on postmarketOS is to enable GPS and GLONASS as they work the best on the Quectel EG25-G when location services are needed.

When ModemManager is used with this modem, GeoClue will ask ModemManager to enable the GNSS receiver on demand. Only if a GeoClue client asks for a high accuracy position, GeoClue will make use of the GNSS receiver. In all other cases, GeoClue will use the WiFi/Cellular positioning together with Mozilla data.

You can use the  demo of GeoClue to play around with the GNSS receiver.

provides also a set of commands which allow you to manually enable/disable the GNSS receiver or print your location.

Sensors
All sensors work and are accessible as Industrial I/O (iio) devices in Linux. To query the data you can cat the files in `/sys/bus/iio/` to make the kernel module query the sensors

RGB Led
You may turn on and off the blue led by issuing:

Make sure you run these commands as root. For user, works but won't work.

Speakers
Sound output should work after unmuting

Start by making sure alsa-utils are installed:

You may use amixer, or alsamixer to unmute the required channels, and to control the volume:

Amixer:

Alsamixer (use terminal keyboard input to use up/down/left/right keys, to set volume and select devices):

Test the sound output by issuing:

USB Host (OTG)
For hardware revisions v1.0 and v1.1, USB OTG is broken and require soldering skills.

Since revision v1.2, USB OTG should works fine.

Changing the Clock Frequency
postmarketOS runs with a RAM clock of 528 MHz to be most compatible with all PinePhones. Some PinePhones support higher RAM clock frequencies, and if you know what you are doing you can change it by replacing 528 with 552 and even 624.

Find the frequency your PinePhone is currently running at in.

Details in. Author of the patches BobbyTheBuilder also made a side-by-side video.

Increasing eMMC speed (Vccq mod)
On PinePhone hardware revisions 1.0 to 1.2b, the eMMC speed is limited by the eMMC power supply voltage. A hardware modification can be performed to increase the eMMC read/write speed.

Here are the read speed improvement we have measured (your results may vary):
 * PinePhone 1.2 pmOS CE (convergence package) with 32GB SanDisk eMMC: before 55MB/s, after 125MB/s
 * PinePhone 1.0 Braveheart edition with 16GB Kimtigo eMMC: before: 80MB/s, after 110MB/s

You can measure the read speed of your eMMC (or microSD) by using, consider only the buffered disk reads result.

The PinePhone eMMC read speed (~50-80MB/s) is limited from the DDR52 timing used, while both the eMMC and A64 SoC support HS200 and HS400 speeds.

Every eMMC card has two power supplies:
 * Vcc powering the NAND storage inside the eMMC
 * Vccq powering the eMMC micro-controller and the MMC bus

You can use eMMC cards in High Speed mode (HS200/HS400) only by powering Vccq at 1.8V or 1.2V, in the PinePhone (1.0 to 1.2b) Vccq is powered at 3.3V.

The PinePhone mainboard can be modified to switch Vccq from 3.3V to 1.8V, making possible to use HS200 and HS400 modes.

Hardware modification steps
The R615 resistor is above the eMMC card, and the R614 footprint should be right above it. This configuration is persistent to kernel and U-Boot upgrades, but the package has to be installed again when reinstalling the system to eMMC.
 * Disassemble the PinePhone and remove the mainboard from the phone
 * Remove the metallic RF shield from the mainboard side with the A64 SoC visible at the center.
 * Locate R615 and R614 footprints with the help of the component placement drawing for your PP revision.
 * Desolder R615 0 ohm resistor and solder it to R614, or bridge R614 with solder.
 * Put back the metallic RF shield paying attention to the alignment
 * Reassemble the PinePhone
 * Reinstall PostmarketOS to the eMMC selecting the  as package to be installed during

If you boot your modified PinePhone without installing  first, your phone will freeze during boot, this is expected since the stock kernel Device Tree no longer corresponds to your PinePhone hardware (Vccq is now 1.8V instead of 3.3V).

You can recover a not booting eMMC installation by manually copying the  files, for example after installing the package on a microSD installation, with the help of Jumpdrive.

You can check the current eMMC timing mode and clock with:

Magnetometer
The magnetometer cannot be used on the 1.2b revision PinePhone which switched from the LIS3MDL used in older revisions to the AF8133J. The driver is present in the kernel but the device tree does not define it. See for more details.

Modem's SMS cache is full and cannot receive SMS
ModemManager may not process all SMS, which can lead to the SMS cache getting full and not receiving future SMS. See for instructions to clear the cache, and for details on how this is getting fixed.

Qt Based Browsers Not Loading Web Pages
Webkit sandbox is broken in the current build. In order to be able to use Qt based browsers it is necessary to create the file "/etc/profile.d/sandboxhack.sh" with the following contents: This sets an environment variable that kills the webkit sandbox because that's broken in the current build. This should be fixed already for the chromium musl build but not yet for all qtwebkit based browsers. This is being worked on here and here.

Boot related
If your PinePhone does not boot anymore with postmarketOS, first make sure that your battery is not (nearly) empty. Plug the charging cable, make sure it's completely turned off (i.e. no LED is glowing, screen is completely dark). If it is not completely off, then hold the power button until it is. Leave it in that state until the battery is charged for sure, then try again.

If that does not help it, plug a serial cable if you have one and look at the output. If you don't but have a suspicion of what it could be, you can try to replace the initramfs files and/or u-boot bootloader with the instructions below.

In any case, we try hard to make the phone not enter a state where it can't boot anymore after installing updates. If you see that happen and it's not related to battery being empty, please report in detail in. Mention which postmarketOS version you run (edge, or which stable release), and in detail what happens. Some users already reported that the osk-sdl keyboard for unlocking encrypted installations didn't work for them anymore (though that might be battery related? we couldn't reproduce it so far). Attaching the files from your /boot partition and is also very useful to help narrowing this down.

Fix broken boot partition
If postmarketOS gets stuck early in the booting process, it might fail to load u-boot / the kernel / initramfs / initramfs-extra. The exact cause can be determined over serial (remember to toggle the headphone killswitch for that), if initramfs-extra is corrupt, it will look like this for example: Extract /boot/initramfs-postmarketos-allwinner-extra gzip: unexpected end of file cpio: short read /init: line 233: parted: not found

Depending on the serial output, the solution is either to replace contents of the boot partition (as with the output above), or to replace u-boot (see further below).

You don't need a serial cable for either fix, the serial cable is only needed to figure out the exact cause.

Boot partition on eMMC

 * 1) Download the latest image from the same channel you are running (edge, v21.03, ...) (see above)
 * 2) Put it on your SD card
 * 3) Login via serial or SSH (user / 147147) (SSH works over USB too!)
 * 4) Replace contents of your boot partition:

Wait until it is powered off. Then remove the SD card and start your phone, your boot partition should be working again. Remember to switch the killswitch again if you want to use your audio jack for audio.

Boot partition on SD card

 * 1) Download the latest image from the same channel you are running (edge, v21.03, ...) (see above)
 * 2) Plug the SD card into your computer

Replace  with the first partition of your SD card (see  ).

postmarketOS installed to eMMC
If postmarketOS is installed to the eMMC, put another postmarketOS image on an SD card and run from there:

postmarketOS installed to SD
If postmarketOS is installed to an SD card:
 * Put it into the PinePhone or PC
 * Download  from here (replace master with e.g. v21.03 depending on the release you are running)
 * Extract the apk and  the u-boot file to the SD card (double-check you have the right device with  )

Failed to create boot/xxx: No space left on device
A bug has been observed where too many initramfs's are created. To fix, run the following commands to delete and regenerate all initramfs's.