Home > Hardware, Linux, OpenWRT, Qualcomm Atheros > Zsun Wifi Card Reader Can Now Run OpenWrt

Zsun Wifi Card Reader Can Now Run OpenWrt

Orange Pi Development Boards

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.

  1. January 25th, 2016 at 15:27 | #1

    Will try that now. Nice to hear! Will test if the SOIC can behave as master+client mode at the time.

  2. Peter
    January 25th, 2016 at 16:24 | #2

    What is the transfer speed when reading/writing to SD card?

    What I would like to make is a networked SD card writer with integrated SD card MUX – switching SD card to the reader or to the target device. Something like this: http://www.linuxinternals.org/blog/2014/06/04/a-microsd-card-remote-switcher/
    I have this with USB based writer already.

  3. January 25th, 2016 at 18:08 | #3

    @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.

  4. January 25th, 2016 at 18:11 | #4

    @zoobab
    The switch program seems to use Bitbanging, so it will be more complicated to replace with an ESP, but the code seems to be very trivial.

  5. opex
    January 25th, 2016 at 19:15 | #5

    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?

  6. anon
    January 25th, 2016 at 20:23 | #6

    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.

  7. Peter
    January 25th, 2016 at 20:43 | #7

    @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.

  8. January 25th, 2016 at 21:10 | #8

    @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.

  9. Peter
    January 25th, 2016 at 21:19 | #9

    @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).

  10. rufik
    January 25th, 2016 at 23:30 | #10

    @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.

  11. Nobody of Import
    January 26th, 2016 at 21:49 | #11

    Zsun direct sells this through Amazon…

    http://www.amazon.com/zsun%C2%AE-Memory-Reader-MicroSD-Flash/dp/B00UT1MC9W

    Price is a bit higher, but if you’ve got Prime, it would be a good thing to add this to your list of suppliers since there’s no shipping costs involved.

  12. AdamC
    February 5th, 2016 at 10:17 | #12

    @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.)

  13. February 13th, 2016 at 15:54 | #13

    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.

  14. February 13th, 2016 at 20:53 | #14

    Oh, I wish I had seen this first: https://wiki.hackerspace.pl/projects:zsun-wifi-card-reader:factory-update
    A easier and safer update method using Zsun own update procedure.

  15. ABPer
    February 15th, 2016 at 02:54 | #15

    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.

  16. maurer
    April 23rd, 2016 at 13:25 | #16

    @cnxsoft
    hi,
    i had the same issue.
    how did you recover the device?

    thanks

  17. April 23rd, 2016 at 14:25 | #17

    @maurer
    No. I decided not to spend time on it.

  1. No trackbacks yet.