As you might have seen, I’ve made a few projects with PL2303HX, namely that little nifty esp8266 developer board. I plan to dive in esp8266 firmware development soon and my goal will be a nifty mysql client, so that I can run mysql queries via UART! The only bad thing (apart from eeprom never working, and occasional freezes that I’ve later fixed with a 10uF SMD capacitor) – I had to press the buttons to reset the ESP8266 module to bootloader mode. So I’ve made a ‘dark green evil sister’ twin of that red board with a little bit updated schematics:
- GP0 and GP1 lines are now rigged to reset and bootloader buttons respectively, resistors protect those against logic level conflict.
- I’ve ditched EEPROM. It doesn’t work anyway. Screw that!
- Proper decoupling – no more freezes!
- SMD LEDs on GP0 and GP1.
- Nice dark greenish design and clear urethane coating FTW!
I did’t use RTS/DTR pins for that. Mostly because guys haven’t yet decided how to rig them in esptool and I wanted to make use of PL2303HXA GPIOs anyways for some other projects. They’re often quite handy. However, there’s no driver for those in linux. A few patches are in the upstream, but none have been merged so far. So I’ve settled for a userspace solution with libusb. Luckily for us, sending a few control transfers to PL2303 doesn’t screw up the kernel driver. You can grab the result of my work at github.
The resulting tool is really simple to embed in any of you scripts and is less than 500 lines of C code with little to no dependencies.
1 ✗ necromant @ sylwer ~/Dev/software/pl2303ctl $ pl2303gpio --help PL2303HXA userspace GPIO control tool (c) Andrew 'Necromant' Andrianov 2014, License: GPLv3 Usage: pl2303gpio [action1] [action2] ... Options are: -g/--gpio n - select GPIO, n=0, 1 -i/--in - configure GPIO as input -o/--out v - configure GPIO as output with value v -r/--read v - Read current GPIO value Examples: pl2303gpio --gpio=1 --out 1 pl2303gpio --gpio=0 --out 0 --gpio=1 --in
For a quick hardware summary – turned out PL2303HX was more treacherous one may think at first. Here’s a quick summary of PL2303HXA pitfalls I came across and that wasted a good deal of my time:
- Internal lowdropout regulator output should be decoupled with no less than 10uF. Otherwise – device freezes randomly. Even if you to not use this 3.3 volts source for anything – it is used internally by the chip and needs decoupling.
- Despite the PL2303HXA datasheet stands that it will work at 1.8V – it will not. I was making a serial dongle for my odroid-x2 that uses 1.8v signalling and I cursed every single bit of that PL2303HXA. The TX will work, RX will not. Datasheet lies!
- External EEPROM config never worked with at24c64. Period. They don’t even tell us the i2c slave address. Not a big loss anyway – newer revisions have OTP ROM.