iPhone at last
Apr0
For a long time I wanted to have an iPhone. As my work and education is all around technology, computers and touch this was somekind of must have. Altough this is a really expensive gadget…. As if it wasn’t enought it’s base price, you still need to afford a monthly plan with a telecommunications operator. Is too much for me!
Well, in the other day I though about searching for some used iPhones on eBay. After watching some items ended I realized that buying a iPhone for 200 pounds in the UK ebay was the normal thing to happen. Then I say an item with a clear description, it was in a brick state. The seller was saying that it was unlocked but it became locked from one day to another. The only thing visible on the screen was an image telling “No sim card installed” and below “Insert a valid SIM with no pin lock to activate iPhone”. Well, I took the risk and bid it with a maximum of 150 pounds. I won it!
After that I started to dig out information on how to make usable again. I knew nothing of iPhone’s until the day it arrived. The only thing I knew was that I couldn’t make updates from iTunes taking the risk of getting it unlockable. I also didn’t knew which version of the firmware as installed and as well as the baseband version. But believe that the last owner made an upgrade via itunes making it unactivated. I had already the pwnage tool and the latest firmware to make a custom firmware but iTunes didn’t let me to restore the custom hardware. The iPhone was in a such state that only making a restore to factory defaults was possible with iTunes.
I have even oppened it to see of there was something wrong with the sim card slot. And yeah, there was. Two of the contacts of the SIM card inner tray were broken. But at the moment that wasn’t my biggest concern. I was around and around until I found the version 0.94 of the redsn0wn tool available for Windows and Mac OSX. I also found a blog post telling me how to jailbreak the latest firmware available so I cross my fingers and took my chance. Guess what, it worked! But no miracles happened. It have 3.1.3 firmware running but the baseband version is the 05.12.01 which it’s not unlockable at the moment. So I now have to wait for those brillants guys from dev team as well as other iPhone hackers can make the wonderfull job of publish a new tool!
I also need to replace that inner tray otherwise the iPhone will not read the SIM card anyway. I now have a 75% usable iPhone for 150 pounds. Nice deal!
HSV color changing led driven by AVR tiny45
Jun0
In my last post I focused on delivering an integer only based algorithm to make a HSV to RGB conversion. I wanted to to drive a mood lamp with an AVR tiny13 which as only a 1K byte program memory. I ended gaving up on this idea because, I was not having good results.
I decided to get a new chip, with more program memory. The chosen one was the tiny45 with 4K bytes of program memory.
I got back in time and started again with the floating point version of the algorithm. And voila! It is working. It has a few glitches which increase with a small interval between color changing.
At this point, the code is very simple and it is like this (assumes a 2Mhz clock on the tiny45):
-
-
#include <avr/io.h>
-
#include <avr/interrupt.h>
-
#include <avr/pgmspace.h>
-
#include <avr/eeprom.h>
-
#include <avr/wdt.h>
-
#include <util/delay.h>
-
#include <math.h>
-
-
#define R_PIN PB0
-
#define G_PIN PB1
-
#define B_PIN PB2
-
-
static float h=0,s=0.8,v=0.5,r=0,g=0,b=0;
-
static int ri,gi,bi;
-
-
void HSVtoRGB( float *r, float *g, float *b, float h, float s, float v )
-
{
-
int i;
-
float f, p, q, t;
-
-
if( s == 0 ) {
-
*r = *g = *b = v; // achromatic (grey)
-
return;
-
}
-
-
h /= 60; // sector 0 to 5
-
i = floor( h );
-
f = h – i; // factorial part of h
-
p = v * ( 1 – s );
-
q = v * ( 1 – s * f );
-
t = v * ( 1 – s * ( 1 – f ) );
-
-
switch( i )
-
{
-
case 0:
-
*r = v;
-
*g = t;
-
*b = p;
-
break;
-
case 1:
-
*r = q;
-
*g = v;
-
*b = p;
-
break;
-
case 2:
-
*r = p;
-
*g = v;
-
*b = t;
-
break;
-
case 3:
-
*r = p;
-
*g = q;
-
*b = v;
-
break;
-
case 4:
-
*r = t;
-
*g = p;
-
*b = v;
-
break;
-
default:
-
*r = v;
-
*g = p;
-
*b = q;
-
break;
-
}
-
}
-
-
ISR(TIM0_COMPA_vect)
-
{
-
static unsigned char count = 0;
-
-
if (count == 0)
-
PORTB = _BV(R_PIN) | _BV(G_PIN) | _BV(B_PIN);
-
-
if (count==ri)
-
PORTB^=_BV(R_PIN);
-
-
if (count==gi)
-
PORTB^=_BV(G_PIN);
-
-
if (count==bi)
-
PORTB^=_BV(B_PIN);
-
-
count++;
-
}
-
-
int main()
-
{
-
// Enable PORTB as output
-
DDRB=0xff;
-
-
// Enable global interrupts
-
sei();
-
-
// Setting timer in CTC mode
-
TCCR0A = _BV(WGM01);
-
-
// Setting no prescaler
-
TCCR0B = _BV(CS00);
-
-
// Enabling compa
-
TIMSK = _BV(OCIE0A);
-
-
// Setting compare to make a frequency of 60*256 Hz
-
OCR0A = 0×82;
-
-
while(1)
-
{
-
if (h==360)
-
h=0;
-
-
h++;
-
-
HSVtoRGB(&r,&g,&b,h,s,v);
-
-
ri = r*255.;
-
gi = g*255.;
-
bi = b*255.;
-
-
_delay_ms(100);
-
}
-
-
return 0;
-
}
-
-
How to setup PWM on a AVR (Part II)
Jun0
In my last post I have described a little bit of what PWM is and which are the abstract steps are necessary to be executed. Now let’s go to the code. This code assumes a Tiny 13 AVR with an internal oscilator of 9.6 MHz divided by 8 (fuses configuration).
-
int main()
-
{
-
// Enable PORTB as output
-
DDRB=0xff;
-
-
// Enable global interrupts
-
sei();
-
-
// Enabling Timer 0 Fast PWM mode
-
TCCR0A = _BV(WGM01) | _BV(WGM00) | _BV(COM0A1);
-
-
// Setting Prescaler to none
-
TCCR0B = _BV(CS00);
-
-
// Setting the duty cycle to 50%
-
OCR0A = 0x7f;
-
-
while(1);
-
}
And that’s it. This code enables a PWM with a 50% duty cycle and controls a led connected to PB0 pin. If you need to give to led full intensity, then OCR1A must be set to 0xff, if you want the less intensity possible you need to set OCR1A to 0×00.
How to setup PWM on a AVR (Part I)
Jun0
I have been trying to make the setup of a PWM with an AVR. My wish is to build my own mood lamp. I divided my problem into smaller problems which the most basic is the generation of a PWM signal to control the brightness of the led.
PWM stands for Pulse Width Modulation and it consists in generating a square wave with a variable duty cycle. Imagine a perfect square wave, that half of the cycle is up and another half is down. That wave as a duty cycle of 50%.
If you power a lamp with this signal and give the up value 5 volts, at 50 Hz, it means that it will receive a 2.5 voltage 50 times per second, because 2.5 its the mean value along the time.
If you change the duty cycle you can obtain a full on, or a full of. This is simple explanation and lot can be found about PWM googling a little bit.
To make an AVR generate a PWM signal you just need to do the following:
- Setup a timer to a PWM mode.
- Enable global interrupts
- Enable port as output
My next post will be about more pratical and it will focus on how to implement led intensity change on a Tiny13 AVR using PWM.
Finally, my hackintosh rules!
May0
I love Mac OSX, it mixes the Linux power with the beautiness of Apple design and usability! I have a nice machine and I wanted for so long to have a nice desktop computer at my hands.
It happens that when I first bought the computer, I had to install Vista on it, as I was working on a WPF project. After the install the performance was nice, but nothing awesome, but after a few programs installations and general use the performance dropped considerably.
I decided to try OSX86 on it. I got iPC 10.5.6 and installed. It installed and the performance was great but I hadn’t a Nvidia graphics card, so I needed to find one.
I got from ebay a 7300 GT card, and yesterday when it arrived, the first thing to was change the card and try to install the drivers. Guess what! My hackintosh rules!

My setup consists on:
- ASUS P5K-C motherboard
- XFX Nvidia 7300 GT 512 Mb
- Builtin sound card from motherboard
- Builtin ethernet
I decided to put this info out in order to help people with the same configuration as it was difficult to find support for this board. I had to try things out by myself.
For example, after the installation there was no pen drive support, no sound, no sleep.
The required kernel extensions were the following:
- Seatbelt
- Taruga ALC88X
- NVDarwin
However not everything is working perfectly yet! Restart isn’t working and coming from sleep breaks the ethernet module, so internet stops working.
Still need to find solution for this!
