Jeffrey's Log

Archives | Subscribe


Newer posts
Older posts

Hardware hack for Phoenix-MDK

Published on: February 13, 2011


Please don’t forget to read this post before coming here.

For the newly developed Phoenix-MDK, I suggested few hardware modifications. Among them was the hardware modification for resetting the Phoenix-MDK through software i.e the user doesn’t have to press the reset button on the board to load a new program. I copied the design of software resetting from Arduino project.

The plan was to reset the controller using two pins i.e there was a pin (RTS) coming from the FTDI chip connected via a 100Kohm resistor to the reset pin of the ATMega32 and also a pin (DTR) from FTDI chip connected via a 100Kohm resistor to the PD2 pin of ATMega32. The two 100Kohm resistor was for current limit. So when the user wants to flash a software, he has to hold the PD2 down (because bootloader will wait for code from serial port only if this pin is low), send LOW pulse on RESET. Then Avrdude loads the code, take PD2 high and then send a Reset pulse again.

When I checked the Arduino design, they were only using the RESET pin to load the software using Avrdude. Arduino bootloader loaded the code in the following manner – Send a reset pulse. The bootloader will wait for the software from serial port . If the data is coming, then they will write the flash memory using that data or else they will jump to the main code. The greatest advantage over here was of using only one pin (DTR) of the FTDI chip to load the software.

I adapted the same design to the Phoenix-MDK. Now The other pin (RTS) need not be used i.e the DTR pin of FTDI chip was connected to the RESET pin of ATMega32 via 100nF capacitor. So we saved one pin (PD2) of ATMega32 which is not used in the new design.

The below python code can flash code to Phoenix-MDK (written by Pramode).

import serial, time<br /> import os, sys<br /> fd = serial.Serial(port='/dev/ttyUSB0', baudrate=19200)<br /> print fd<br /> fd.setDTR(1)<br /> time.sleep(.1)<br /> fd.setDTR(0)<br /> cmd = 'avrdude -b 19200 -P /dev/ttyUSB0 -pm32 -c stk500v1 -U ' + sys.argv[1]<br /> os.system(cmd)

Usage:

1) Save the above code as load.py

2) Write the code which you want to run on ATMega32 and Compile the code using avr-gcc.

avr-gcc -mmcu=atmega32 -Os filename.c__

3) Convert a.out to hex file

avr-objcopy -j .text -j .data -O ihex a.out a.hex

4) Load the hex to Phoenix-MDK

python load.py a.hex

Update: I will soon upload the pics of newly developed Phoenix-MDK .


Experiments with Phoenix-MDK

Published on: February 13, 2011


Today I got a chance to do some hacks on Phoenix-MDK. There was a need of a bootloader for this board. Along with that, we should be able to program the board without hitting any reset switch. The first thing which came into my mind was the arduino boards. They had all the above mentioned features. So I started understanding how the arduino board works, which boot loader is used inside, how reset can be triggered through software etc.

The bootloader used in arduino’s are the optiboot which has a very small footprint (around 512kb) and it was using the serial protocol STK500 for its communication. So I took the optiboot and made some modifications. But it failed. I don’t know where I went wrong and also I bricked one ATMega32 chip.

I had one more ATMega32 chip with me. But this time I was really careful not to brick again a chip. It was really hard to find a bootloader. After a long search I found this page which really helped me a lot – http://wiki.edwindertien.nl/doku.php?id=software:bootloaders

The bootloader can be obtained from http://wiki.edwindertien.nl/lib/exe/fetch.php?media=software:atmegaboot-32.zip. Phoenix-MDK uses 8MHz crystal. So I had to modify a line in the makefile which contains the clock frequency to AVR_FREQ = 8000000L . Thats all. I gave a make and got the hex file.

Below are the steps for flashing the bootloader and using it.

1) Flashing the bootloader using parallel programmer

flashing the hex:

avrdude -c dapa -patmega32 -U flash:w:ATmegaBOOT_168_atmega32.hex

flashing the fuse:

avrdude -c dapa -patmega32 -U lfuse:w:0xff:m -U hfuse:w:0xda:m

2) Testing the bootloader

avrdude -b 19200 -P /dev/ttyUSB0 -pm32 -c stk500v1 -n

This should give a proper response.

3)Uploading a hex file using the serial bootloader

avrdude -b 19200 -P /dev/ttyUSB0 -pm32 -c stk500v1 -U flash:w:a.hex

For the above code to work on Phoenix-MDK, I also had to do some hardware hack. Now the DTR pin is connected to the reset pin so that reset can be done by software. I have to find a software way to reset the chip.


LPC2148 (ARM 7) Test bench setup

Published on: November 21, 2010


This is my LPC2148 (ARM 7) test bench setup.

The LPC2148 header board was bought from Rhydo Labz. You cannot directly power up and start to use. It lacks communication interface. To flash the controller, you need a serial port or a JTAG port. Since this board doesn’t have these port connectors, you need to solder them. So it might be hard for a newbie.

Instead of this board, you can try the BlueBoard which has all the port connectors. I will recommend this for a newbie. I hope that board is worth for its price.

The next thing which you need is a power supply to power the board. You can build your own power supply (If someone needs to know how to build a power supply, I will write a tutorial. But please put a comment in this post saying that you need the tutorial.) ,or you can buy 5V DC power supply (adapters).

Once the board is powered up, it can start to execute your code in its memory. But a fresh controller wont be having any code in its memory to execute. You need a programmer to load the code into its memory. But the LPC series controllers have built-in serial boot-loaders. These boot-loaders can get the code from the serial port and write into its flash memory. So you don’t need a programmer.

To program the controller using the serial boot-loader, you just need to connect the controller to the host PC and the host PC needs to run a serial programmer software. You can get a lot of serial programmer software for LPC controllers. Some of them are

So thats all. Power up the board and connect the serial port to the controller. Run the serial programmer software in the PC. You controller will execute the code flashed into its memory.

But wait. From where you can get the hex file to flash into its memory? Its simple. You just need a cross-compiler. To the cross-compiler, you just need to feed your C source file. It will compile and give you *.out files, which later can be converted into *.hex files.

I will soon try to post a wiki page about how to compile and flash the code into the memory.


Cooking GNUduino

Published on: October 09, 2010


Today I fabricated the PCB for GNUduino (Arduino made with gEDA). I used screen printing to transfer the PCB layout. Screen printing is another way to transfer the PCB layout to the copper clad instead of the conventional toner transfer method. Download GNUduino  design files

The PCB was successfully fabricated and also tested the LED blink sketch. Everything is working fine.

NOTE: The below shown are only prototype’s to verify the design. High quality PCB’s cab be made with the design files.

Here are some snapshots

The screen printed copper clad’s

screen printed copper clad's of GNUduino

Etching the PCB

Etching GNUduino

After drilling holes

Drill holes in GNUduino

GNUduino is ready

GNUduino - Arduino made with gEDA


GNUduino – Arduino made with gEDA

Published on: October 08, 2010


GNUduino is an Arduino board (Arduino Single-Sided Serial Board Version 3) redrawn using gEDA. GNUduino functions same as that of an Arduino board (It’s just a clone of Arduino ).

When I saw the existing Arduino boards, I felt there is still a freedom missing. The existing Arduino boards are designed using a proprietary CAD tool. But GNUduino is free from those. It is designed using a complete free Schematic and PCB CAD tool named gEDA. This is my first Open Hardware project.

I would like to say special thanks to Pramode Sir for suggesting this name for the board.

You can download the schematic and PCB layout files from the below link

http://github.com/jeffreyantony/GNUduino

Update: Cooking GNUduino



Newer posts
Older posts

Made using Jekyll, Twitter Bootstrap, Code Prettify and Font Awesome.

Copyright (C) 2008 - 2021 Jeffrey.