Trying to use USB-to-RS232 (FTDI) with Mofi 3500

Please post a link, as searching for mofi* in Brand or Model in the Table of Hardware shows no devices found.

1 Like

mofi3500-3gn is found here https://archive.openwrt.org/releases/18.06.1/targets/ramips/rt305x/ (and similarly for 18.06.0 and 17.01.5). So I somehow found my way to those downloads folders before ever finding the table of hardware page (which clearly, as you say, has no mofi listed there).

So what does it mean when it is in one place and not in the other?

And, despite it not being in the table of hardware, shouldn't the next thing I try (for getting my FTDI device working) be the mofi specific firmware found in the above releases folder?

1 Like

It just means the ToH needs to be updated. Also, if you find an OpenWrt weblink with Archive in it, it should not be used. The link should be: https://downloads.openwrt.org/releases/18.06.1/targets/ramips/rt305x/

  • You're likely going to want to compile your own firmware, as my guess is that's a 16MB ROM device,
1 Like

While I appreciate this as a prediction of my future : - ), but should I not try this firmware (already specific to mofi3500-3gn model) built by the project's main build process first? https://downloads.openwrt.org/releases/18.06.1/targets/ramips/rt305x/openwrt-18.06.1-ramips-rt305x-mofi3500-3gn-initramfs-kernel.bin

And then based on what errors, hurdles, or gotchas are found that way, then I know what I'm trying to achieve when building it myself?

You'll just want to ensure you continually monitor the free space on /overlay when installing packages:
df -h | grep /overlay

Is that what the 128 MBit (= 16 MB) is referring to here? This is within the first few lines of the serial output on the 4 pin header while powering up:

...
Board: Ralink APSoC DRAM:  32 MB
...
ASIC 3052_MP2 (Port5<->None)
DRAM component: 128 Mbits SDR
DRAM bus: 32 bit
Total memory: 32 MBytes
Flash component: NOR Flash
...

@mucm I'm not sure... but since 128mbit = 16MB, it's likely.

  • I was going off a post on the Mofi site for the firmware download, which said is was ~7.5MB with ~7.5MB free.

okay, upgraded using openwrt-18.06.1-ramips-rt305x-mofi3500-3gn-initramfs-kernel.bin. Made 1 firewall change and then I power cycled and noticed the firewall setting I had done was not kept after power cycle. So I then did the squashfs-sysupgrade using openwrt-18.06.1-ramips-rt305x-mofi3500-3gn-squashfs-sysupgrade.bin. After that, firewall changes were kept after power cycles (I guess I was supposed to understand that already), and the overlay partition was larger (640 kb to 4.3 Mb).

So I ran the opkg commands, and rebooted, as recommended early on in this thread.

root@OpenWrt:/# df |grep overlay
/dev/mtdblock6            4352       292      4060   7% /overlay
overlayfs:/overlay        4352       292      4060   7% /

root@OpenWrt:/# opkg update
Downloading http://downloads.openwrt.org/releases/18.06.1/targets/ramips/rt305x/packages/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_core
Downloading http://downloads.openwrt.org/releases/18.06.1/targets/ramips/rt305x/packages/Packages.sig
Signature check passed.
Downloading http://downloads.openwrt.org/releases/18.06.1/packages/mipsel_24kc/base/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_base
Downloading http://downloads.openwrt.org/releases/18.06.1/packages/mipsel_24kc/base/Packages.sig
Signature check passed.
Downloading http://downloads.openwrt.org/releases/18.06.1/packages/mipsel_24kc/luci/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_luci
Downloading http://downloads.openwrt.org/releases/18.06.1/packages/mipsel_24kc/luci/Packages.sig
Signature check passed.
Downloading http://downloads.openwrt.org/releases/18.06.1/packages/mipsel_24kc/packages/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_packages
Downloading http://downloads.openwrt.org/releases/18.06.1/packages/mipsel_24kc/packages/Packages.sig
Signature check passed.
Downloading http://downloads.openwrt.org/releases/18.06.1/packages/mipsel_24kc/routing/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_routing
Downloading http://downloads.openwrt.org/releases/18.06.1/packages/mipsel_24kc/routing/Packages.sig
Signature check passed.
Downloading http://downloads.openwrt.org/releases/18.06.1/packages/mipsel_24kc/telephony/Packages.gz
Updated list of available packages in /var/opkg-lists/openwrt_telephony
Downloading http://downloads.openwrt.org/releases/18.06.1/packages/mipsel_24kc/telephony/Packages.sig
Signature check passed.
root@OpenWrt:/# opkg install kmod-usb-serial kmod-usb-serial-ftdi
Installing kmod-usb-serial (4.14.63-1) to root...
Downloading http://downloads.openwrt.org/releases/18.06.1/targets/ramips/rt305x/packages/kmod-usb-serial_4.14.63-1_mipsel_24kc.ipk
Installing kmod-nls-base (4.14.63-1) to root...
Downloading http://downloads.openwrt.org/releases/18.06.1/targets/ramips/rt305x/packages/kmod-nls-base_4.14.63-1_mipsel_24kc.ipk
Installing kmod-usb-core (4.14.63-1) to root...
Downloading http://downloads.openwrt.org/releases/18.06.1/targets/ramips/rt305x/packages/kmod-usb-core_4.14.63-1_mipsel_24kc.ipk
Installing kmod-usb-serial-ftdi (4.14.63-1) to root...
Downloading http://downloads.openwrt.org/releases/18.06.1/targets/ramips/rt305x/packages/kmod-usb-serial-ftdi_4.14.63-1_mipsel_24kc.ipk
Configuring kmod-nls-base.
Configuring kmod-usb-core.
[  612.327364] kmodloader: loading kernel modules from /etc/modules.d/*
[  612.443202] usbcore: registered new interface driver usbfs
[  612.454583] usbcore: registered new interface driver hub
[  612.465617] usbcore: registered new device driver usb
[  613.250260] usbcore: registered new interface driver usbserial
[  613.262316] usbcore: registered new interface driver usbserial_generic
[  613.275784] usbserial: USB Serial support registered for generic
[  613.294297] usbcore: registered new interface driver ftdi_sio
[  613.306191] usbserial: USB Serial support registered for FTDI USB Serial Device
[  613.323804] kmodloader: done loading kernel modules from /etc/modules.d/*
Configuring kmod-usb-serial.
[  613.481226] kmodloader: loading kernel modules from /etc/modules.d/*
[  613.499621] kmodloader: done loading kernel modules from /etc/modules.d/*
Configuring kmod-usb-serial-ftdi.
[  613.626344] kmodloader: loading kernel modules from /etc/modules.d/*
[  613.644241] kmodloader: done loading kernel modules from /etc/modules.d/*

(rebooted)

root@OpenWrt:/# df |grep overlay
/dev/mtdblock6            4352       404      3948   9% /overlay
overlayfs:/overlay        4352       404      3948   9% /

root@OpenWrt:/# ls -latr /dev/ | tail -n 5
crw-------    1 root     root        5,   1 Jan  1  1970 console
crw-------    1 root     root      108,   0 Dec  5 19:23 ppp
srw-rw-rw-    1 root     root             0 Dec  5 19:23 log
drwxr-xr-x    3 root     root          1180 Dec  5 19:23 .
crw-------    1 root     root        4,  64 Dec  5 19:48 ttyS0

(connected FTDI based USB-to-RS232 device to router's USB port)

root@OpenWrt:/# ls -latr /dev/ | tail -n 5
crw-------    1 root     root        5,   1 Jan  1  1970 console
crw-------    1 root     root      108,   0 Dec  5 19:23 ppp
srw-rw-rw-    1 root     root             0 Dec  5 19:23 log
drwxr-xr-x    3 root     root          1180 Dec  5 19:23 .
crw-------    1 root     root        4,  64 Dec  5 19:48 ttyS0

So as I said in my OP, no new device shows up under /dev/ when I connect this USB device. Any additional ideas now that I am at a "known" place on a recent release would be appreciated.

So now you are running a new official version, and it looks like there is 8 MB of flash, which is plenty for this situation.

It must be the wrong driver for the device. There are a bunch of different FTDI chips, I don't know if they all use the same driver.

Plug in the device while running, this should cause a series of kernel log messages as the drivers load. If you only see "new high speed USB device" and no more, that means that the low level kmod-usb has enumerated the device on the bus, but no high-level driver has claimed it.

If you don't see any log messages after hot-plugging in the device, that means that the low level USB is not working. This is often because there is a switchable power supply to the USB port, and a GPIO pin needs to be set to turn it on.

1 Like

Well as I saw in OP when at least lsusb worked for this device, it is USB ID 0403 6001 (and this is also seen when connecting to desktop Linux PC).

Sadly, none:

root@OpenWrt:~# dmesg |tail -n 5
[   24.809328] br-lan: port 1(eth0.1) entered blocking state
[   24.820264] br-lan: port 1(eth0.1) entered forwarding state
[   24.831844] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[   25.509533] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[  114.020350] random: crng init done

(then I connected USB device)

root@OpenWrt:~# dmesg |tail -n 5
[   24.809328] br-lan: port 1(eth0.1) entered blocking state
[   24.820264] br-lan: port 1(eth0.1) entered forwarding state
[   24.831844] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[   25.509533] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[  114.020350] random: crng init done

Hmm, but the LEDs on the dongle come on (and similarly lights come on for a USB thumb drive, and also similar there's no dmesg lines for that either - I guess because USB filesystem features are not in the plain 18.06.1 firmware).

Does this imply that power to the USB port is not the issue? Or if port power could be the issue (despite these LEDs lighting) then can you direct me to any docs on controlling it via the GPIO?

If you can provide the brand & model of the cable, and/or the FTDI chip model, it will help us in figuring out which driver package you need to install

  • Also, are you utilizing a USB-TTL cable, USB-to-RS232 cable, or a USB-to-UART board?

You have power but no data then. I think the RT305X chips need some sort of "OTG" driver in addition to or instead of kmod-usb2.

You can also try other USB devices like a mouse or flash drive. They should all cause the "new XXX speed USB device" message.

I'm not sure what you mean by chip model or how to get anything about the chip except USB ID (when hooked up to regular PC, or in the stock-mofi-firmware lsusb in my OP).

As for brand and model of cable, I actually have 5 of these, 4 appear the same (one of which is the one I've been using up to now), about 6" long with no distinguishing marks, just a "Q.C. OK" + bar code + serial number sticker, and one is different, about 24" long, with sticker saying:

USB-RS-232 Converter
Model: USA-FTDI-A36
Data Communications
(bar code)
(serial number)

All 5 of them show exactly the same in lsusb when connected to a regular PC.

Is it relevant from my OP then that (with stock-mofi-firmware) something about dwc_otc came up in dmesg when I connected the device?

Appreciate all the suggestions everyone...

The FTDI chip the cable uses has a model # which denotes what driver it will then need, as FTDI makes a range of chips for serial communitcation.

It appears you have all the correct FTDI/serial packages installed, except for libftdi or libftdi1, unless either was installed as a dependency and not listed in your output... please post the output of:
opkg list-installed | grep ftdi

As the USB core is not even enumerating devices when they are plugged in, the choice of a high level driver is irrelevant.

The 305X chip's USB module contains "On the Go" logic so it can operate as either a host or a device. This is common on smartphones so the user can either connect the phone to a PC as a device, or use it as a host to access a memory card, etc with the phone OS.

Only host mode is possible the way that routers are wired.

1 Like

@mk24 I didn't see your prior post until after I posted =]

@mucm Whenever you do get the USB portion fixed, here's theOpenWrt driver from FTDI's site (CC'd for MIPS)

Okay thanks. So noting in my OP that (with the OEM provided firmware) the message when USB devices were connected was:

[  429.090000] usb 1-1: new full-speed USB device number 2 using dwc_otg

and googling there does seem to be an older (12.09 timeframe) openwrt package kmod-usb-rt305x-dwc_otg (no longer supported? as its not in the current releases or downloads folder) but this prodded me to list available packages mentioning "otg" (which found none), and "dwc" which found kmod-usb-dwc2 and kmod-usb-dwc3.

root@OpenWrt:/# opkg update
...
root@OpenWrt:/# opkg install kmod-usb-dwc2
Installing kmod-usb-dwc2 (4.14.63-1) to root...
Downloading http://downloads.openwrt.org/releases/18.06.1/targets/ramips/rt305x/packages/kmod-usb-dwc2_4.14.63-1_mipsel_24kc.ipk
Configuring kmod-usb-dwc2.
[  241.945264] kmodloader: loading kernel modules from /etc/modules.d/*
[  241.968572] dwc2 101c0000.otg: Configuration mismatch. dr_mode forced to host
[  242.018950] dwc2 101c0000.otg: DWC OTG Controller
[  242.028572] dwc2 101c0000.otg: new USB bus registered, assigned bus number 1
[  242.042887] dwc2 101c0000.otg: irq 26, io mem 0x101c0000
[  242.057925] hub 1-0:1.0: USB hub found
[  242.076870] hub 1-0:1.0: 1 port detected
[  242.104031] kmodloader: done loading kernel modules from /etc/modules.d/*
root@OpenWrt:/# ls -latr /dev/ |tail -n 5
crw-------    1 root     root      108,   0 Dec  5 19:23 ppp
srw-rw-rw-    1 root     root             0 Dec  5 19:23 log
drwxr-xr-x    3 root     root            60 Dec  6 15:13 bus
drwxr-xr-x    4 root     root          1200 Dec  6 15:13 .
crw-------    1 root     root        4,  64 Dec  6 15:14 ttyS0

(connected USB-RS232 adapter here)

root@OpenWrt:/# [  270.286555] usb 1-1: new full-speed USB device number 2 using dwc2
[  270.557682] ftdi_sio 1-1:1.0: FTDI USB Serial Device converter detected
[  270.571403] usb 1-1: Detected FT232RL
[  270.603772] usb 1-1: FTDI USB Serial Device converter now attached to ttyUSB0
ls -latr /dev/ |tail -n 5
srw-rw-rw-    1 root     root             0 Dec  5 19:23 log
drwxr-xr-x    3 root     root            60 Dec  6 15:13 bus
crw-------    1 root     root      188,   0 Dec  6 15:14 ttyUSB0
drwxr-xr-x    4 root     root          1220 Dec  6 15:14 .
crw-------    1 root     root        4,  64 Dec  6 15:14 ttyS0

(note the chip model actually appears to be a FT232RL from the message above)

Hot diggity, thank you everyone who suggested things here.

1 Like

So, marking this thread solved but I'm not fully done with this router : - (
WAN function moves to LAN1

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.