TP-Link TL-MR3420 V3 LEDE(OpenWRT fork) Custom Build

# This is just my old build log for TP-Link TL-MR3420 V3 LEDE (OpenWRT fork) custom build firmware.

Forums thread is here >>

I have some experience in openWRT platform and it’s hack-able features. I like and select to buy this 3420 router because this one is dead cheap and full featured, especially support with USB and 3G modem. Some alternative like 3020 and 703 are also cheap but very small and no feature like eth-switch and little gpio. But problem is TL-MR 3420 V3 is not supported by openWRT. So, I have to build my own custom firmware. I choose LEDE (the fork of openWRT) build.


1- First build attempt

I recently build TL-MR 3420 V3 firmware which was not yet supported by openwrt.
The board is very similar to V2 board but V3 is with new processor Qualcomm Atheros QCA9531.

My V3 Board specifics brief are as follows:
– Qualcomm Atheros QCA9531 650MHz
– 25Q32CS1G 4M
– Zentel A3S56D40FTP -G5 32 MiB

I started with TL-MR 3420 V2 profile.
“Target System” ⇒ “Atheros AR7xxx/AR9xxx”
“Target Profile” ⇒ “TP-LINK TL-MR3420 v2”

Build success without showing any error.
Then I tried to build from stock web based firmware upgrade but failed with error 18005 because of TP-Link genuine firmware check hash.
So, I tried with serial/tftp flash method and flashing “lede-ar71xx-generic-tl-mr3420-v2-squashfs-factory.bin” was successful :slight_smile: . LEDE is booted checked from serial console.

Error : But when I check from serial console, ifconfig shows only lo interface. No Eth/Wan nor WLAN is up.

Tried ./etc/init.d/network reload and show error.

root@lede:/# /etc/init.d/network reload
Failed to connect to the switch. Use the "list" command to see which switches are available.
[   56.975151] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
'radio0' is disabled
'radio0' is disabled

Checked boot log and noticed errors.

[    0.115999] ar71xx: invalid MDIO id 1
[    1.414894] ag71xx ag71xx.0: invalid speed specified
[    1.420074] ag71xx: probe of ag71xx.0 failed with error -22
[    2.014883] ag71xx ag71xx.1: invalid speed specified
[    2.020033] ag71xx: probe of ag71xx.1 failed with error -22

Seem Switch/Eth driver is failed to load. How can I add network support for my board. If someone has experience on this series, also let me know.

Forum user @ahmadrasyidsalims point me out for the patch >>

I think you should be try :joy:


2- Second attempt

After loosing some hairs, some coffees + some nights, it was successfully booted and worked 🙂 .

TP-Link TL-MR-3420 V3 LEDE ( OpenWRT ) Custom Build

I re-patch this manually in current lede build.
In “menuconfig”, there is an option for “TL-MR3420 V3” profile. Good!!

This patch works basically,
– “lede-ar71xx-generic-tl-mr3420-v3-squashfs-factory.bin” was flashed and booted without any error
– LAN & WAN configured and works well now
– status LED works but other LED not
– USB storage is detected but 3G dongle not tested


  •  like other 4Mib flash router, space left in overlay/roots_data lefts only 492k
  • no space to install luci nor USB support package
  • – Seem extroot is solution but I want to use 3G dongle for usb.

Anyway, I have to rebuild firmware with removing some packages.
And any suggestion for which packages should be removed??

And some suggestion thankfully accepted 🙂 .

If you want to strip either PPPoE or IPv6, make sure you deselect the top LuCI entry as well, so you can deselect LuCI’s PPPoE support (and I think the same applies to IPv6).

you should be able to fit packages if you select them with “y” so they are integrated on build time. Build time integration compresses packages, 500k should be enough for luci and usb if integrated like that.

seem extroot is solution but I want to use 3G dongle for usb. >>

There are 3G/4G dongles with a microSD slot, you can do extroot there and be happy.
For example Huawei E3372h.
You can keep 3g/4g dongle tools in the extroot, as even if it does not detect the dongle’s modem it will detect the usb storage on it fine, so it will extroot and then detect the modem too.


3 – Third Attempt (Success)

Finally, tried to manage packages to fit in 4MiB. After removing some packages, custom build firmware worked fine with V-3 hardware.

For those who want to try, I build two versions. One for standalone and another for extroot support. Both versions removed ipv6 and pppoe supports.

1) This version supports
* Luci+bootstrap,
* 3G, usb, and
* ext-4 file system. Like @bobafetthotmail said, this version can detect SD card inside 3G-dongle.
* And I added mwan+luci-app-mwan3 for multi-wan support. Tested this also worked (Failed-over worked, load balancing is not tested)
Leaving about 104k space after flashed. Good point is you can still use extroot with this build (with ext-4, no vfat)


2) This version-2 is especially for extroot
* Luci+bootstrap,
* usb, and ext-4 and VFAT file system. This version can also detect SD card inside 3G-dongle.
* No mwan3 and no serial, no 3G dongle support. You can install whatever after extroot :slight_smile:
Leaving about 76k space after flashed.


By the way, Dear LEDE admin and developers, LEDE aimed for flash at least 8MiB, right!. But the problem is these cheap routers with USB support only have mostly 4MiB. Pls also consider for devices with 4M flash for some transition time.



thanks all,


DIY csCNC Controller – 3 (DIY Arduino Board and Programming with BusPirate)

For CNC controller, we have two choices, PC or dedicated controller card. Most DIY designs use Mach-3 or LinuxCNC. They use LPT port for interfacing and PC side software take care of everything. The problem is that LPT port is not an option today PC even for a bit outdated one. I searched for opensource CNC controller with simple, cheap, DIY friendly building solution 🙂 . Most are not meet up for me.

Finally, I keep my eye on Grbl.

– It is opensource, Arduino base, quoted from Grbl wiki

“Makers who do milling and need a nice, simple controller for their system that will run the ubiquitous Arduino Uno. People who loathe to clutter their space with legacy PC-towers just for the parallel-port. Tinkerers who need a controller written in tidy, modular C as a basis for their project.”

I am a PIC guy but the simplicity and rich full featured lib and software support of Arduino swayed my mind. Every programming language and platform has it’s learning curve but Arduino is not. If you have experience on any microcontroller paltform, you can build it up Arduino within a few hours.

In short, I built my own Arduino board (based on UNO core). I don’t want to scarified my  Arduino board in CNC project and want to save a few bucks and also wanna to have fun.

1# Started using a perfboard, a ATMEGA328P, crystal, some capacitor and resistor, headers, pin base and some jumper wires and also FTDI FT232 board.

Started with basic design, I omitted power supply parts. Here is my basic sketch schematic.


DIY-Arduino-Hardware (1) DIY-Arduino-Hardware (2)

2# Soldered headers, LED at PIN-13 and Reset switch. Also a header for FTDI board, external power connector, jumper for USB power, Power LED, pulled up resistors for SDA and SCL are soldered. Dont forget FTDI-DTR pin to connect RESET pin of ATMEGA328. If not, you cannot program Arduino.

DIY-Arduino-Hardware (5)

DIY-Arduino-Hardware (6)

3# The back side or perfboard PCB.

DIY-Arduino-Hardware (7)

After building the board, I have to program the ATMEGA328 with bootloader. The procedure is simple but I need a programmer for this. There are some alternative methods for burning bootloader to Arduino.




I picked my buspirate and follow the procedure from this blog. Thanks, BP support as AVR programmer.

1# Connected the Arduino board and Buspirate .



2# Download “optiboot-master” from Arduino source.  Installed WinAVR for AVRdude programmer support for Windows.

According to Eric’s blog post, I created a .bat file for easy programming.

avrdude -c buspirate -p m328p -P COM7 -U lock:w:0x3f:m
avrdude -c buspirate -p m328p -P COM7 -U efuse:w:0x05:m -U hfuse:w:0xD2:m -U lfuse:w:0xFF:m -U flash:w:optiboot_atmega328.hex -U lock:w:0x0F:m

3# Then, simply run in command line, waited for 10 mins (yes, it is a bit slow) and the job was done.

DIY-Arduino-Firmware (8) DIY-Arduino-Firmware (9)

DIY-Arduino-Firmware (1)

4# Plug USB cable, just build a “blink” sketch and successfully upload and run. LED at PIN-13 is blinking successfully 😀 .

DIY-Arduino-Hardware (15)

Finished DIY Arduino board.

DIY-Arduino-Hardware (16)

5# Side by side with original Arduino.

DIY-Arduino-Hardware (17)

Last job is need to attach all and make the first run.

By Oakkar7

DIY csCNC – 1 (Hardwares)

As mention is DIY Drill Press post, I started building a cheap&small CNC (aka) csCNC. My requirements are :

  • a small , table top CNC
  • Must be simple to build (No need special hardware and tools)
  • Must be cheap (My pocket is very limited)
  • capability of milling PCB, plastic, acrylic and wood.

After learning DIY build logs from internet, I chose Mantis 9.1 CNC techniques.

  • I like building technique, its simple, fast and not required special tools
  • it is small and cheap but accuracy and performance is good

But, the parts and tools in my hand is very limited. I have only parts from old printers such as linear rods, rails , stepper motors and some hardware like nuts and bolts. So, I customized the design slightly depend on my requirements and handy parts.

I started the building since last April Thingyan holidays.

1# Designed the draft ,

2# Cut the materials for X,Y assemblies. I used plastic board for assemblies and Bamboo kitchen plate for base (my fav, it is heavy, flat and rigid).

DIY-csCNC_hardware (2) DIY-csCNC_hardware (3)

3# Drilled the base plates. I used sandwich drilling technique and use 90 degree L shape as drill guide. This method worked well. Drilled easily vertical and parallel holes for linear rails.

DIY-csCNC_hardware (4) DIY-csCNC_hardware (5) DIY-csCNC_hardware (6)

4# Used an old school technique, a paper and pencil to make a shape of motor mount. Marked and drilled the base plate for motor mount.

DIY-csCNC_hardware (8) DIY-csCNC_hardware (9)


5# Test assembled X table.

DIY-csCNC_hardware (10)

6# Cut the moving bed and glued with linear barring. Used small amount of super glue for keeping parts temporary. (Don’t use much super glue, it will prevent later use of AB glue).

DIY-csCNC_hardware (11) DIY-csCNC_hardware (12)

7# prepared Tap screw for linear slide nut. To prevent backlash, I used tapping with the same lead screw. Mantis 9.1 design used fixed nut with glue. For easy maintenance and replacement, I used an aluminium bracket to fixed the lead nut.

DIY-csCNC_hardware (13) DIY-csCNC_hardware (14) DIY-csCNC_hardware (16) DIY-csCNC_hardware (15)

DIY-csCNC_hardware (16)

8# Installed the lead screw and X motor. A small rubber pipe from Car tier inflation pump is used as coupler. Installed L shape brackets for fixing base plates.

DIY-csCNC_hardware (17) DIY-csCNC_hardware (18) DIY-csCNC_hardware (19)


9# Tested alignment of rails and moving bed by rotating the lead screw by hand. After this, all linear barrings and moving lead screw nut with AB glue.

DIY-csCNC_hardware (24) DIY-csCNC_hardware (25) DIY-csCNC_hardware (26)

10# Cut and prepared for Y axis base. Use the same technique for X axis. Y axis , lead screw, linear barrings, nut and motor mount are finished.

DIY-csCNC_hardware (27) DIY-csCNC_hardware (28) DIY-csCNC_hardware (29) DIY-csCNC_hardware (31) DIY-csCNC_hardware (32)


11# Designed and cut the fixed mount for Z axis.

DIY-csCNC_hardware (33) DIY-csCNC_hardware (34)


12# Finished for Z axis motor mount and lead screw coupling.

DIY-csCNC_hardware (38)






DIY-csCNC_hardware (35) DIY-csCNC_hardware (36)

13# Finished spindle mount and moving rails parts.

DIY-csCNC_hardware (37)

DIY-csCNC_hardware (39)

14# Fixed everything except spindle mount.

DIY-csCNC_hardware (40)

Next parts is electronics, controllers and motor parts. Stayed tuned.

By Oakkar7


$10 China GSM Phone

We have seen how new Iphone shakes the market. How about low tech phones  and how much a handset cab be cheap? Last year, I saw Bunnie’s blog post about a cheap $12 Gongkai handset from Mingtong Digital Mall in Shenzhen.  Gongkai means “Open” in Chinese and it’s the term alternative of “Open Source”. Mingtong Digital Mall is one of the famous digital gadget’s malls from Shenzhen especially cheap and copy items. I wondered how these cheap handset could be sold in this low price when I saw his blog post.

I lived in Myanmar, yes a green land opened it’s door recently. The government released telecom sector and has given the two new operators, Telenor and Ooredoo. Just a clarification, some may don’t know how Myanmar telecom sector is squeezed before 2000. I bet you will wonder how much it will cost for a mobile SIM card before 2000. It was cost about $5000 (Please up your jaw, I am not kidding :D). In last decade, owning a mobile phone was a trade mark of being a “boss” in Myanmar. Most people used a public pay land lines phone booth in every sight of cites. Seem these will soon be a history. But for now, news operators are moving and it costs  about only $1.5.

Have you ever seen people queuing for a cheap SIM card?



Yesterday, one of my colleagues showed me a GSM handset with a surprised price tag, 10000 MMK.  It is about $10 (1$ = 986 MMK). I quickly checked specs and my curiosity leaded me to bought one. It is a normal low price GSM handset with basic functions. I saw many cheap China handset but non are not lower than $20. This is the cheapest handset I have ever seen. Note that Bunnie’s Gongkai Phone is $12 at China, main land but I bought my $10 phone from local retail shop from Mandalay, Myanmar. More surprising fact is that my friend told me wholesale price is >$9. If this is right, how much it will be the ground cost of these handset in it’ts origin, China!! Unbelievable. Here is my cheapo handset. It is just ordinary phone but specs are even a little higher than Bunnie’s phone come with a box, handset, a battery, charger and a hands free earpiece.

DSCN7341 DSCN7344


The spec and functions listed on the box,

  • Touch
  • FM Radio
  • Music Player
  • Video player, recorder
  • MicroSD
  • Camera
  • Bluetooth
  • Multi languages
  • 1.8″ Display
  • Dual SIM (Dual standby) , Stereo Speaker (Really, only one Speaker), Games

DSCN7342 DSCN7343


The brand is Soloking and model is T176. I quickly searched google and searched more info.

  • Platform                       : coolsand 8851
  • Operation System      : Mstar
  • Build in memory        : 32+16 Mbt
  • Frequency                    :  GSM 900/1800   optional   850/9001800/1900
  • Multi Media                 : MP3/MP4/3GP/FM Radio / Bluetooth Camera 0.3 Mega Pixels
  • Multi Function Torch : Alarm ,Calendar ,Calculator ,Audio recorder ,Video recorder
  • Flash Card Support     : T-Flash Card Max support to 8GB
  • Languages Multi language : Arabic,French,Turkish, Thai,Vietnam,Russian, English, Hindi, Indonesian, Spanish etc

I installed battery, SIM and power up the phone.



Tested basic functions call, menu, camera, FM etc. DSCN7352 DSCN7356 DSCN7359

– FM


– It supports Java.


It even include Myanmar language support. Changed and tested it but some menu were not properly show 🙂 .

DSCN7357   DSCN7358

Finally, I teared down to check how these cheapo was made.

DSCN7363 DSCN7345

Just removed 4 x small screws, everything disassembled.

DSCN7366   DSCN7374     DSCN7369 DSCN7372


Other are usual parts such as speaker, mic,  SIM holder, SD slot, small camera, FM antenna and 2 x LEDs for torch. The phone is controlled by all in one chip.  The back side Speaker housing is attached with multi-band antenna.

  • LCD, this must be a friendly 1.8″ SPI TFT, LCD  (ST7735 controller ) from hobby shop around the world. I even ordered these LCD from elecfreaks  last a few months ago.
  • There is a EMI shield which covered the chip but google infos and some partially label can able to guess  me the main chip. It is RDA8851 from RDA Microelectronics, one of chip manufacturer from China. In short, it’s all in one chip which doo everything for phone such as baseband, interface, Bluetooth, FM, camera, Flash (32Mb build in), UART, SPI, I2C etc. Here is the links to chip datasheet.
  • Firmware is Mstar from MStar Semiconductor, Taiwan . From  Wiki , MStar is often referred as “Little-M” in Chinese community, as a contrary part of the bigger company “Big-M”, MediaTek.

– The only weakness of this phone (in comparable this price) is it’s charger. I also opened and checked the charger design. It voids all of safety rules. Manufacturer should include a more safe charger with a buck. The stock charger is one of the simplest and reduced version without any protection of it’s line. The design includes 13001 NPN Epitaxial Silicon Transistor,  1 IN4001 diode rectifier, small SMPS transformer, 5V zener, 3 capacitors and some resistors, that’s all. The output voltage is about 6V.


Final thought:

– First, I don’t expect much from this phone but the price is really amazed for me. It is a bare phone without no contract and unlocked. It exported from china to Myanmar. What will be local retail price and how much it can be lower?

– The cost of the phone is the parts and production costs plus a little export costs. There will be absolutely NO licensing, copy cats fee 🙂 and seem no certification.

– Everybody talks about SAR. But I think the RDA chip can take care of this in a basic level. The package label state that SAR Head : 0.342 W/Kg(1g) and body : 0.429 W/Kg (1g).

– I know that designing a mobile phone is not that hard. I designed my own DIY mobile phone recently with a basic functions like this phone with the same LCD. Even LCD it self costs about $6.4  in some ebay retail shops. What will be the lowest bargain price of this LCD? (I believe the LCD must be the most value part in this phone. Any idea?)

– For the chip, I don’t know how much cost for this RDA chip in volume and in retail. Bunnie said that MT6250 chip from his Gongkai Phone in retail price is $2.1.

– If someone knows about these, let me know and also share your thought.

Last :

Again, it is not rocket science to build a mobile phone. This is my DIY GSM mobile phone prototype which I recently developed for fun and hobby. Some basic functions such as call, sms, GPS are done and still working for a complete prototype. But, you may not defeat China at least in quantity and cost :D. Thanks for visiting.


By oakkar7

Fixing and Reverse Engineering Cheap Temperature Controlled Soldering Iron

Last year, I bought a temperature controlled soldering iron from local supplier. I bought a hot air rework station soon and I seldom used this iron because new rework station also has a temperature controlled iron. I like the idea of this iron because of its design. It is not like others temp-controlled soldering stations. See the photo.

Here is close up. You can see inside circuitry.

It is just an iron and temp-control circuit is inside it’s handle.  No dedicated controlled station like famous Weller gun. There is a knob at handle to adjust temperature from 100~400 C.  Yes, it is made  in china. The price is very cheap, about 5$ (do you believe it or not). But the quality and performance is quite good.

One day, I used this iron and it was not working. So, I opened fixed it. Fixing is quite simple and I checked the fault within minute.

– Removed the screw and knob first.

– I checked circuit.You can see an IC, components and a Triac. There is no SMD devices or expensive, complex thing. I noticed that there are 4 wires output to heat element tube. Interesting, I first thought there will be no feedback circuit or sensor in such cheap tool. I was wrong. The red-blue pair is a nichrome coil and the white pair is a thermo-couple. It is a closed loop control circuit, unbelievable.

I started to examine the circuit.

The fault was nothing. The soldering joint of heat coil was dry. Soldering directly to a nichrome coil is not a good idea in such circuit. It should be crimped. But this is no room for this and I just do re-soldering the joint with acid paste flux (which can help to solder metal joint like nichrome, tin sheet ect.. Don’t forget to clean the joint after soldering, acid from flux may conduct your circuit lines). Then, the iron worked again.

I started checking the circuit detailed. The IC is simple common Op-Amp, LM358, low power dual operational amplifier. The Triac is MAC97A6, logic level triac. This means that this Triac can be directly switched with logic level, 5V.

The close up,

As usual, I tried to trace the circuit with the help of back light.

This is final circuit.


# Updated 21 July 2015 : Added the value of C and corrected polarity according to Nguyen Ngoc comment, Thanks.

– The principle of circuit operation is simple. The Op-Amps are configured as comparator. The Triac drive directly by Op-Amp2 via C and LED1. The thermo couple is connected to U1, non-inverting input. The preset VR1 is used to adjust the comparator reference voltage. When temperature is lower than preset, the output of U1 will be lowered than U2 non-inverting input, The output of U2 will be high state and switch on Triac to heat up iron. When temperature is reached to set-point and U1 output will changed to high and U2 output will set to low to switch of Triac.

– The C1,ZD1, D2 and R7 are a simple transformeless zener regulator supply.

-Although it is not a linear feedback controlled circuit, it works, at least for this type of iron. Quite a simple and working design. You cannot defeat china 🙂 .

– I haven’t construct this circuit yet. If you want to construct, I cannot grantee it will work. Do it at your own.  If any one have experience on this, pls let me know.

#Updated August, 2015.

“who care”(may be someone 🙂 ) shared this schematic with some useful calibration tips. Thank a lot. If someone has experience in these tips, pls share your experience also.


Testing MPLABX and Open Bench Logic Analyzer (part-2)

The previous post is about the installation, developing and programming of logic analyzer testing circuit with MPLABX. Now, it is time to test with my new OBLS. Connect all input test connectors with PIC PORTB pins and also ground. Power up the circuit.

First, I tested the circuit with oscilloscope to sure the code and circuit are working. Good, output signals are generating. I tested all pins of PIC PORTB. As expected, pin-1 output frequency is twice of pin-2, pin-2 also twice of pin-3 and so on.

There are several of client software to use with OBLS.

I don’t want to use .NET and python. Sigrok is not released yet. RCP client is still initial phase but has some distant features such as frequency and distance measurement.  I also prefer cross platform feature. So, I tested SUMP client and OLS client.

The SUMP client has a installer and installation is straight forward. I like the installer from Gadget factory. There is the original client here but I don’t want to mess with RTTX dependency (used for java serial port support).

For some clients, when you plugin analyzer USB cable to PC, point the driver for “mchpcdc.inf” file. Find in the zip package for “driver” folders and select this file.

The next is OLS client. It is just a zip package and unzip it to required place to install.

– To start measurement, start OLS client

– At menu bar, select  Capture–> Device –> Openbench LogicSniffer.

– At menu bar, select Capture–> Begincapture

– Select Serial port , my PC port is COM12. Leave port speed : 112500 and device : Openbench Logicsniffer.

– You may need to set Acquisition tab for more utilization. Most interested option are Sampling rate and recording size.

– For sampling rate, you can set the highest “200MHz” if you don’t to brother. For rule of thumb, the sampling rate should be twice of measuring signal. ie: if you want to measure 9600 kbps UART output, sampling rate should be 20kHz at least.

– For Recording size, you can check “Automatic” if you don”t brother. For rule of thumb, OBLS support, 24K samples for 8 inputs channel. If you use 16 channel inputs, it will reduced to 12K proportionally. For 24 inputs, it is 8K and so on.

– It is a good idea to check “Noise Filter” to prevent transition spike.

– My test don’t need trigger and leave it. OLS also supports single  trigger or complex trigger mode. For more detailed, here is tutorials in DP site.

– Then click “Capture” to start  capturing.

And here the result is. All hardware, softwares and OLS, OBLS are working well.


– Both clients work well and the core functions are the same.

– Personally, I prefer OLS client interface more, its interface is cool

– OLS client can be easily created new plugins with just a putting a file. I want to learn more about this function. Can I add new protocol decoding function as simple RC5 or complex LIN? Can some one point me out?

– I have an idea to test 200MHz sampling capability. I will update soon.

Updated :

Testing MPLABX and Open Bench Logic Analyzer (part-1)

I am a long time fan of PIC microcontroller. I used MPLAD IDE since I learned PIC. Now, developers of Microchip prepared a turn point for their IDE and development platform. The MPLABX is a beta stage IDE for past and upcoming microcontroller development. I like the way of AVR (totally free, flexible and open) and seem Microchip also want to turn this way. Some distant features of their partially open source MPLABX ( I mean partially because it is not fully open source,  IDE is open but compiler and libs are still closed 😛 ) are-

  • Used open sourced IDE , NetBean
  • Mostly open source, free software components and plug -ins (Microchip used WinUSB/LibUSB for USB rather than their propitery USB stack)
  • Crossed platform, Support Subversion, CVS, Mercurial, bugzellia and tracker and most opensoure features of NetBean
  • Seem the most useful feature “History”, you can forward/backward your change
  • MPLAB8 and X are don’t brother each. You can install both. There is also a con version tool to change 8 project to X
  • Assembler, compiler are not changed

I got my new Open bench logic analyzer last month from Seedstudio. I am also a fan of DangerousPrototypes. So, I created a project to test both MPLABX and OBLS.

The idea is simple. To create an 8bits signal generator with PIC. The software project is developed by MPLABX and  target hardware is PIC16F628A. I used this PIC because it is cheap and fast (20MHz clock) in low end controllers series.

First I download MPLABX from here. The installer is about 220M. I don’t nee others C30, C32 compiler at the moment. You can download if you want to use them.

I choosethe following along with IDE.

  • PIC18C lite
  • Hitech C lite
  • HitechC pro lite

You may need latest Java.

Installation is straight forward and finished about 15 mins.

After that, installed C18 and HitechC lite version.The are separate installers. You need to download and installed separately.

Then, Hitech C  lites. The installation style of both HitechC lite and pro are the same except you can choosed trial and lite versions in installati

Then, launch MPLABX…

The four panes as usual IDE, project, project , navigator, editor and output. The two bars, menu and editor. There is also error stripe beside editor window.

There is a guide “Getting started with MPLABX” in web site. But this is exampled with high end PIC and C18 compiler. Not with low end PIC and free MPASM assembler.So, I listed my work here.

– Starting a project

Click on the New Project icon on the toolbar, or select File –> New Project from the menu.

– Select Microchip Embedded under Categories and select C/ASM Standalone Project under Projects.
– Click Next.

– Select Device –> Family: All Families  –> Device: PIC16F628A and Next

– You can select header for debug. I don’t need at the moment and skip it by clicking just “Next”

– I want to use PICKit2 and select it. If you have any tools from listed, you can choose. If you dont have any listed device, just choose “Simulator”.

– Select Compiler –> Mpasm, I choosed this I want to write the code in Assembly. If you want to use listed compiler, you can select here.

– Select where do you want to store your project.

– Click Next and project creation is done. There is a project “logictester” in project pane and infos, setting about the project is shown in navigation.

– This is just the beginning. There is no source file in project. I copy the template “16F628ATEMP” from ../MPLABX/MPASM30/templates/code folder to project ../logictester/nbproject  folder.

– Right click “Source” in project windows and select “Add existing Item..” and choose 16F628ATEMP. Click the file name and rename the file as “logictest”. Make sure to choose Store path as: to “Relative”.

– There is a source “logictest” under source “Source Files” in project window. Double click it to open at editor window.

–  Edit the code as follow. I want to develop the code in assembly to get both speed and optimization. The code is quite simple, just an software base 8-bits counter and output to PORTB of PIC. The software counter will increase from zero to 255 (in binary, 00000000~11111111) and loop forever. Each counter value will be output t0 PORTB simultaneously.  Thus, all 8-pins of PORTB generate frequency twice of its’ lower pin. If LSB pin-1 generates 1MHz, most MSB pin-2 will generate 500 KHz and so on.

the rough pseudo code is:


PORTB = 00000000

PORTB = 00000001

PORTB = 00000010

PORTB = 00000011

PORTB = 00000100



PORTB = 11111110

PORTB = 11111111


logic tester source

– Build the circuit and attached with my DIY PICKit2 clone. The circuit is quite simple, a 16F628A, 20MHz crystal, 2x22pf capacitors and +5V power.

– To build project, Click on the Debug Project toolbar button.  Building the code for debugging, programming the target and running the program should done.

– Oops, an error show device ID is wrong. I manually checked with PICkit2 standalone programmer software that PIC and PICkit2 are connected well and the device is surely chosen 628A. I am no idea about this error. So, I just click “yes”.

– The message show that building is complete.

– When done, click on Pause then End Debug Session.

– Then, I tested by click “Program Target” on main tool bar. This can also make and program to target. Not need to click Build or debug. It also show the same error but click “yes” and shows building successful and loading complete.

–  Some issues are,

  • I noticed about MPLABX, PICkit2 support here
  • The connection  with PicKit2 shows also error in debug tool
  • Although errors are shown, the building  project  is done. There is also a hex file “logictester.X.production.HEX” under ../dist/default/production folder.
  • The programming to target is also done. I rechecked manually with PicKit2 standalone program. The hex file is successfully loaded to PIC.
  • Some facts checking at  “MPLABX Beta Limmitations” page on IDE start page
  • At “Device and Compiler” support table, PICkit2 and ICD2 are listed

  • At “MPLAB X IDE Features Surpotted” table, device debug header for ICD2 and Pickit2 are not listed

  • From the current issues, ICD2 is not supported yet.
i. There is no Debug Header support at this time for ICD2.

– Conclusion

  • Pickit2 is supported  but not fully yet (can program the target although it shows error).
  • ICD2 is not supported yet
  • I don’t know why the device ID error is shown. If any one know about this, please point me out.
  • It is a good IDE. I love to use such IDE and functions.
  • Although IDE is open, Microchip don’t open or free to it’s C compiler. Lite versions are very limited. Hopefully they change the way of AVR one day. If not, they will loose new generation of developer, students, researchers (like me) who they cannot earn much money for development tools. So, the reason which I use this IDE is will be when I need to develop in Assembly not in C.

– My project source codes

PIC 16F828A Logic Tester

– Refrences;

Next post, I will post testing with OBLS. Stay tune.