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.

Support CNX Software - Donate via PayPal or become a Patron on Patreon

17
Leave a Reply

avatar
17 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
10 Comment authors
maurerABPercnxsoftAdamCNobody of Import Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
zoobab
Guest

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

Peter
Guest
Peter

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.

zoobab
Guest

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

zoobab
Guest

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

opex
Guest
opex

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?

anon
Guest
anon

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.

Peter
Guest
Peter

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

zoobab
Guest

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

Peter
Guest
Peter

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

rufik
Guest
rufik

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

Nobody of Import
Guest
Nobody of Import

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.

AdamC
Guest
AdamC

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

ABPer
Guest
ABPer

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.

maurer
Guest
maurer

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

thanks