Wednesday, February 29, 2012

IInterest'Blog

IInterest'Blog
← 常用的CSS3文字特效HTML5可视化编辑器[5] →
UC浏览器web开发实践
Posted on 2011年07月20日 by Bell 1,233 views
最近一直在做移动互联网项目,基本上都是针对UC浏览器的开发,这里总结下各种实践经验,罗列一些基于UC浏览器7.7以上版本的开发技巧。

CSS支持情况(数据来源:官方文档)

↑点击浏览

UC浏览器自定义特殊标签及属性
直连方式:
ext:a:
使用方法(下同):
iinterest

PS:如果是ext:xxx:格式也可以在地址栏中使用(下同)

服务器中转:
ext:e:

webkit内核渲染:
ext:webkit:

返回主页:
ext:startpage

刷新:
ext:refresh

前进:
ext:forward

后退:
ext:back

拨打电话:
ext:tel/10010

发送短信:
ext:sms/内容|电话号码|

书签:
ext:bookmark

上传书签:
ext:upload_favo

本地帮助:
ext:help

短信推荐uc浏览器:
ext:friend

在新窗口中打开url
ext:wo:

实践中的一些问题(持续更新,2011.11.4)
10.CSS文字颜色,使用缩写时会出现无法识别的情况。
9.背景色跟文字颜色相同时,会自动调整文字颜色为反选色。
8.ucweb 8.0 进入阅读模式后无法载入背景图片。
7.ucweb 7.8 iphone版无法识别itms://跳转苹果应用商店…严重bug![2011.8.3]
6.为块级元素添加color会出现同色边框(s40平台)
5.CSS特殊性计算有问题(个别平台)
4.同向浮动的两个元素(float:left),第二个元素内如果嵌套有块级元素,那么这个元素的同向内边距会失效(padding-left)。这时建议尽量使用外边距(margin-left)。(个别平台)
3.不支持负边距(个别平台)
2.遇到无法识别的CSS时会停止对“错误”及以后的CSS解析,所以如果要用到hack最好放在末尾(全平台)
1.DOCTYPE 只支持 DTD XHTML Mobile 1.0(全平台)

Sunday, February 26, 2012

Prototype: Bus Pirate BPv3 | Dangerous Prototypes

Prototype: Bus Pirate BPv3 | Dangerous Prototypes

Prototype: Bus Pirate BPv3

in BP v3, Bus Pirate, Prototypes by Ian | 16 comments

sideiii.450

UPDATE: v3b is the latest Bus Pirate revision, read about the changes here.

BPv3 is the latest hacking multi-tool from the Bus Pirate project. It connects to a USB port and interacts with electronics through a simple terminal interface.

stack-exampleUse it to see how much of your private information is stored on smartcard SIM chips. Explore the Wii Nunchuck over the I2C bus like Johnny Lee. Read and write EEPROM chips in consumer electronics at any voltage. Check out all the existing chip demonstrations.

BPv3 has features an intrepid hardware hacker might need to prototype their next great creation:

  • Talk to 1-wire, I2C, UART (async serial), SPI, JTAG, MIDI, LCDs, PC keyboards, and a ton of generic serial devices from a terminal.
  • Scriptable from Python, Perl, etc.
  • 0-40MHz frequency counter, 0-4MHz pulse-width modulator.
  • 0-6volt measurement probe.
  • 3.3volt and 5volt power supplies with reset.
  • On-board pull-up resistors for multi-voltage interfacing.
  • Address scanners, chip dumpers, and other helpful macros.
  • USB interface, power. USB firmware updates.
  • Translations (currently Spanish and Italian, add your own).

Get an assembled red BPv3 for $30, including worldwide shipping, thanks to Seeed Studio. You can also grab the plans from the Bus Pirate project page and build your own.

This article introduces BPv3, the latest hardware from the Bus Pirate project. We’ll look at the history of the design, share our experience organizing the production of Bus Pirate v2go, and talk about issues that influenced hardware version 3.

History of the Bus Pirate universal serial interface

We made the first Bus Pirate to deal with a particularly difficult chip that didn’t behave as expected. We wanted to send SPI commands through a serial terminal so we could test the chip without compiling a firmware to implement each small change.

v0.ii.450

Bus Pirate V0 was based on an USB-enabled PIC 18F2550 microcontroller. It operated at 5volts only, and didn’t have on-board power supplies. V0 was published on a personal blog under the GPL, sometime around 2004. Along with some very poor soldering, you can see the first use of the Bus Pirate name etched into the copper.

v0a.450

Bus Pirate V0a upgraded to a 16bit PIC 24FJ64GA002, but traded USB for a serial interface. This version also added 3.3volt and 5volt power supplies, and two 3.3volt software-controlled pull-up resistors.

Microchip’s new low-pincount PICs are perfect for the Bus Pirate because of a feature called peripheral pin select. Many microcontrollers have hard-wired pin assignments, but PPS assigns some features to any pins we like. The PIC 24FJ is a better choice than the dsPIC33-series because the pins can source/sink more current (20mA vs 4mA).

We used a rare and expensive RS232 transceiver from our parts box in this design because it was intended for ‘in house’ use. We released this design into the public domain, and Hack a Day later published an article about it as a stop-gap when other content wasn’t ready.

v1.450

Bus Pirate V1a was another serial interface design, but this version used mostly surface mount parts. We replaced the expensive RS232 transceiver with a cheap, common SMD version. The power supplies were upgraded to 800mA switchable regulators that can be reset from within the terminal. V1a ditched the software controlled pull-up resistors, and used jumpers to connect pull-ups to the four bus pins. This version added voltage monitoring probes using extra analog to digital converter pins on the PIC.

The v1a Bus Pirate was also released into the public domain, and we wrote an article about it that was published on Hack a Day. Fundamental logic revised the v1 design and released a through-hole serial port Bus Pirate kit (also public domain). You might still be able to buy the kit for $20.

v2-ssii.450

Bus Pirate V2 is the current king of the Bus Pirate designs, it’s the first of the modern 16bit designs to have a USB interface (via an FTDI serial->USB chip). V2a was an early revision (left), v2go was the final version of the V2 family (right). V2 swaps in smaller, cheaper, and awesomer power supplies (MIC5205) recommended by Nate at SparkFun. We finally brought software switchable pull-up resistors to all four main bus pins via aCD4066 IC.

The Bus Pirate project was approached by a company that wanted to sell the v2 design, but complications and time constraints got in the way. Instead, we ran a group preorderas a fundraiser for Hack a Day, and got some experience with the manufacturing process.

Almost 1000 Bus Pirates sold in 10 days, with all proceeds going to Mahalo, the company that operates Hack a Day. So many sold that we had supply problems, Seeed Studiocouldn’t find enough PIC 24FJ64GA002-SO to fill the order.

sideiii.450

BPv3 is designed to address supply and manufacturing problems encountered during the v2go preorder. v2go would have been the final Bus Pirate, but we learned so much during manufacturing that we wanted to apply it to an updated design. For V3 we did a full, scratch redesign of the PCB that went through two revisions.

If you’ve got a Bus Pirate v2go, don’t worry because it’s functionally equivalent to v3. V2go and V3 will even bootload and run the same firmware. In retrospect, v2go was a cute-but-poor version choice. Where do you go from there? v2go+1=? We chose V3.

Updates to BPv3

bpv3cct.450

Click here for a full size schematic image [PNG]. The schematic and PCB were designed with the free version of Cadsoft Eagle, the latest design files are on the project page at Google Code.

The basic Bus Pirate design has been covered extensively at Hack a Day, we won’t duplicate that here. Refer to these fantastic Bus Pirate articles: v2, v1, v0.

Resolve manufacturing issues

compare.450

Hack a Day’s Bus Pirate preorder had to be split due to a shortage of SOIC-size PIC microcontrollers. BPv3 uses the smaller, more common SSOP-size (IC1). The smaller chip also allowed a reduction in PCB size and a few other tweaks.

The programming pins on v2 were swapped from the normal PICkit2 order. Seeed had to use an adapter to program the v2go Bus Pirates, BPv3 has the correct pin order for easier manufacturing. Bootloaders for V2go and v3 are not interchangeable because of this modification.

Manufactured BPv3s will be programmed with the latest bootloader and firmware, which contains a self-test for better quality control.

Circuit updates

FTDI.450

The FTDI 232R USB->serial converter’s (IC2) IO pins are now driven by the main supply regulator, which is probably better than running it from the internal regulator as in v2go. The FTDI enable pin could be connected to the 3.3volt supply regulator (VR2) enable to make a fully USB sleep compliant device, but we didn’t because the routing was too complicated.

We added a 0.1uF capacitor (C6) to decouple the VCCIO supply pin, the datasheet wasn’t clear if this is required but it’s probably best practice.

The header (ST) that taps the serial connection between the FTDI232R (IC2) and the PIC (IC1) was removed. A poll of developers found that none had ever used it, and the routing is cleaner without it.

solder-bridge.450

The interior connection between two adjacent ground pins on IC3 was removed because so many people thought it was a solder bridge. (It’s not.)

Tweaks

bpv3-stripiii

We tweaked part placement during the PCB redesign. The USB jack (J1) is centered. The CD4066 (IC3) is rotated for better clearance around the IO header.

We moved the USB activity LED to the top of the PCB. LED labels are bolder, easier to read.

Traces that carry power are fatter, and have bigger vias. We used wider 12mil trace/space wherever possible to improve PCB yield. The ground plane is reinforced with more and larger vias in important areas.

io.450

The tighter placement required us to swap the 3.3volt and ADC pins on the I/O header. This is easier to route, and the ribbon cable pinout is more logical: ADC-5.0-3.3-GND.

PCB

BusPirate-v3e-renderii.450

We used the freeware version of Cadsoft Eagle to make the schematic and PCB. Download the latest designs and firmware from the project Google Code page.

The PCB is small and tightly packed. It’s a challenging board that takes us an hour to solder from memory. Seeed Studio sells the extra PCBs from our order.

Partslist

brdii.450

Click for a full size placement image [PNG].

NameValue (size)Notes
IC1PIC24J64GA002-SS (SSOP)Changed to SSOP
IC2FT232RL (SSOP)
IC3CD4066D (SOIC-N)
C1-60.1uF capacitor (0805)Added C6
C20-2410uF tantalum capacitor (SMC-A)
ICSP, IO0.1″ pin header (3×05)
J1USB MINI-B (SMD)J2 renamed J1
L11000ma+ ferrite bead (0805)
LED1-4LED (0805)
R12000 ohm resistor (0805)
R2,31100 ohm resistor (0805)R30 renamed R2
R10-17, 19-2310000 ohm resistor (0805)Removed R18
R31,32390 ohm resistor (0805)
VR2,3MIC5205 3.3volt regulator (SOT23-5)
VR4MIC5205 5volt regulator (SOT23-5)

Taking it further

UPDATE: v3b is the latest Bus Pirate revision, read about the changes here.

Check the Bus Pirate manual for usage examples, pin diagrams, connection tables, syntax guides, and more.

We’re happy with the current hardware features. Future updates will focus on improving the firmware, and adding features via the firmware and break-out boards.

You can discuss the project in the forum, or join us on the Google Code Bus Pirate project.

Get one!

Get an assembled red BPv3 for $30, including worldwide shipping, thanks to Seeed Studio. You can also grab the plans from the Bus Pirate project page and build your own.

Producing the Bus Pirate

Seeed Studio made it really easy to sell a project without worrying about a website, billing, shipping, etc. We’re working with them again on BPv3 and the #twatch ethernet LCD backpack.

bpv3-take1.250To manufacture a project, you need to submit design files, a part list, and a firmware file.

We design circuit boards in Cadsoft Eagle andcreate gerber design files, but many board houses now accept Eagle .brd files too. We send the gerbers to a board house and test the PCB. We order revisions and test again, if required.

Assembling a part list can be fairly involved. At minimum, we specify part type, value, and size. Elaborate as much as possible on critical values or custom parts. For a 10uF capacitor, what type and how many volts max? If a 1% tolerance resistor is required, it needs to be specified.

Our best advise is to design with common parts. Check DigiKey and Mouser (or better,Octopart), be sure you can get a few hundred of your critical part from several suppliers. Check the supply of any specific microcontroller or IC that could hold up production.

v2go-250Seeed was able to locate 300 PIC 24FJ64GA002-SO microcontrollers prior to the Hack a Day preorder. When orders took off, the initial 300 were gone within 48 hours. In the end, nearly 1000 Bus Pirates were sold. The extra 700 PICs took almost 2 months to source.

It’s important to plan for production programming. The Bus Pirate uses a two part firmware, a bootloader and a main program. The normal programing method is to burn the bootloader and then upload a main program over USB. This is too slow for manufacturing, so we created a complete, bootloaded PIC firmware dump that combines both parts into a single image.

When manufacturing starts, be prepared for issues that hardly ever happen in a single chip, but occur quite frequently in 1000. Around 15% of v2gos failed initial quality control tests. They wouldn’t connect to the bootloader at the default speed (115200bps). The bug turned out to be a baud rate setting that wasn’t precise enough due to the inaccuracy of the internal crystal. The remaining boards worked after reducing the bootloader speed on the PC to 9600bps.

The members of the Bus Pirate project team learned a lot producing v2go with Seeed Studio. It wasn’t without problems, but we used that experience to refine the hardware design. We hope this background information helps you produce your first widget, be sure to let us know when it debuts.

Get one!

Get an assembled red BPv3 for $30, including worldwide shipping, from Seeed Studio. You can also grab the plans from the Bus Pirate project page and build your own.

sideiii.450

This entry was posted in BP v3, Bus Pirate, Prototypes and tagged ,, .

Comments

  1. Merve says:

    I only *just* (2 days ago) signed up for one on the google spreadsheet preorder notification. Will that go through or should I put another order in through the seedstudio page?

  2. Ian says:

    Go ahead and buy it from Seeed. The notification should go out to everyone that signed up in a few days, it’ll just contain a link to the Seeed page and a notice that the mailing list has been destroyed.

  3. Mio says:

    Awesome. Ordered.

  4. chipres says:

    the postage expensive then the actual Bus Pirate v3 :(

  5. Merve says:

    When I look it says:
    Registered Air Parcel – $2.85. That’s to Australia, there can’t be many places further away.

  6. Ian says:

    @chipres – what option did you choose? Seeed sends worldwide for $2.85, so the Bus Pirate should be $30, shipped.

  7. chipres says:

    i press estimate shipping rates DHL Rates (Shipping to MV (1 x 33.00g))

  8. chipres says:

    preoder $29.83 USD
    thanks

  9. Muris says:

    I just got my Bus Pirate v3 !
    Woohooo!

  10. Pedro says:

    I want to find out the master in a I2C system that includes four chips. Three are inside a device that I can not open, in the device outside, a PIC microcontroller is being used. I have tapped the bus lines and have all the chips IDs. Can I use this device and is there any documentation before ordring?
    Thanks

    • Ian says:

      I’m sorry, I don’t think the Bus Pirate will do this.

      • AndThen says:

        the master will drive the clock line, via a resistor wouldn’t it?
        i2c bus could be multi master also, in that case it’s not easy.

        In theory you need taps at each chip, and a center tap. 4 fast trigger capture, and some flavor of logic (nOR?)

        Could always start lifting potential clock pins =D

  11. Pedro says:

    Would the system continue to work if one of the slaves does not acknowledge or is out of the loop?

    • AndThen says:

      It’s hard to say what would happen, could explode I guess. If you lift/disconnect all the clock pins it’s about as safe as i can think to make it. Maybe tie SDA low, if my memory serves me well, ACK is a high bit.

      So with all the clocks disconnected only a master will have a signal, and with data low it won’t read an ACK and so will either spin loops, error, or take over the world. Depending on the coders whims.

  12. Pedro says:

    That is a very smart idea. I will try that and post the results. Thanks again.

Leave a Comment

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

*

You may use these HTML tags and attributes:

Notify me of followup comments via e-mail. You can also subscribe without commenting.