Serial with Fritzbox 3370 // How to install

In search how to install openwrt on my 3370 I ended with the serial connection. But while I can read, I cannot write. Here is the output of screen /dev/ttyUSB0 115200 session

Willkommen zu minicom 2.7.1

Optionen: I18n 
Übersetzt am May  6 2018, 10:36:56.
Port /dev/ttyUSB0, 08:37:44

Drücken Sie CTRL-A  Z für Hilfe zu speziellen Tasten

ROM VER: 1.0.5
CFG 05
Initial DDR setting for SDRAM test pass
Initial DDR check ok...

[/]

(AVM) EVA Revision: 1.1186 Version: 2186
(C) Copyright 2005 AVM Date: Apr 13 2011 Time: 14:46:06 (2) 2 0x0-0x741D

[FLASH:] MACRONIX Uniform-Flash 256kB 256 Bytes WriteBuffer
[FLASH:](Eraseregion [0] 4 sectors a 64kB) 
[NAND:] 128MB HYNIX 2048 Pagesize 128k Blocksize 1024 Blocks 8Bit 1 CS
[SYSTEM:] VR9 on 500MHz/250MHz/250MHz

.Infineon PHY11G detected

Eva_AVM >

What is going wrong that I cannot write?

I'm a layman what concerns electronics but I worked for years with the wgt634u via serial, so I'm a little bit experienced. But for example, my 3370 has no pins and so I had to try figuring out the cabling ...

All in all I went to the serial because I couldn't install via ftp ( indeed, there is the 3370-FTP-Server but no "Eva_AVM " ftpd). With my new FB 4040 I could install by ftp successfully.

Any hints are appreciated.

Sincerely,
Johann

https://openwrt.org/toh/avm/fritz.box.wlan.3370#serial is currently missing the pinout for the serial connection.

Since you successfully connected via serial: Can you tell us the pinout?

Dear tmomas,

the layout is take from

https://www.zebradem.com/wiki/index.php?title=Serielle_Konsole

Seen from the rear of the device, the most right of the 4 holes is square cut while the others are round.

1 2 3 4
[] o o o

3 R T G
, x x N
3 D D D
V

My "USB to tty" cable has three wires:

  1. black
  2. red
  3. yellow

I bought it some years ago (for the wgt634u) and can' find a datasheet anymore. So I guessed the black wire is ground and fastened it to the most left hole and red and yellow should be rx and tx. I had to make a lot of tries, in the beginning neither screen nor minicom nor picocom delivered more than gibberish, but then I got it showing the Eva_AVM - prompt.

I hope that helps.
Sincerely
Johann

1 Like

I added this now according to Johanns input.

1 Like

Hello;

I succeeded to gain access to the serial console of my Fritz 3370 by changing the cabling on my no name "USB to tty" cable to the following:

Pins:

1 2 3 4
[] o o o

3 R T G
, x x N
3 D D D
V

  1. empty
  2. black
  3. red
  4. yellow

Now I can login (as shown below)

Sincerely
Johann

.Infineon PHY11G detected

Eva_AVM >.....................................................[] set PHYs in Reset 0x1

Lantiq xDSL CPE VR9
phym = 08000000, mem = 08000000, max_pfn = 00008000
Reserving memory for CP1 @0xa8000000, size 0x00000000
plat_device_tree_setup: AVM hardware subrevision 5
plat_device_tree_setup: using Fallback device-tree of AVM hardware subrevision 2 
DT: d0 0d fe ed 00 00 09 61
[    0.000000] Linux version 3.10.73 (jpluschke@EmbeddedVM) (gcc version 4.8.3 (Buildroot 2014.08) ) #1 SMP Fri May 12 16:17:32 CEST 2017
[    0.000000] [env_init] 0x8101a760[0]
[    0.000000] [env_init] 0x8101a7a0[1]
[    0.000000] [env_init] 0x8101a7e0[2]
[    0.000000] [env_init] switch to ram location
[    0.000000] [init_avm_kernel_config] AVM Kernel Config (ptr 80825000)
[    0.000000] [init_avm_kernel_config] AVM Kernel Config: module memory entry
[    0.000000] [init_avm_kernel_config] AVM Kernel Config: version info entry
[    0.000000] [init_avm_kernel_config] AVM Kernel Config: device-tree for subrev 0 found
[    0.000000] [init_avm_kernel_config] AVM Kernel Config: device-tree for subrev 1 found
[    0.000000] [init_avm_kernel_config] AVM Kernel Config: device-tree for subrev 2 found
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019555 (MIPS 34Kc)
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 08000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] [module-alloc] use 0xc91000 bytes at 0x81104000
[    0.000000] PERCPU: Embedded 7 pages/cpu @81d99000 s7072 r8192 d13408 u32768
[    0.000000] Kernel command line: console=ttyS0,115200n8r nor_size=0MB sflash_size=256KB nand_size=128MB ethaddr=C0:25:06:49:EA:38 
[    0.000000] [NAND] nand_size = 0x8000000
[    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Writing ErrCtl register=00068006
[    0.000000] Readback ErrCtl register=00068006
[    0.000000] Memory: 107748k/131072k available (5707k kernel code, 23324k reserved, 2688k data, 300k init, 0k highmem)
[    0.000000] Hierarchical RCU implementation.
[    0.000000] NR_IRQS:181
[    0.000000] SRSConf0 0x3feffbfe: SRS1: 0xffffffff, SRS2 0xffffffff, SRS3 0xffffffff
[    0.000000] Lantiq ICU driver, version 3.0.1, (c) 2001-2011 Lantiq Deutschland GmbH
[    0.000000] Console: colour dummy device 80x25
[    0.000000] console [ttyS0] enabled, bootconsole disabled
[    0.000000] console [ttyS0] enabled, bootconsole disabled
[    0.020000] Calibrating delay loop... 331.77 BogoMIPS (lpj=1658880)
[    0.080000] pid_max: default: 32768 minimum: 301
[    0.080000] Security Framework initialized
[    0.080000] Mount-cache hash table entries: 512
[    0.090000] CPU1 revision is: 00019555 (MIPS 34Kc)
[    0.170000] Brought up 2 CPUs
[    0.170000] [yield_context_init] cpu=1 tc=2 mask=300
[    0.180000] [yield_context_init] cpu=0 tc=3 mask=410
[    0.180000] devtmpfs: initialized
[    0.200000] pinctrl core: initialized pinctrl subsystem
[    0.200000] Creating Config Table 
[    0.200000] [avm_generate_hw_config_table_from_device_tree] gpio_cnt: 21
[    0.210000] NET: Registered protocol family 16
[    0.220000] Reboot Status is: Power-On
[    0.220000] [TFFS3_Early_Init] called
[    0.230000] [avmnet] [avmnet_cfg_init] Driver version: 6.221.2.4  -  Revision 1496:3477  -  Mi 8. Mär 13:14:01 CET 2017
[    0.850000] Lantiq PCIe Root Complex driver, version 2.0.0, (c) 2001-2011 Lantiq Deutschland GmbH
[    0.900000] bio: create slab <bio-0> at 0
[    0.900000] PCI host bridge to bus 0000:00
[    0.910000] pci_bus 0000:00: root bus resource [mem 0x1c000000-0x1cffffff]
[    0.910000] pci_bus 0000:00: root bus resource [io  0x1d800000-0x1d8fffff]
[    0.920000] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    0.930000] ifx_pcie_rc_class_early_fixup port 0: fixed pcie host bridge to pci-pci bridge
[    0.940000] pci 0000:00:00.0: BAR 8: assigned [mem 0x1c000000-0x1c0fffff]
[    0.940000] pci 0000:00:00.0: BAR 9: assigned [mem 0x1c100000-0x1c1fffff pref]
[    0.950000] pci 0000:01:00.0: BAR 0: assigned [mem 0x1c000000-0x1c01ffff 64bit]
[    0.950000] pci 0000:01:00.0: BAR 6: assigned [mem 0x1c100000-0x1c10ffff pref]
[    0.960000] pci 0000:00:00.0: PCI bridge to [bus 01]
[    0.960000] pci 0000:00:00.0:   bridge window [mem 0x1c000000-0x1c0fffff]
[    0.970000] pci

It was a challenge to get openwrt installed on my fritzbox wlan 3370 (https://openwrt.org/toh/avm/fritz.box.wlan.3370).

While it was quite easy to get access to the bootloader ftp server of my fritz 4040, it was a challenge to catch the time slot of the ftpd of the 3370. But here is help: "eva_discover" from

I downloaded YourFritz completely as zip (YourFritz-master.zip) and opened it in my work directory. I had to fix it a little bit for my use by replacing parts in the last block (lines 421 downwards). This is roughly done but it worked within seconds. If you compare it with the original script (which produced an error I do not remember) you see that I

a.) shortened the if condition
b.) hard coded the ip
c.) added "exec lxterminal -e 'ftp 192.168.178.1'"

if [ ${#response} -gt 0 ]; then 
        # we assume, that the LE value of 2 above represents an answer and
        # if it's found, we assume the next 4 bytes are the IPv4 address
    # in LE format
    ip=192.168.178.1
        echo "EVA_FOUND=1"
        echo "EVA_IP=$ip"
        exec lxterminal -e 'ftp 192.168.178.1'
        if [ $default_hold -eq 1 ]; then
                echo | socat TCP4:192.168.178.1:21 STDOUT 2>/dev/null 1>&2
                echo "boot sequence interrupted" 1>&2

        fi
        rc=0
else
        echo "EVA_FOUND=0"
        rc=1
fi
exit $rc

I started my version of "eva_discover" on an lubuntu 18.04 after having installed the socat package.

./eva_discover INTERFACE=enp0s25 FROM=192.168.178.7 TO=192.168.178.1

Then I powered the 3370 on. As soon as the ftp server was detected the ftp client tool opened in a new terminal. In the beginning I was too slow issuing the commands (login, password, changing modes ...) (see https://openwrt.org/toh/avm/fritz.box.wlan.3370). I created an .netrc configuration file that took over some of the commands:

my ~/.netrc
machine 192.168.178.1 login adam2 password adam2
macdef init
       binary
       passive
       debug

Be careful: It ends with an empty line!

I prepared the other commands in another file :

quote SETENV linux_fs_start 0
quote MEDIA FLSH
put /home/lubuntu/FRITZ/Firmware/2019-07-01/openwrt-lantiq-xrx200-avm_fritz3370-rev2-hynix-squashfs-eva-kernel.bin mtd1
put /home/lubuntu/FRITZ/Firmware/2019-07-01/openwrt-lantiq-xrx200-avm_fritz3370-rev2-hynix-squashfs-eva-filesystem.bin mtd0

(As you can see easily guess my 3370 works with a Hynix NAND device :wink:

As soon as the terminal with the ftp client program started I copied and pasted. After successfully "putting" openwrt to my box I issued

quote REBOOT

and waited for some minutes to let the 3370 do whatever it had to do. This is the recording of my session:

Connected to 192.168.178.1.
220 ADAM2 FTP Server ready
331 Password required for adam2
230 User adam2 successfully logged in
binary
200 Type set to BINARY
passive
Passive mode on.
debug
Debugging on (debug=1).
---> SYST
215 AVM EVA Version 1.1186 0x0 0x741D
Remote system type is AVM.
ftp> quote SETENV linux_fs_start 0
---> SETENV linux_fs_start 0
200 SETENV command successful
ftp> quote MEDIA FLSH
---> MEDIA FLSH
200 Media set to MEDIA_FLASH
ftp> put /home/lubuntu/FRITZ/Firmware/2019-07-01/openwrt-lantiq-xrx200-avm_fritz3370-rev2-hynix-squashfs-eva-kernel.bin mtd1
local: /home/lubuntu/FRITZ/Firmware/2019-07-01/openwrt-lantiq-xrx200-avm_fritz3370-rev2-hynix-squashfs-eva-kernel.bin remote: mtd1
ftp: setsockopt (ignored): Permission denied
---> PASV
227 Entering Passive Mode (192,168,178,1,12,9)
---> STOR mtd1
150 Opening BINARY data connection
226 Transfer complete
2222410 bytes sent in 1.46 secs (1.4519 MB/s)
ftp> put /home/lubuntu/FRITZ/Firmware/2019-07-01/openwrt-lantiq-xrx200-avm_fritz3370-rev2-hynix-squashfs-eva-filesystem.bin mtd0
local: /home/lubuntu/FRITZ/Firmware/2019-07-01/openwrt-lantiq-xrx200-avm_fritz3370-rev2-hynix-squashfs-eva-filesystem.bin remote: mtd0
ftp: setsockopt (ignored): Permission denied
---> PASV
227 Entering Passive Mode (192,168,178,1,12,7)
---> STOR mtd0
150 Opening BINARY data connection
226 Transfer complete
4063232 bytes sent in 2.87 secs (1.3485 MB/s)
ftp> quote REBOOT
---> REBOOT
221 Thank you for using the FTP service on ADAM2
ftp>

After I while (5 minutes?) I switched the power off and on again, connected to the serial console and was rewarded with

BusyBox v1.31.0 () built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r10368-17ae3eb9ff
 -----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
root@OpenWrt:/# passwd

Sincerely
Johann

******************* LINKS ****
https://openwrt.org/toh/avm/fritz.box.wlan.3370
https://www.bachmann-lan.de/openwrt-auf-einer-avm-fritzbox-3370-installieren