Tuesday, May 26, 2015

BROKEN YOUR AVR CHIP?

While working the avr for the first time it is always confusing while programing the fuse bits as wrong configuration of this can damage the chip or may be lock the chip so you cannot program it normally.

If your making a bare bone arduino or burning arduino boot loader the fuse bits if programmed wrong can lock the device. This often happens due to some of the following fuse bits.
A. First thing you are being greedy of that single reset pin to use it as gpio. But you will be programming it only once as after that fuse setting to use reset as gpio avr can't be programmed using ISP as ISP programming requires external reset operations . so you need to do the high voltage programming either serial or parallel.
For the he high voltage programming you can consult the avr data sheet where it is described crystal clear and also there are many tutorials available online for this problem.




Also choosing external clock source can also result avr to not work using ISP in this case high voltage programming can be used or a external TTL clock should be used for the programming.

Heres the line copied from datasheet of high voltage programming. 

The following algorithm puts the device in Parallel (High-voltage) Programming mode:

1. Set Prog_enable pins listed in Table 28-12 on page 290 to “0000”, RESET pin to 0V and
VCC to 0V.

2. Apply 4.5V - 5.5V between VCC and GND.
Ensure that VCC reaches at least 1.8V within the next 20μs.

3. Wait 20μs - 60μs, and apply 11.5V - 12.5V to RESET.

4. Keep the Prog_enable pins unchanged for at least 10μs after the High-voltage has been
applied to ensure the Prog_enable Signature has been latched.

5. Wait at least 300μs before giving any parallel programming commands.

6. Exit Programming mode by power the device down or by bringing RESET pin to 0V.

If the rise time of the VCC is unable to fulfill the requirements listed above, the following alternative
algorithm can be used.

1. Set Prog_enable pins listed in Table 28-12 on page 290 to “0000”, RESET pin to 0V and
VCC to 0V.

2. Apply 4.5V - 5.5V between VCC and GND.

3. Monitor VCC, and as soon as VCC reaches 0.9V - 1.1V, apply 11.5V - 12.5V to RESET.

4. Keep the Prog_enable pins unchanged for at least 10μs after the High-voltage has been
applied to ensure the Prog_enable Signature has been latched.

5. Wait until VCC actually reaches 4.5V - 5.5V before giving any parallel programming
commands.

6. Exit Programming mode by power the device down or by bringing RESET pin to 0V.



Monday, May 25, 2015

PIC vs AVR #30 #2

This is the second part of the pic and avr. One of the benefit of the avr is programming.

For the programming or firmware development avr gives AVR studio which is a very good IDE and most important for beginner is it's free. AVR studio gives most of the libraries for their micro controllers and also for the different boards made by ATMEL. 

Also one of the most important benefit that you get from AVR's 8 bit controllers is arduino. Arduino is a open source project. You can visit www.arduino.cc for more informations. Its based on AVR and most popular is ATMEGA328. You can use almost any other microcontrollers. 

For the beginners who are not so into the hardware of microcontroller thing and also with the hardware or internal things of the controller. Arduino make programming so easy that any can interface any hardware to it.

PIC on the other hand also provide their own IDE, MPLAB X , it uses a separate compiler. The bad thing is its not free. There's also a free version which does all the job done for the beginner but what the free version is not giving us is maximum code optimization . Paid version of MPLAB  gives the maximum optimization which is more that 50 % of the code size of the free version. 

PIC also provide some of the libraries for its users , also MIKRO C gives some simple programming interface for the PIC which is the third party PIC IDE. 

These are some of the things to compare between the PIC and AVR. Further on its on you to choose between PIC or AVR. 

Saturday, May 23, 2015

PIC VS AVR MICROCONTROLLER #29 #1

For the starters it is always the question in mind whether to use PIC microcontroller or AVR microcontroller. PIC manufacutred by MICROCHIP and AVR by ATMEL is beginner level 8 bit micorcontrollers which every beginner use.

If your starting a project or starting to learn some more on controllers which to follow. I list out some of my points on both controllers their pros and cons.

Moving on to PIC ,  PIC's 8 bit series 16F and 18F are the most popular one. These PIC controllers are available in package like SSOP,SOIC,DIP,QFN,QFP. 

If your project is power sensitive PIC is the best. PIC's nanoWatt XLP series have very low power. They in even go to micro Ampere current range when in Deep Sleep. Though AVRs got the power control like sleep, stand by modes but PIC is better than AVR in this matter.

Other benefit that PICs got is PIC has more features in chip than AVR. They have more peripheral fetures and control than AVR . PICS got many standard like ECAN, more CCP and ECCP channels and controls more AD converter channels than AVR. 

Its not like AVR got no such feature AVR's also got the same feature but AVR's got less flexibility in these things. 

Thing in which AVR dominates PIC is in my case TIMERS, In AVR timers got more controls than in PIC. Handling timers in AVR is always easy than PIC.

In term of cost both are same , but some PICs are cheaper in compared to AVR.