Quick jump:  What's new

 
Go to:
 
Weblog: Recent Changes   
in Dobrica Pavlinušić's random unstructured stuff
B3603


Similar boards

B3606

https://github.com/UsrnameTaken/B3606

D3806

I have unit, there is no alternative firmware for this model but there is for:

https://github.com/delboy711/BST900

https://www.falatic.com/index.php/161/minghe-buckboost-converters-handy-if-youre-careful

B3603

b3603-swim.jpg

working keys: https://github.com/nlitsme/b3603/network

https://hackaday.io/project/4362-power-supply-b3603-alternative-firmware

control_pinouts.png

Specification

Input voltage: 6V ~ 40V
Output voltage: 0V ~ 36V
Output current: 0A ~ 3A
Conversion efficiency: up to 92%
The output ripple: ≤50mV
Working temperature: -40°C ~ +85°C
Working frequency: 150KHz
Short circuit protection: constant current
Voltage regulation/display resolution: 0.01V
Current regulation/display resolution: 0.001A
The minimum display resolution of power: 0.001W
The minimum display resolution of capacity: 0.001AH
Input reverse connect protection: no, if necessary please install diode
Connection mode: terminals
Size: 66 x 50 x 21mm
Weight: 44g

backup existing flash

pi@rpi2 ~/stm8flash $ sudo ./stm8flash -c stlinkv2 -p stm8s003f3 -s eeprom -r b3606/eeprom.bin
action = 1Determine EEPROM area
Reading 128 bytes at 0x4000... OK
Bytes received: 128
pi@rpi2 ~/stm8flash $ sudo ./stm8flash -c stlinkv2 -p stm8s003f3 -s flash -r b3606/flash.bin
action = 1Determine FLASH area
Reading 8192 bytes at 0x8000... OK
Bytes received: 8192
pi@rpi2 ~/stm8flash $ sudo ./stm8flash -c stlinkv2 -p stm8s003f3 -s ram -r b3606/ram.bin
action = 1Determine RAM area
Reading 1024 bytes at 0x0... OK
Bytes received: 1024


unprotect stm8 using stm8flash

https://github.com/vdudouyt/stm8flash/issues/38#issuecomment-195123081

$ echo "00" | xxd -r -p >ROP_CLEAR.bin
$ stm8flash -c stlinkv2 -p stm8s103f3 -s opt -w ROP_CLEAR.bin 

compile

pi@rpi2 ~ $ git clone https://github.com/swegener/b3603
Cloning into 'b3603'...
remote: Counting objects: 1109, done.
remote: Total 1109 (delta 0), reused 0 (delta 0), pack-reus
Receiving objects: 100% (1109/1109), 11.04 MiB | 2.90 MiB/s
Resolving deltas: 100% (770/770), done.
Checking connectivity... done.


pi@rpi2 ~/b3603/stm8 $ sudo apt-get install sdcc


pi@rpi2 ~/b3603/stm8 $ make

Code fits the flash, it is 7930

dpavlin@nuc:/nuc/b3603/stm8$ uname -a
Linux nuc 4.4.0-1-amd64 #1 SMP Debian 4.4.6-1 (2016-03-17) x86_64 GNU/Linux
dpavlin@nuc:/nuc/b3603/stm8$ sdcc -v
SDCC : mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ds390/TININative/ds400/hc08/s08/stm8 3.5.0 #9253 (Mar 21 2016) (Linux)
published under GNU General Public License (GPL)

dpavlin@nuc:/nuc/b3603/stm8$ scp b3603.ihx rpi2:stm8flash/






flash

pi@rpi2 ~/stm8flash $ sudo ./stm8flash -c stlinkv2 -p stm8s003f3 -w ./b3603.ihx 
action = 2Determine FLASH area
Writing Intel hex file 8160 bytes at 0x8000... Tries exceeded

# unprotect flash

pi@rpi2 ~/stm8flash $ echo "00" | xxd -r -p >ROP_CLEAR.bin
pi@rpi2 ~/stm8flash $ sudo ./stm8flash -c stlinkv2 -p stm8s003f3 -s opt -w ROP_CLEAR.bin 
action = 2Determine OPT area
Writing binary file 1 bytes at 0x4800... OK
Bytes written: 1

# 




serial

dpavlin@x200:/x200/stm8$ microcom -p /dev/ttyUSB0 -s 38400
connected to /dev/ttyUSB0
Escape character: Ctrl-\
Type the escape character followed by c to get to the menu or q to quit

B3603 starting: Version 1.0.1

pi@rpi2 ~/b3603/stm8 $ cat ~/b3603.sh
#!/bin/sh -x

microcom -s 38400 -p /dev/serial/by-path/platform-3f980000.usb-usb-0\:1.5.1\:1.0-port0

calibrate

dpavlin@cubieboard:/mnt/nuc/b3603/stm8$ git diff ./calibrate.py
diff --git a/stm8/calibrate.py b/stm8/calibrate.py
index f94f866..313e1f6 100755
--- a/stm8/calibrate.py
+++ b/stm8/calibrate.py
@@ -153,7 +153,8 @@ class Multimeter(object):
         return self._sample() != None
 
     def _sample(self):
-        p = os.popen('sigrok-cli -d %s:conn=%s --samples 1' % (self.model, self.portname))
+        print('## sigrok-cli -d %s:conn=%s --samples 1' % (self.model, self.portname))
+        p = os.popen('sigrok-cli -d %s:conn=%s --samples 1 -O analog' % (self.model, self.portname))
         s = p.read()
         p.close()
         return float(s.split(' ')[1])
@@ -214,9 +215,9 @@ def calibration_voltage(auto):
         return
 
     if auto == True:
-        dmm = Multimeter(sys.argv[3], sys.argv[4])
+        dmm = Multimeter(sys.argv[4], sys.argv[5])
         if not dmm.open():
-            print 'Failed to open serial port to multimeter on serial %s model %s' % (sys.argv[3], sys.argv[4])
+            print 'Failed to open serial port to multimeter on serial %s model %s' % (sys.argv[4], sys.argv[5])
             psu.close()
             return



dpavlin@cubieboard:/mnt/nuc/b3603/stm8$ ./calibrate.py -a voltage /dev/ttyUSB0 /dev/ttyUSB1 uni-t-ut61e-s
er
OPEN "M: B3603"
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
PSU Input voltage is 11305.0 mV, will use 10 steps between 10 mV and 4000 mV
0 . Setting voltage to 10 mV
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
Multimeter samples vary too much, stddev=0.244349, data: [1.2358, 0.8785, 0.6413]
Failed to read stable value, trying again, maybe
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
Step 0 Set voltage 10.000000 mV Read voltage 0.273667 mV PWM 114.0 ADC 132.0 (0.149)
1 . Setting voltage to 409 mV
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
Step 1 Set voltage 409.000000 mV Read voltage 0.403467 mV PWM 185.0 ADC 172.0 (0.377)
2 . Setting voltage to 808 mV
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
Step 2 Set voltage 808.000000 mV Read voltage 0.807800 mV PWM 257.0 ADC 244.0 (0.772)
3 . Setting voltage to 1207 mV
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
Step 3 Set voltage 1207.000000 mV Read voltage 1.212667 mV PWM 329.0 ADC 316.0 (1.179)
4 . Setting voltage to 1606 mV
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
Step 4 Set voltage 1606.000000 mV Read voltage 1.617200 mV PWM 401.0 ADC 387.0 (1.574)
5 . Setting voltage to 2005 mV
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
Step 5 Set voltage 2005.000000 mV Read voltage 2.022333 mV PWM 473.0 ADC 459.0 (1.975)
6 . Setting voltage to 2404 mV
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
Step 6 Set voltage 2404.000000 mV Read voltage 2.425333 mV PWM 545.0 ADC 531.0 (2.376)
7 . Setting voltage to 2803 mV
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
Step 7 Set voltage 2803.000000 mV Read voltage 2.829333 mV PWM 617.0 ADC 603.0 (2.782)
8 . Setting voltage to 3202 mV
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
Step 8 Set voltage 3202.000000 mV Read voltage 3.232000 mV PWM 689.0 ADC 675.0 (3.178)
9 . Setting voltage to 3601 mV
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
## sigrok-cli -d uni-t-ut61e-ser:conn=/dev/ttyUSB1 --samples 1
Step 9 Set voltage 3601.000000 mV Read voltage 3.635667 mV PWM 761.0 ADC 747.0 (3.579)
['OK', '']
ADC
(0.005373500905021045, -0.8923354860819778) 352 58480
['OK', '']
PWM
(179.88709677419354, 185.25806451612908) 11789080 12141072
['OK', '']

permalink
INA3221
root@cubieboard:/home/dpavlin# modinfo ina3221
filename:       /lib/modules/4.19.25-sunxi/kernel/drivers/hwmon/ina3221.ko
license:        GPL v2
description:    Texas Instruments INA3221 HWMon Driver
author:         Andrew F. Davis <afd@ti.com>
alias:          of:N*T*Cti,ina3221C*
alias:          of:N*T*Cti,ina3221
alias:          i2c:ina3221
depends:
intree:         Y
name:           ina3221
vermagic:       4.19.25-sunxi SMP mod_unload ARMv7 thumb2 p2v8

root@cubieboard:/home/dpavlin# i2cdetect -y 2
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: 40 -- -- -- -- -- -- -- UU -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         

root@cubieboard:/home/dpavlin# echo ina3221 0x40 > /sys/bus/i2c/devices/i2c-2/new_device 
[Sun May 12 14:23:20 2019] i2c i2c-2: new_device: Instantiated device ina3221 at 0x40

root@cubieboard:/home/dpavlin# sensors
pcf8591-i2c-2-48
Adapter: mv64xxx_i2c adapter
in0:          +2.13 V  
in1:          +2.55 V  
in2:          +0.01 V  
in3:          +1.32 V  

ina3221-i2c-2-40
Adapter: mv64xxx_i2c adapter
in1:          +0.02 V  
in2:          +0.02 V  
in3:          +0.02 V  
in4:          +0.00 V  
in5:          +0.00 V  
in6:          +0.00 V  
curr1:        +0.00 A  (max = +16.38 A, crit max = +16.38 A)
curr2:        +0.00 A  (max = +16.38 A, crit max = +16.38 A)
curr3:        +0.00 A  (max = +16.38 A, crit max = +16.38 A)

# setup correct resistors:

root@cubieboard:/home/dpavlin# grep -A 2 ina3221 /etc/rc.local
echo ina3221 0x40 > /sys/bus/i2c/devices/i2c-2/new_device
sleep 1
ls /sys/devices/platform/soc/*.i2c/i2c-2/2-0040/hwmon/hwmon1/shunt*_resistor | xargs -i sh -cx 'echo 100000 > {}'


permalink
Nexus 5

PostmarketOS

https://wiki.postmarketos.org/wiki/Google_Nexus_5_(lg-hammerhead)

dpavlin@klin:/klin/postmarketos$ git clone https://gitlab.com/postmarketOS/pmbootstrap
dpavlin@klin:/klin/postmarketos$ cd pmbootstrap/

dpavlin@klin:/klin/postmarketos/pmbootstrap$ ./pmbootstrap.py init

#

./pmbootstrap.py install --no-fde


permalink
CubieBoard
cubieboard_schematic_2012-08-08.pdf

BreadBoard V1.0 03-25 For CubieBoard.pdf

Contents: [Dobrica Pavlinušić's random unstructured stuff]


A20

Running UBI/UBIFS on MLC NAND

NAND in mainline kernel

Samsung K9GBG08U0A NAND

dpavlin@cubieboard:~$ dmesg | grep -A 5 nand
[    4.395437] nand: Could not find valid JEDEC parameter page; aborting
[    4.401898] nand: device found, Manufacturer ID: 0xec, Chip ID: 0xd7
[    4.408272] nand: Samsung NAND 4GiB 3,3V 8-bit
[    4.412719] nand: 4096 MiB, MLC, erase size: 1024 KiB, page size: 8192, OOB size: 640
[    4.421299] Bad block table found at page 524160, version 0x25
[    4.427987] Bad block table found at page 524032, version 0x25
[    4.434238] nand_read_bbt: bad block at 0x000001000000
[    4.439379] nand_read_bbt: bad block at 0x000001100000
[    4.445411] 6 ofpart partitions found on MTD device 1c03000.nand
[    4.451420] Creating 6 MTD partitions on "1c03000.nand":
[    4.456769] 0x000000a00000-0x0001ffa00000 : "rootfs"
[    4.461737] mtd: partition "rootfs" extends beyond the end of device "1c03000.nand" -- size truncated to 0xff600000
[    4.472910] 0x000001000000-0x000001400000 : "env"
[    4.477926] 0x000000c00000-0x000001000000 : "U-Boot.backup"
[    4.483748] 0x000000800000-0x000000c00000 : "U-Boot"
[    4.488997] 0x000000400000-0x000000800000 : "SPL.backup"
[    4.494580] 0x000000000000-0x000000400000 : "SPL"



dpavlin@cubieboard2:~$ dmesg | grep -A 5 nand
[    4.709427] nand: device found, Manufacturer ID: 0xad, Chip ID: 0xd7
[    4.715876] nand: Hynix H27UBG8T2BTR-BC 32G 3.3V 8-bit
[    4.721021] nand: 4096 MiB, MLC, erase size: 2048 KiB, page size: 8192, OOB size: 640
[    4.728997] Scanning device for bad blocks
[    8.484659] 6 ofpart partitions found on MTD device 1c03000.nand
[    8.490678] Creating 6 MTD partitions on "1c03000.nand":
[    8.496021] 0x000000a00000-0x0001ffa00000 : "rootfs"
[    8.500992] mtd: partition "rootfs" extends beyond the end of device "1c03000.nand" -- size truncated to 0xff600000
[    8.515527] 0x000001000000-0x000001400000 : "env"
[    8.520564] 0x000000c00000-0x000001000000 : "U-Boot.backup"
[    8.526504] 0x000000800000-0x000000c00000 : "U-Boot"
[    8.531755] 0x000000400000-0x000000800000 : "SPL.backup"
[    8.537395] 0x000000000000-0x000000400000 : "SPL"

many bad blocks

http://linux-sunxi.org/Mainline_NAND_Howto#Many_bad_blocks

To fix many bad blocks issue you should:

1. Disable nand-on-flash-bbt in your dts
2. Remove this test: http://lxr.free-electrons.com/source/drivers/mtd/nand/nand_base.c?v=4.7#L2940
3. Boot your new kernel and erase chip with flash_erase /dev/mtd[0-X]
4. Re-introduce the bad block check removed in 2, re-enable nand-on-flash-bbt
   and boot the new kernel

Let's try to do this with armbian.

cubieboard

First, enable nand overlay

dpavlin@cubieboard:~$ cat /boot/armbianEnv.txt
overlays=nand

Then remove nand-om-flash-btt:

dpavlin@cubieboard:/$ cd /boot/dtb-`uname -r`/overlay
dpavlin@cubieboard:/boot/dtb-4.14.23-sunxi/overlay$ 

# backup original
root@cubieboard:/boot/dtb-4.14.23-sunxi/overlay# cp sun4i-a10-nand.dtbo sun4i-a10-nand.dtbo.orig

# remote nand-on-flash-bbt
root@cubieboard:/boot/dtb-4.14.23-sunxi/overlay# dtc -I dtb -O dts sun4i-a10-nand.dtbo | grep -v nand-on-flash-bbt > /tmp/nand.dts
root@cubieboard:/boot/dtb-4.14.23-sunxi/overlay# dtc -I dts -O dtb /tmp/nand.dts > sun4i-a10-nand.dtbo

Compile armbian kernel with this patch applied

dpavlin@armbian:~/build$ cp ./patch/kernel/sunxi-dev/nand-disable-badblock-check-for-migration.patch.disabled \
    ./userpatches/kernel/sunxi-next/nand-disable-badblock-check-for-migration.patch

Reboot and check that nand is available:

dpavlin@cubieboard:~$ dmesg | grep -A 8 MTD
[   13.696198] 6 ofpart partitions found on MTD device 1c03000.nand
[   13.702205] Creating 6 MTD partitions on "1c03000.nand":
[   13.707550] 0x000000a00000-0x0001ffa00000 : "rootfs"
[   13.712517] mtd: partition "rootfs" extends beyond the end of device "1c03000.nand" -- size truncated to 0xff600000
[   13.723693] 0x000001000000-0x000001400000 : "env"
[   13.728713] 0x000000c00000-0x000001000000 : "U-Boot.backup"
[   13.734568] 0x000000800000-0x000000c00000 : "U-Boot"
[   13.739778] 0x000000400000-0x000000800000 : "SPL.backup"
[   13.745368] 0x000000000000-0x000000400000 : "SPL"
[   13.751476] sun4i-mdio 1c0b080.mdio: 1c0b080.mdio supply phy not found, using dummy regulator

Now init nand:

root@cubieboard:~# mtd_debug info /dev/mtd0
mtd.type = MTD_MLCNANDFLASH
mtd.flags = MTD_CAP_NANDFLASH
mtd.size = 4284481536 (3G)
mtd.erasesize = 1048576 (1M)
mtd.writesize = 8192 (8K)
mtd.oobsize = 640 
regions = 0


root@cubieboard2:~# mtd_debug info /dev/mtd0
mtd.type = MTD_MLCNANDFLASH
mtd.flags = MTD_CAP_NANDFLASH
mtd.size = 4284481536 (3G)
mtd.erasesize = 2097152 (2M)
mtd.writesize = 8192 (8K)
mtd.oobsize = 640 
regions = 0

root@cubieboard:/home/dpavlin# flash_erase /dev/mtd0 0 0
Erasing 1024 Kibyte @ 600000 --  0 % complete libmtd: error!: MEMERASE64 ioctl failed for eraseblock 6 (mtd0)
        error 5 (Input/output error)
flash_erase: error!: /dev/mtd0: MTD Erase failure
             error 5 (Input/output error)
Erasing 1024 Kibyte @ 700000 --  0 % complete libmtd: error!: MEMERASE64 ioctl failed for eraseblock 7 (mtd0)
        error 5 (Input/output error)
flash_erase: error!: /dev/mtd0: MTD Erase failure
             error 5 (Input/output error)
Erasing 1024 Kibyte @ ff500000 -- 100 % complete 


root@cubieboard:/home/dpavlin# ubiformat /dev/mtd0
ubiformat: mtd0 (mlc-nand), size 4284481536 bytes (4.0 GiB), 4086 eraseblocks of 1048576 bytes (1024.0 KiB), min. I/O size 8192 bytes
libscan: scanning eraseblock 4085 -- 100 % complete  
ubiformat: 4084 eraseblocks are supposedly empty
ubiformat: warning!: 2 of 4086 eraseblocks contain non-UBI data
ubiformat: continue? (y/N) y
ubiformat: warning!: only 0 of 4086 eraseblocks have valid erase counter
ubiformat: erase counter 0 will be used for all eraseblocks
ubiformat: note, arbitrary erase counter value may be specified using -e option
ubiformat: continue? (y/N) y
ubiformat: use erase counter 0 for all eraseblocks
ubiformat: formatting eraseblock 6 --  0 % complete  libmtd: error!: MEMERASE64 ioctl failed for eraseblock 6 (mtd0)
        error 5 (Input/output error)

ubiformat: error!: failed to erase eraseblock 6
           error 5 (Input/output error)
ubiformat: mark it as bad? (y/N) y
ubiformat: marking block 6 bad
ubiformat: formatting eraseblock 7 --  0 % complete  libmtd: error!: MEMERASE64 ioctl failed for eraseblock 7 (mtd0)
        error 5 (Input/output error)

ubiformat: error!: failed to erase eraseblock 7
           error 5 (Input/output error)
ubiformat: mark it as bad? (y/N) y
ubiformat: marking block 7 bad
ubiformat: formatting eraseblock 4085 -- 100 % complete  




ubiattach -p /dev/mtd0

ubimkvol /dev/ubi0 -s 2GiB -N root

mount /dev/ubi0_0 /mnt/ -t ubifs

root@cubieboard:~# mount /dev/ubi0_0 /mnt/ -t ubifs
[Wed Feb 28 17:49:38 2018] UBIFS error (pid: 4709): cannot open "/dev/ubi0:root", error -22
[Wed Feb 28 17:49:43 2018] UBIFS (ubi0:0): background thread "ubifs_bgt0_0" started, PID 4722
[Wed Feb 28 17:49:44 2018] UBIFS (ubi0:0): UBIFS: mounted UBI device 0, volume 0, name "root"
[Wed Feb 28 17:49:44 2018] UBIFS (ubi0:0): LEB size: 1032192 bytes (1008 KiB), min./max. I/O unit sizes: 8192 bytes/8192 bytes
[Wed Feb 28 17:49:44 2018] UBIFS (ubi0:0): FS size: 2137669632 bytes (2038 MiB, 2071 LEBs), journal size 33030144 bytes (31 MiB, 32 LEBs)
[Wed Feb 28 17:49:44 2018] UBIFS (ubi0:0): reserved for root: 4952683 bytes (4836 KiB)
[Wed Feb 28 17:49:44 2018] UBIFS (ubi0:0): media format: w5/r0 (latest is w5/r0), UUID 8E9A30F0-241F-4013-916F-C0B995F22BB1, small LPT model


cubieboard2

This is mostly redundant from cubieboard, but with attempt to define mtd partitions correctly

root@cubieboard2:/home/dpavlin# ubiformat /dev/mtd0
ubiformat: mtd0 (mlc-nand), size 4273995776 bytes (4.0 GiB), 2038 eraseblocks of 2097152 bytes (2.0 MiB), min. I/O size 8192 bytes
libscan: scanning eraseblock 2037 -- 100 % complete  
ubiformat: 2038 eraseblocks have valid erase counter, mean value is 1
ubiformat: formatting eraseblock 2037 -- 100 % complete  



mount ubifs filesystem

dpavlin@cubieboard:~$ grep ubi /mnt/boot/armbianEnv.txt
rootdev=ubi0:root ubi.mtd=0
rootfstype=ubifs

dpavlin@cubieboard:~$ grep ubi /etc/fstab 
ubi0:root / ubifs defaults,noatime,nodiratime 0 1

u-boot

Original u-boot output

HELLO! BOOT0 is starting!
boot0 version : 1.5.1
dram size =1024
Succeed in opening nand flash.
Succeed in reading Boot1 file head.
The size of Boot1 is 0x0003c000.
The file stored in 0X00000000 of block 2 is perfect.
Check is correct.
Ready to disable icache.
Succeed in loading Boot1.
Jump to Boot1.
[       0.133] boot1 version : 1.4.0
[       0.133] pmu type = 3
[       0.134] bat vol = 0
[       0.161] axi:ahb:apb=3:2:2
[       0.161] set dcdc2=1400, clock=1008 successed
[       0.163] key
[       0.175] no key found
[       0.175] flash init start
[       4.051] flash init finish
[       4.052] fs init ok
[       4.053] fattype FAT16
[       4.053] fs mount ok
[       4.060] script finish
[       4.061] power finish
[       4.069] BootMain start
[       4.069] 13
[       4.089] key value = 0
[       4.089] recovery key high 6, low 4
[       4.090] unable to find fastboot_key key_max value
[       4.098] test for multi os boot with display
[       4.100] show pic finish
[       4.103] load kernel start
[       4.127] load kernel successed
[       4.127] start address = 0x4a00000

U-Boot 2011.09-rc1 (Nov 26 2012 - 14:01:52) Allwinner Technology 

CPU:   SUNXI Family
Board: A10-EVB
DRAM:  512 MiB
NAND:  3776 MiB
In:    serial
Out:   serial
Err:   serial
--------fastboot partitions--------
-total partitions:11-
-name-        -start-       -size-      
bootloader  : 1000000       1000000     
env         : 2000000       1000000     
boot        : 3000000       2000000     
system      : 5000000       14000000    
data        : 19000000      20000000    
misc        : 39000000      1000000     
recovery    : 3a000000      2000000     
cache       : 3c000000      8000000     
private     : 44000000      1000000     
sysrecovery : 45000000      14000000    
UDISK       : 59000000      93000000    
-----------------------------------
Hit any key to stop autoboot:  0 
sunxi#

compile with nand support

On Cubieboard2 with those patches we get:

=> nand info

Device 0: nand0, sector size 2048 KiB
  Page size       8192 b
  OOB size         640 b
  Erase size   2097152 b
  subpagesize     8192 b
  options     0x00001000
  bbt options 0x00070000

# which comparted to booted linux kernel with mtd support....

root@cubieboard2:~# mtd_debug info /dev/mtd0
mtd.type = MTD_MLCNANDFLASH
mtd.flags = MTD_CAP_NANDFLASH
mtd.size = 4284481536 (3G)
mtd.erasesize = 2097152 (2M)
mtd.writesize = 8192 (8K)
mtd.oobsize = 640 
regions = 0

# it looks somewhat OK, but mtdparts doesn't (yet) return anything.

Another day, another try to get mtdparts to display something...

root@armbian:~/build/cache/sources/u-boot/v2017.11# grep -i mtd .config
CONFIG_SPL_MTD_SUPPORT=y
CONFIG_CMD_MTDPARTS=y
CONFIG_MTDIDS_DEFAULT="nand0=sunxi-nand"
CONFIG_MTDPARTS_DEFAULT="mtdparts=sunxi-nand:4m(spl),4m(spl-backup),4m(uboot),4m(uboot-backup),4m(env),-(UBI)"
# CONFIG_CMD_MTDPARTS_SPREAD is not set
# MTD Support
CONFIG_MTD=y
# CONFIG_MTD_NOR_FLASH is not set
CONFIG_MTD_UBI=y
CONFIG_MTD_UBI_WL_THRESHOLD=4096
CONFIG_MTD_UBI_BEB_LIMIT=20
# CONFIG_MTD_UBI_FASTMAP is not set

=> mtdparts

device nand0 <sunxi-nand>, # parts = 6
 #: name                size            offset          mask_flags
 0: spl                 0x00400000      0x00000000      0
 1: spl-backup          0x00400000      0x00400000      0
 2: uboot               0x00400000      0x00800000      0
 3: uboot-backup        0x00400000      0x00c00000      0
 4: env                 0x00400000      0x01000000      0
 5: UBI                 0xfec00000      0x01400000      0

active partition: nand0,0 - (spl) 0x00400000 @ 0x00000000

defaults:
mtdids  : nand0=sunxi-nand
mtdparts: mtdparts=sunxi-nand:4m(spl),4m(spl-backup),4m(uboot),4m(uboot-backup),4m(env),-(UBI)







Instructions after this are hit-or-miss...

dpavlin@klin:/klin/u-boot$ cp configs/Cubieboard_defconfig .config

# add NAND, MTD options, A10 for cubieboard1

# compile while defining flash:

dpavlin@klin:/klin/u-boot$ cat build-cubieboard.sh 
# parametars are probably wrong for your chip!
make V=1 CONFIG_NAND_SUNXI_SPL_ECC_STRENGTH=40 CONFIG_SYS_NAND_PAGE_SIZE=4036 CONFIG_SYS_NAND_OOBSIZE=640 CONFIG_SYS_NAND_BLOCK_SIZE=0x100000


dpavlin@cubieboard:~$ scp 10.60.0.92:/klin/u-boot/u-boot*spl* .

dpavlin@cubieboard:~$ sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/mmcblk0 bs=1024 seek=8 
488+1 records in
488+1 records out
500154 bytes (500 kB) copied, 0.0423498 s, 11.8 MB/s


It would be better to define params in u-boot config file like:

CONFIG_SYS_EXTRA_OPTIONS="SYS_NAND_BLOCK_SIZE=0x40000,SYS_NAND_PAGE_SIZE=4096,SYS_NAND_OOBSIZE=256"

(with correct values of course).

pinout

U14 (Next to SATA connector)

  SPI0
48 PI13 (SPI0-MISO/UART6-RX/EINT25) 47 PI11 (SPI0-CLK/UART5-RX/EINT23)
46 PI12 (SPI0-MOSI/UART6-TX/EINT24) 45 PI10 (SPI0-CS/UART5-TX/EINT22)
  LCD
44 3.3V (nc in 2012-08-08) 43 VCC-5V
42 Ground 41 SPDIF
40 PB10 (LCD0-SCK/LCD-PIO1) 39 PB11 (LCD0-SDA/LCD-PIO2)
38 Ground 37 PH7 (LCD0-BL-EN/LCD-PIO0/UART5-RX/EINT7)
36 XN_TP (TP-X2) 35 YN_TP (TP-Y2)
34 XP_TP (TP-X1) 33 YP_TP (TP-Y1)
32 PD25 (LCDDE) 31 PB2 (PWM0)
30 PD26 (LCDHSYNC)-VGA-HSYNC 29 PD24 (LCDCLK)
28 PD23 (LCDD23) 27 PD27 (LCDVSYNC)-VGA-VSYNC
26 PD21 (LCDD21) 25 PD22 (LCDD22)
24 PD19 (LCDD19/LVDS1N3) 23 PD20 (LCDD20)
22 PD17 (LCDD17/LVDS1NC) 21 PD18 (LCDD18/LVDS1P3)
20 Ground 19 PD16 (LCDD16/LVDS1PC)
18 PD14 (LCDD14/LVDS1P2) 17 PD15 (LCDD15/LVDS1N2)
16 PD12 (LCDD12/LVDS1P1) 15 PD13 (LCDD13/LVDS1N1)
14 PD10 (LCDD10/LVDS1P0) 13 PD11 (LCDD11/LVDS1N0)
12 PD8 (LCDD8/LVDS0P3) 11 PD9 (LCDD9/LVDS0N3)
10 PD7 (LCDD7/LVDS0NC) 9 Ground
8 PD5 (LCDD5/LVDS0N2) 7 PD6 (LCDD6/LVDS0PC)
6 PD3 (LCDD3/LVDS0N1) 5 PD4 (LCDD4/LNVS0P2)
4 PD1 (LCDD1/LVDS0N0) 3 PD2 (LCDD2/LVDS0P1)
2 Ground 1 PD0 (LCDD0/LVDSP0)

U15 (Between Ethernet port and USB ports)

  CSI1/TS
1 VCC-5V 2 PH15 (CSI1-PWR/EINT15)
3 CSI1-IO-2V8 4 PH14 (CSI1-RST#/EINT14)
5 PG0 (CSI1-PCLK/SDC1-CMD) 6 PB18 (TWI1-SCK)
7 PB19 (TWI1-SDA) 8 PG3 (CSI1-VSYNC/SDC1-D1)
9 PG2 (CSI1-HSYNC/SDC1-D0) 10 PG1 (CSI1-MCLK/SDC1-CLK)
11 PG4 (CSI1-D0/SDC1-D2) 12 PG5 (CSI1-D1/SDC1-D3)
13 PG6 (CSI1-D2/UART3-TX) 14 PG7 (CSI1-D3/UART3-RX
15 PG8 (CSI1-D4/UART3-RTS) 16 PG9 (CSI1-D5/UART3-CTS)
17 PG10 (CSI1-D6/UART4-TX) 18 PG11 (CSI1-D7/UART4-RX)
19 Ground 20 Ground
  Analog SDIO3
21 FMINL 22 PI4 (SDC3-CMD)
23 FMINR 24 PI5 (SDC3-CLK)
25 Ground 26 PI6 (SDC3-D0)
27 VGA-R 28 PI7 (SDC3-D1)
29 VGA-G 30 PI8 (SDC3-D2)
31 VGA-B 32 PI9 (SDC3-D3)
  CSI0/TS
33 LCD1-VSYNC 34 PE4 (CSI0-D0)
35 LCD1-HSYNC 36 PE5 (CSI0-D1)
37 Ground 38 PE6 (CSI0-D2)
39 AVCC 40 PE7 (CSI0-D3)
41 LRADC0 42 PE8 (CSI0-D4)
43 CVBS 44 PE9 (CSI0-D5)
45 HPL 46 PE10 (CSI0-D6)
47 HPR 48 PE11 (CSI0-D7)


everything below line is for legacy kernel and quite old

disk speed

NAND

root@cubieboard2:/home/dpavlin# uname -a
Linux cubieboard2 3.4.109-sun7i #4 SMP PREEMPT Sun Oct 11 14:32:15 CEST 2015 armv7l GNU/Linux
root@cubieboard2:/home/dpavlin# hdparm -t /dev/nand

/dev/nand:
 Timing buffered disk reads:  32 MB in  3.22 seconds =   9.94 MB/sec

# this is different, faster sdcard
root@cubieboard2:~# uname -a
Linux cubieboard2 4.3.3-sunxi #3 SMP Mon Dec 28 11:27:16 CET 2015 armv7l GNU/Linux
root@cubieboard2:~# hdparm -tT /dev/mmcblk0

/dev/mmcblk0:
 Timing cached reads:   770 MB in  2.00 seconds = 384.59 MB/sec
 Timing buffered disk reads:  60 MB in  3.05 seconds =  19.67 MB/sec



SATA

Powered by 2A Nexus 7 power supply (for SATA)

https://groups.google.com/d/searchin/cubieboard/sata/cubieboard/hKJgJneGVmQ/xme3w4Y7XtsJ?fromplusone=1

root@debian:~/sunxi-tools# ./bin2fex /boot/script.bin script.fex
fexc-bin: /boot/script.bin: version: 0.1.2
fexc-bin: /boot/script.bin: size: 42144 (76 sections)

root@debian:~/sunxi-tools# cp script.fex script+sata.fex

root@debian:~/sunxi-tools# diff -urw script.fex script+sata.fex 
--- script.fex  2013-05-30 10:41:13.979510762 +0000
+++ script+sata.fex     2013-05-30 10:42:36.380244101 +0000
@@ -595,7 +595,7 @@
 
 [sata_para]
 sata_used = 1
-sata_power_en =
+sata_power_en = port:PB08<1><default><default><0>
 
 [mmc0_para]
 sdc_used = 1

root@debian:~/sunxi-tools# ./fex2bin script+sata.fex /boot/script.bin

root@debian:/etc# git diff
diff --git a/modules b/modules
index d8894c3..9e65a80 100644
--- a/modules
+++ b/modules
@@ -4,3 +4,4 @@
 # at boot time, one per line. Lines beginning with "#" are ignored.
 # Parameters can be specified after the module name.
 
+sw_ahci_platform

Reboot to activate changes and test speed (using 80G intel SSD to have sense of maximum performance)

root@debian:~# hdparm -i /dev/sda

/dev/sda:

 Model=INTEL SSDSA2M080G2GC, FwRev=2CV102HD, SerialNo=CVPO035101VN080JGN
 Config={ Fixed }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=0
 BuffType=unknown, BuffSize=unknown, MaxMultSect=16, MultSect=1
 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=156301488
 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio3 pio4 
 DMA modes:  mdma0 mdma1 mdma2 
 UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6 
 AdvancedPM=no WriteCache=enabled
 Drive conforms to: ATA/ATAPI-7 T13 1532D revision 1:  ATA/ATAPI-2,3,4,5,6,7

 * signifies the current active mode

root@debian:~# hdparm -tT /dev/sda

/dev/sda:
 Timing cached reads:   784 MB in  2.00 seconds = 392.08 MB/sec
 Timing buffered disk reads: 460 MB in  3.00 seconds = 153.32 MB/sec

And test with disk:

root@debian:~# hdparm -i /dev/sda

/dev/sda:

 Model=ST96812AS, FwRev=7.24, SerialNo=3PJ1GCKE
 Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs RotSpdTol>.5% }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4
 BuffType=unknown, BuffSize=8192kB, MaxMultSect=16, MultSect=off
 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=117231408
 IORDY=on/off, tPIO={min:240,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio1 pio2 pio3 pio4 
 DMA modes:  mdma0 mdma1 mdma2 
 UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5 
 AdvancedPM=yes: unknown setting WriteCache=enabled
 Drive conforms to: Unspecified:  ATA/ATAPI-1,2,3,4,5,6,7

 * signifies the current active mode

root@debian:~# hdparm -tT /dev/sda

/dev/sda:
 Timing cached reads:   746 MB in  2.00 seconds = 372.90 MB/sec
 Timing buffered disk reads: 120 MB in  3.03 seconds =  39.56 MB/sec

GPIO

Camera

OV7670 is supported http://linux-sunxi.org/CSI

hardware

pinout: gpio_defination_large.jpg

https://www.olimex.com/wiki/How_to_add_pwm

cat /sys/class/pwm-sunxi/pwm0/pin 
PB2

echo 10khz > /sys/class/pwm-sunxi/pwm0/period

echo 25 > /sys/class/pwm-sunxi/pwm0/duty_percent

echo 1 > /sys/class/pwm-sunxi/pwm0/run

LEDs

dpavlin@cubieboard2:~$ grep . /sys/class/leds/*/trigger 
/sys/class/leds/blue:ph21:led2/trigger:none battery-charging-or-full battery-charging battery-full battery-charging-blink-full-solid ac-online usb-online mmc0 timer [heartbeat] backlight cpu0 cpu1 default-on 
/sys/class/leds/green:ph20:led1/trigger:[none] battery-charging-or-full battery-charging battery-full battery-charging-blink-full-solid ac-online usb-online mmc0 timer heartbeat backlight cpu0 cpu1 default-on 

forum

ina219

device tree

dpavlin@cubieboard2:~$ sensors
ina219-i2c-1-40
Adapter: mv64xxx_i2c adapter
in0:          +0.04 V  
in1:          +4.64 V  
power1:       66.88 W  
curr1:       +13.64 A  

iio_hwmon-isa-0000
Adapter: ISA adapter
temp1:        +33.6�C  

root@cubieboard2:~# dmesg | grep ina | tail -1
[ 6597.685287] ina2xx 1-0040: power monitor ina219 (Rshunt = 100 uOhm)

# hum, it should be 10uA, so I changed that in device tree

dpavlin@cubieboard2:~$ dmesg | grep ina219
[   11.594536] ina2xx 1-0040: power monitor ina219 (Rshunt = 10 uOhm)
dpavlin@cubieboard2:~$ sensors
ina219-i2c-1-40
Adapter: mv64xxx_i2c adapter
in0:          +0.02 V  
in1:          +4.75 V  
power1:       85.00 W  
curr1:       +17.97 A  

iio_hwmon-isa-0000
Adapter: ISA adapter
temp1:        +32.5�C  

# still wrong current!


user-land C

User-land implementation which works: https://github.com/ZigFisher/Glutinium/blob/master/i2c-telemetry/src/ina219.c

modified a little to provide full timestamp and fflush: ina219.c

dpavlin@cubieboard2:~$ ./ina219 -b 1 -i 1
2017-10-23T12:40:24 4744mV  262.2mA
2017-10-23T12:40:26 4756mV  249.1mA
2017-10-23T12:40:27 4776mV  223.0mA
2017-10-23T12:40:28 4772mV  223.8mA
2017-10-23T12:40:29 4760mV  224.0mA
2017-10-23T12:40:30 4768mV  223.0mA
2017-10-23T12:40:31 4772mV  223.1mA
2017-10-23T12:40:32 4748mV  224.6mA
2017-10-23T12:40:33 4776mV  223.1mA
2017-10-23T12:40:34 4768mV  223.5mA

SPI flash

flashrom

dpavlin@cubieboard:~$ sudo grep spidev /boot/armbianEnv.txt
overlays=pwm nand uart3 uart4 spi-spidev
#overlays=spi-spidev
param_spidev_spi_bus=0


dpavlin@cubieboard:~$ sudo flashrom -p linux_spi:dev=/dev/spidev0.0
flashrom v0.9.9-2-g51e4303 on Linux 4.14.47-sunxi (armv7l)
flashrom is free software, get the source code at https://flashrom.org

Calibrating delay loop... OK.
Found GigaDevice flash chip "GD25Q80(B)" (1024 kB, SPI) on linux_spi.
No operations were specified.

root@cubieboard:/home/dpavlin# time flashrom -p linux_spi:dev=/dev/spidev0.0 -r /dev/null
flashrom v0.9.9-2-g51e4303 on Linux 4.14.47-sunxi (armv7l)
flashrom is free software, get the source code at https://flashrom.org

Calibrating delay loop... OK.
Found GigaDevice flash chip "GD25Q80(B)" (1024 kB, SPI) on linux_spi.
Reading flash... done.

real    0m11.210s
user    0m0.796s
sys     0m0.381s


build u-boot with SPI support

http://linux-sunxi.org/Bootable_SPI_flash

git clone -b sunxi-spi https://github.com/StephanvanSchaik/u-boot

dpavlin@armbian:~/u-boot$ git diff
diff --git a/configs/Cubieboard_defconfig b/configs/Cubieboard_defconfig
index 0389d4c..cbafac9 100644
--- a/configs/Cubieboard_defconfig
+++ b/configs/Cubieboard_defconfig
@@ -16,3 +16,13 @@ CONFIG_SPL=y
 # CONFIG_SPL_ISO_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
 CONFIG_USB_EHCI_HCD=y
+
+CONFIG_CMD_SF=y
+CONFIG_CMD_SPI=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_MACRONIX=y
+CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_DM_SPI=y
+CONFIG_SUNXI_SPI=y
+
dpavlin@armbian:~/u-boot$ make Cubieboard_defconfig




This doesn't actually work for me (since it's missing device tree overlays), but rebasing to current u-boot master doesn't
produce code which compiles.

https://forum.armbian.com/topic/3252-opi-zero-boot-with-spi/

reset

http://linux-sunxi.org/Cubieboard/Reset

permalink
Frequency counter
frequency-counter-pic.jpg

Cheap frequency counter kit "1Hz-50MHz Digital LED DIY Kits Crystal Oscillator Frequency Counter Tester"

original design

https://www.qsl.net/dl4yhf/freq_counter/freq_counter.html

modifications

permalink
coreboot

x200 tablet

https://libreboot.org/docs/install/x200_external.html

root@x200:~# dmidecode | grep ROM\ Size
        ROM Size: 8192 kB

root@x200:~# ifconfig eth0
eth0: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        ether 00:1f:16:0c:2a:41  txqueuelen 1000  (Ethernet)




https://operand.ca/2018/02/22/liberating-a-x200.html

x230 tablet

https://www.coreboot.org/Board:lenovo/x230

https://www.ericholzbach.net/blog/x230_coreboot/

https://blog.noq2.net/corebooting-thinkpad-x230.html

http://zmatt.net/unlocking-my-lenovo-laptop-part-3/

XPE, VGA bios https://vimeo.com/177951809 https://mega.nz/#!PVxz2ZgS!u9ivPW3Hio3kGKcmBHsBLwlUpRe3n74NHQK-Gzgzt08

x230.dmi.after

x230.dmi.before

EC

https://github.com/eigenmatt/mec-tools

flashrom

pi@rpi3:~ $ sudo apt-get install build-essential pciutils usbutils libpci-dev libusb-dev libftdi1 libftdi-dev zlib1g-dev


ME

http://hardenedlinux.org/firmware/2016/11/17/neutralize_ME_firmware_on_sandybridge_and_ivybridge.html

https://github.com/corna/me_cleaner

before

dpavlin@x230:/x200/x230/coreboot/util/intelmetool$ sudo ./intelmetool -s
Bad news, you have a `QM77 Express Chipset LPC Controller` so you have ME hardware on board and you can't control or disable it, continuing...

MEI not hidden on PCI, checking if visible
MEI found: [8086:1e3a] 8;�

ME Status   : 0x1e000245
ME Status 2 : 0x60000106

ME: FW Partition Table      : OK
ME: Bringup Loader Failure  : NO
ME: Firmware Init Complete  : YES
ME: Manufacturing Mode      : NO
ME: Boot Options Present    : NO
ME: Update In Progress      : NO
ME: Current Working State   : Normal
ME: Current Operation State : M0 with UMA
ME: Current Operation Mode  : Normal
ME: Error Code              : No Error
ME: Progress Phase          : Host Communication
ME: Power Management Event  : Clean Moff->Mx wake
ME: Progress Phase State    : Host communication established

ME: Extend SHA-256: 72ac4092d50568edb998066d81033da5f626bf97fe7f9942d06247dbf59bf8db

ME: timeout waiting for data: expected 8, available 0
ME: GET FW VERSION message failed
ME Capability: Full Network manageability                 : OFF
ME Capability: Regular Network manageability              : OFF
ME Capability: Manageability                              : ON
ME Capability: Small business technology                  : ON
ME Capability: Level III manageability                    : OFF
ME Capability: IntelR Anti-Theft (AT)                     : ON
ME Capability: IntelR Capability Licensing Service (CLS)  : ON
ME Capability: IntelR Power Sharing Technology (MPC)      : ON
ME Capability: ICC Over Clocking                          : ON
ME Capability: Protected Audio Video Path (PAVP)          : ON
ME Capability: IPV6                                       : OFF
ME Capability: KVM Remote Control (KVM)                   : OFF
ME Capability: Outbreak Containment Heuristic (OCH)       : OFF
ME Capability: Virtual LAN (VLAN)                         : ON
ME Capability: TLS                                        : ON
ME Capability: Wireless LAN (WLAN)                        : OFF
permalink
Intel SSD

Intel SSD died

smartctl 6.6 2017-11-05 r4594 [x86_64-linux-4.19.0-4-amd64] (local build)
Copyright (C) 2002-17, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model:     INTEL SSDSA2BW160G3H
Serial Number:    BAD_CTX     00000136
LU WWN Device Id: 5 001517 a6be8caac
Firmware Version: 4PC10365
User Capacity:    8,388,608 bytes [8.38 MB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    Solid State Device
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   ATA8-ACS T13/1699-D revision 4
SATA Version is:  SATA 2.6, 3.0 Gb/s
Local Time is:    Sat Apr 27 17:23:39 2019 CEST
SMART support is: Unavailable - device lacks SMART capability.

=== START OF ENABLE/DISABLE COMMANDS SECTION ===
SMART Enable failed: scsi error badly formed scsi parameters

A mandatory SMART command failed: exiting. To continue, add one or more '-T permissive' options.


dpavlin@x200:~$ sudo hdparm -i /dev/sdc

/dev/sdc:

 Model=INTEL SSDSA2BW160G3H, FwRev=4PC10365, SerialNo=BAD_CTX     00000136
 Config={ Fixed }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=0
 BuffType=unknown, BuffSize=unknown, MaxMultSect=16, MultSect=1
 CurCHS=16/16/63, CurSects=16128, LBA=yes, LBAsects=16384
 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio3 pio4 
 DMA modes:  mdma0 mdma1 mdma2 
 UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6 
 AdvancedPM=no WriteCache=enabled
 Drive conforms to: unknown:  ATA/ATAPI-2,3,4,5,6,7

 * signifies the current active mode

dpavlin@x200:~/intel-ssd$ sudo smartctl -a /dev/sdc > smartctl.1
dpavlin@x200:~/intel-ssd$ sudo hdparm -i /dev/sdc > hdparm-i.1
dpavlin@x200:~/intel-ssd$ sudo hdparm -I /dev/sdc > hdparm-I.1




Internet visdom is that it's corrupted translation table and that secure erase or firmware update might help.

secure erase

https://ata.wiki.kernel.org/index.php/ATA_Secure_Erase

dpavlin@x200:~/intel-ssd$ sudo hdparm -I /dev/sdc | grep frozen
        not     frozen

# ok

root@x200:/home/dpavlin/intel-ssd# hdparm --user-master u --security-set-pass Eins /dev/sdc
security_password: "Eins"

/dev/sdc:
 Issuing SECURITY_SET_PASS command, password="Eins", user=user, mode=high

root@x200:/home/dpavlin/intel-ssd# hdparm -I /dev/sdc | grep -C 3 enabled
Security:
        Master password revision code = 65534
                supported
                enabled
        not     locked
        not     frozen
        not     expired: security count

root@x200:/home/dpavlin/intel-ssd# time hdparm --user-master u --security-erase Eins /dev/sdc
security_password: "Eins"

/dev/sdc:
 Issuing SECURITY_ERASE command, password="Eins", user=user

real    0m19.285s
user    0m0.001s
sys     0m0.004s


This I assume reseted traslation table on ssd. First invocation of smartctl complained that I have to use -s on to turn smart on, so I did.

And it seems to work. All smart counters are reset (beacuse smart was off after secure erase).

dpavlin@tab:~$ sudo smartctl -a /dev/sda  | head -20
smartctl 6.6 2016-05-31 r4324 [x86_64-linux-4.9.0-8-amd64] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Device Model:     INTEL SSDSA2BW160G3H
Serial Number:    BTPR144501A5160DGN
LU WWN Device Id: 5 001517 a6be8caac
Firmware Version: 4PC10365
User Capacity:    160,041,885,696 bytes [160 GB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    Solid State Device
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   ATA8-ACS T13/1699-D revision 4
SATA Version is:  SATA 2.6, 3.0 Gb/s
Local Time is:    Tue Apr 30 21:48:39 2019 CEST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

dpavlin@tab:~$ sudo hdparm -i /dev/sda

/dev/sda:

 Model=INTEL SSDSA2BW160G3H, FwRev=4PC10365, SerialNo=BTPR144501A5160DGN
 Config={ Fixed }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=0
 BuffType=unknown, BuffSize=unknown, MaxMultSect=16, MultSect=1
 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=312581808
 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio3 pio4 
 DMA modes:  mdma0 mdma1 mdma2 
 UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6 
 AdvancedPM=no WriteCache=enabled
 Drive conforms to: unknown:  ATA/ATAPI-2,3,4,5,6,7

 * signifies the current active mode

dpavlin@tab:~$ sudo hdparm -tT /dev/sda

/dev/sda:
 Timing cached reads:   9340 MB in  2.00 seconds = 4675.95 MB/sec
 Timing buffered disk reads: 736 MB in  3.01 seconds = 244.74 MB/sec

firmware update

https://blog.cihar.com/archives/2012/07/13/intel-ssd-firmware-update-linux/

But modified for recent Debian kernels

https://downloadcenter.intel.com/download/28749/Intel-SSD-Firmware-Update-Tool?v=t

dpavlin@x200:~$ unzip FirmwareUpdateTool_v3_0_7.zip -d FirmwareUpdateTool_v3_0_7

dpavlin@x200:~/FirmwareUpdateTool_v3_0_7$ sudo apt install grub-imageboot

dpavlin@x200:~/FirmwareUpdateTool_v3_0_7$ cat /etc/default/grub-imageboot 
# Where to find the iso/floppy images

IMAGES="/boot/images"

# You can override the boot options for iso/floppy images here
# see http://syslinux.zytor.com/wiki/index.php/MEMDISK for details

#IMAGEOPTS="rawimg"
#ISOOPTS="iso"

dpavlin@x200:~/FirmwareUpdateTool_v3_0_7$ . /etc/default/grub-imageboot ; sudo mkdir -v $IMAGES
mkdir: created directory '/boot/images'

dpavlin@x200:~/FirmwareUpdateTool_v3_0_7$ sudo cp -v issdfut_64_3.0.7.iso /boot/images/
'issdfut_64_3.0.7.iso' -> '/boot/images/issdfut_64_3.0.7.iso'

dpavlin@x200:~/FirmwareUpdateTool_v3_0_7$ sudo update-grub
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.19.0-4-amd64
Found initrd image: /boot/initrd.img-4.19.0-4-amd64
Found linux image: /boot/vmlinuz-4.19.0-2-amd64
Found initrd image: /boot/initrd.img-4.19.0-2-amd64
Found memdisk: /boot/memdisk
Found iso image: /boot/images/issdfut_64_3.0.7.iso
done


This doesn't boot on x200 dual-core for me.

permalink
BLITZWOLF BW SHP2


board markings

Different to board on this page, mine has following markings:

HYS-01-008_V3.4
2018-07-20

boot loader mode

Short GPIO0 and GND during boot to enter flash mode before connecting to the serial programmer. The power indicator LED will be strong red to confirm the device has entered this mode. As soon as the short is removed, the red color will be dimmed. The device will then be ready for flashing.

Sonoff-Tasmota

https://github.com/arendst/Sonoff-Tasmota/wiki/BlitzWolf-SHP2

configuration

dpavlin@nuc:/nuc/esp8266/Sonoff-Tasmota/sonoff$ cp user_config_override_sample.h user_config_override.h 

# edit user_config_override.h to define wifi and mqtt i also added:


#undef  MODULE
#define MODULE          BLITZWOLF_BWSHP

#undef USE_DOMOTICZ
#undef USE_HOME_ASSISTANT

build

dpavlin@nuc:/nuc/esp8266/Sonoff-Tasmota$ export PLATFORMIO_BUILD_FLAGS='-DUSE_CONFIG_OVERRIDE'
dpavlin@nuc:/nuc/esp8266/Sonoff-Tasmota$ platformio run -e sonoff

flash

root@x200:/mnt/nuc/esptool# ./esptool.py --chip esp8266 --port /dev/ttyUSB0 --before no_reset --after no_reset erase_flash
esptool.py v2.7-dev
Serial port /dev/ttyUSB0
Connecting...
Chip is ESP8266EX
Features: WiFi
MAC: 80:7d:3a:4e:32:97
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in 1.3s
Staying in bootloader.
root@x200:/mnt/nuc/esptool# ./esptool.py --chip esp8266 --port /dev/ttyUSB0 --before no_reset --after no_reset write_flash --flash_mode dout 0x00000 /mnt/nuc/esp8266/Sonoff-Tasmota/.pioenvs/sonoff/firmware.bin 
esptool.py v2.7-dev
Serial port /dev/ttyUSB0
Connecting....
Chip is ESP8266EX
Features: WiFi
MAC: 80:7d:3a:4e:32:97
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 1MB
Compressed 519456 bytes to 358637...
Wrote 519456 bytes (358637 compressed) at 0x00000000 in 31.7 seconds (effective 131.1 kbit/s)...
Hash of data verified.

Leaving...
Staying in bootloader.


espurina - DON"T USE IT!

https://github.com/xoseperez/espurna/wiki/Hardware-BLITZWOLF-BW-SHP2

TL;DR -- it doesn't work for me at all -- it reboots when I access web page and doesn't send data over mqtt or influxdb reliably. I can't recommend it at all, but I'm leaving my attempts below....

download pre-compiled binary and flash it

https://github.com/xoseperez/espurna/releases/tag/1.13.5

root@x200:/mnt/nuc/esptool# wget https://github.com/xoseperez/espurna/releases/download/1.13.5/espurna-1.13.5-blitzwolf-bwshpx.bin

root@x200:/mnt/nuc/esptool# ./esptool.py --chip esp8266 --port /dev/ttyUSB0 erase_flash
esptool.py v2.7-dev
Serial port /dev/ttyUSB0
Connecting....
Chip is ESP8266EX
Features: WiFi
MAC: 80:7d:3a:4e:32:97
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in 1.3s
Staying in bootloader.

# again power cycle device with gpio connected to ground, and disconnect it....

root@x200:/mnt/nuc/esptool# ./esptool.py --chip esp8266 --port /dev/ttyUSB0 write_flash --flash_mode dout 0x00000 ./espurna-1.13.5-blitzwolf-bwshpx.bin 
esptool.py v2.7-dev
Serial port /dev/ttyUSB0
Connecting....
Chip is ESP8266EX
Features: WiFi
MAC: 80:7d:3a:4e:32:97
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 1MB
Compressed 492880 bytes to 352587...
Wrote 492880 bytes (352587 compressed) at 0x00000000 in 31.2 seconds (effective 126.5 kbit/s)...
Hash of data verified.

Leaving...
Staying in bootloader.

configuration

https://github.com/xoseperez/espurna/wiki/Configuration

connect to first boot AP

When asked for credentials, enter "admin" as username and "fibonacci" as password.

I configured mqtt and start pushing data using telegraf to influxdb. json doesn't work with telegraf.

ota update

https://github.com/xoseperez/espurna/wiki/OTA

dpavlin@nuc:/nuc/esp8266/espurna/code$ git remote -v
origin  https://github.com/xoseperez/espurna (fetch)
origin  https://github.com/xoseperez/espurna (push)
dpavlin@nuc:/nuc/esp8266/espurna/code$ platformio run -e blitzwolf-bwshpx-ota


for some rason, updateing using web interface browse/upload did work for me first time, but not after that.
Is version 1.13.6-dev broken?

ota manager

https://github.com/xoseperez/espurna/wiki/Espurna-OTA-Manager

Does not work for me.

platformio ota

dpavlin@nuc:/nuc/esp8266/espurna/code$ ESPURNA_IP=192.168.3.103 platformio run -t upload -e blitzwolf-bwshpx-ota -v
permalink
ffmpeg

Hints for usage:

play without delay

ffplay -fflags nobuffer /dev/video1

# works for network streams, not for /dev/video
ffplay -probesize 32 -sync ext http://192.168.3.248/VIDEO.CGI


ffplay -fflags nobuffer -flags low_delay -framedrop \
 -strict experimental -rtsp_transport tcp rtsp://<host>:<port>

permalink
hi3515v100
hi3515v100-functional-block-disagram.png

hi3515v100.pdf

Hi3515Hi3515 H.264 Encoding and Decoding Processor



Key Features

CPU Core

zARM926EJ
I-cache 16 KB, D-cache 16 KB
I-TCM 2 KB
Built-in MMU, supporting multiple open operating systems such as VxWorks, Linux, WinCE, and PalmOS
Up to 400 MHz operating frequency

Video Encoding/Decodingz

H.264 main profile encoding/decoding
H.264 baseline profile encoding/decoding
JPEG/MJPEG baseline encoding/decoding

serial

EN-6704V 4 channel H.264 digital video recorder for @RadionaOrg has 3.3V uart with pinout GND, TX, RX, 5V

mozilla-ktdvr-plugin

en-6704v

j87

+--- ---+
|1 2 3 4|
+-------+

1 - gnd
2 - 2.29
3 - 3.3
4 - 5v

IMG_20190316_185951.jpg

hi3515v100

links

http://www.i-1.nl/blog/wp-content/uploads/CCF-paper-Forensic-reliabilty-DVR.pdf

https://openhisiipcam.org/hardware/briefs/hi3515v100.pdf

https://github.com/zetalabs/ezbox/blob/master/pool/bootstrap/target/linux/hi35xx/patches-2.6.32/010-mach-hi3515v100.patch

http://users.atw.hu/balubati/blog/index.php?m=08&y=12&d=18&entry=entry120818-102937&PHPSESSID=4c6c320a5aa587c554c6b8f145288148

SDK

https://github.com/bluhbluh/Hi3515-SDK

dpavlin@nuc:/nuc/hi3515v100$ git clone https://github.com/bluhbluh/Hi3515-SDK
Cloning into 'Hi3515-SDK'...
remote: Enumerating objects: 362, done.
remote: Counting objects: 100% (362/362), done.
remote: Compressing objects: 100% (312/312), done.
remote: Total 362 (delta 45), reused 362 (delta 45), pack-reused 0
Receiving objects: 100% (362/362), 277.99 MiB | 5.77 MiB/s, done.
Resolving deltas: 100% (45/45), done.
Checking out files: 100% (336/336), done.


mtd

/stm/disk/0/p1/mtd-backup $ ls -al /dev/mtdblock*
brw-rw----    1 root     root      31,   0 Jan  1  1970 /dev/mtdblock0
brw-rw----    1 root     root      31,   1 Jan  1  1970 /dev/mtdblock1
brw-rw----    1 root     root      31,   2 Jan  1  1970 /dev/mtdblock2
brw-rw----    1 root     root      31,   3 Mar 23 00:31 /dev/mtdblock3
/stm/disk/0/p1/mtd-backup $ dd if=/dev/mtdblock0 of=0 bs=128k
32+0 records in
32+0 records out
/stm/disk/0/p1/mtd-backup $ ls -al
drwxr-xr-x    2 root     root         4096 Mar 23 02:06 .
drwxr-xr-x   25 root     root         4096 Mar 23 02:06 ..
-rw-r--r--    1 root     root      4194304 Mar 23 02:06 0
/stm/disk/0/p1/mtd-backup $ dd if=/dev/mtdblock1 of=1 bs=128k
96+0 records in
96+0 records out
/stm/disk/0/p1/mtd-backup $ dd if=/dev/mtdblock2 of=2 bs=128k
112+0 records in
112+0 records out
/stm/disk/0/p1/mtd-backup $ dd if=/dev/mtdblock3 of=3 bs=128k
16+0 records in
16+0 records out

setup tftp writable server

dpavlin@x200:/mnt/nuc/hi3515v100$ cat /etc/default/tftpd-hpa 
# /etc/default/tftpd-hpa

TFTP_USERNAME="tft"
TFTP_DIRECTORY="/srv/tftp"
TFTP_ADDRESS="192.168.1.1:69"
TFTP_OPTIONS="--secure --create"

backup

/stm/disk/0/p1/mtd-backup $ tftp -p -l 0 -r /0 192.168.1.1
/stm/disk/0/p1/mtd-backup $ tftp -p -l 1 -r /1 192.168.1.1
/stm/disk/0/p1/mtd-backup $ tftp -p -l 2 -r /2 192.168.1.1
/stm/disk/0/p1/mtd-backup $ tftp -p -l 3 -r /3 192.168.1.1

tar+nc backup

on device

/mnt $ tar -cv -f - . | nc 192.168.1.1 8888

on receiving side

dpavlin@x200:/mnt/nuc/hi3515v100/mnt-backup$ nc -l -p 8888 | tee mnt.tar | tar tvf -

Nice verbose output during backup on both sides and nc is much faster than tftp.

permalink
Weblog Navigation
Loading...
Weblog Archives
  • Loading...