Zsun Wifi Card Reader Can Now Run OpenWrt

Zsun Wifi card reader is a tiny micro SD card reader with WiFi connectivity, and while people managed to access the device serial console a few months ago, the plan was to eventually run OpenWrt since it’s based on the popular Atheros AR9331 WiSoC combined with 64MB RAM and 16MB SPI Flash. It would also be one the smallest OpenWrt capable device with dimensions of 30 x 33 mm.

Zsun_Wi-FI_Card_ReaderA team of Polish managed this feat, and have now posted instructions to install OpenWrt, as well as other documentation, for example a description of the board’s GPIOs.

There are four methods to flash OpenWrt:

  1. Solder on an Ethernet jack and flash from the original uboot (hard but safe)
  2. Reflash the bootloader from the original firmware to one that supports upload over serial (less soldering but fatal if you mess up)
  3. Reflash the firmware from the original firmware using mtd_write (easy but you have to do it right on the first try)
  4. Attach a programmer to the flash chip (impossible to mess up)

I’ll reproduce the method with mtd_write here, as although you may potentially brick your device, it’s the easiest (no hardware hack):

  1. Download OpenWrt for Zsun binary images
  2. Start a TFTP server on your computer. If you use a Linux computer, you can use dnsmasq as follows:
  3. Login to the board, and download the necessary files to zsun’s /tmp directory:

    You may also want to copy /sbin/mtd_write to /tmp, and kill all unnecessary process to be extra safe.
  4. Now you can flash the firmware to “uImage” and “rootfs” partitions:

    Bus error” looks like an error, but in this case it just indicates flashing is complete.
  5. Restart the device, and after a longer than usual very first boot, you should have access to OpenWrt. Have fun 🙂

Zsun_WiFi_Card_Reader_Pin_DescriptionsSo once you’re done, what you can do with the device? Some ideas of the developers include just serving files over WiFi, using it as a WiFi AP/client/repeater, as the brain for an IoT project, mesh networking, PirateBox, mini Tor server, and more.

Zsun WiFi card reader can be purchased for as low as $10.99 on Banggood, and can be found on others shops for $11+ to about $15 such as DealExtreme, GearBest or Aliexpress.

Share this:
FacebookTwitterHacker NewsSlashdotRedditLinkedInPinterestFlipboardMeWeLineEmailShare

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK Pi 4C Plus

17 Replies to “Zsun Wifi Card Reader Can Now Run OpenWrt”

  1. @Peter
    If I understood correctly the circuit of the “MicroSD card switcher” you linked to, it is controlled via an FTDI cable. Maybe replacing the FTDI with an ESP8266 would make the job. Esp-link is supposed to replace the FTDI cable for AVR flashing, now I don’t know what the FTDI does in reality with that circuit, if it is a simple serial port console, then it is easy to replace with an ESP.

  2. so it’s not possible to change the host/device mode using only software as i understand? In which mode is the device by default? I thought it should be in device mode, why are they talking about disabling host mode by desoldering a resistor?

  3. The SoC USB port cannot be connected to the USB plug without resoldering the connections.

    USB plug | SoC USB port
    ………..|………|
    ………..V………V
    ………USB switch
    ……………|
    ……………V
    ……..SD card reader

    She SoC USB port is soldered for host mode, since it needs to control the SD card reader.

  4. @zoobab
    This circuit is just an example. I have prototype build with TS3A27518E mux/demux. And it it working fine with USB card reader with write speed around 17 MB/s. Not as fast as it should probably because of bad prototyping.
    But would be great if I could made ethernet device.
    I would say ESP8266 would be way to slow.

  5. @Peter
    I meant replacing the FTDI with an ESP. I had a look at this solution to be able to reflash an SD card for a CI testbed for openwrt. The board was only booting from a flashed SD card.

  6. @zoobab
    Ok, I understand wrong then. You mean using ESP only to control switch.
    Seems I’m using my prototype device in similar way as you. I have USB card reader, analog switches for SD card signals and one flat cable with SD card connector at the end. Something like this https://plus.google.com/+MichaelGebetsroither/posts/eS4VYkW7Jny?pid=5742485398778944786&oid=104422661029399872488
    I’m using this design for devices which needs SD card to boot. It has external switch to control the flow (SD card to card reader or target device).

    LAVA Validation Lab is using something similar but much more powerful (have the schematic from them).

  7. @anon

    So there is no way to control it by software? I can image this reader plugged into digital picture frame (has only USB input) serving photos. These photos can be “delivered” one per day from server, ex. openwrt’s cron on ZSun fires up the user script, switches card to wireless client (STA) and transfers pictures from server to sd card.

  8. @rufik

    I would also like to do this. It must be possible for software to switch the card reader back and forth between the SoC and the USB plug, since the “Setcardworkmode” URL in the built-in firmware apparently does this, as described here: https://wiki.hackerspace.pl/projects:zsun-wifi-card-reader:factory-update

    If someone could figure out how it does that, and port it to OpenWRT, I’d be happy.

    (I don’t know if I’d actually use it with an always-on device like a digital picture frame, though, since it seems to get pretty warm when running.)

  9. I lost WiFi connection during mtd_write to /dev/mtd2. I used telnet instead of socat, and did not kill any background programs… I don’t have any ESSID now, so I guess I’ll have to open it.

  10. Nope, I don’t like ads. If you don’t either, you should stop plastering them all over your site. But, it doesn’t really matter. I choose to block ads, regardless of what you like.

    By the way, I do not find this blog useful. But, since you asked about my preferences, I thought it was polite to answer your question.

    Bye.

Leave a Reply

Your email address will not be published. Required fields are marked *

Khadas VIM4 SBC
Khadas VIM4 SBC