Show Posts
Pages: [1]
1  Using Arduino / Project Guidance / IDE "verify" button and "upload" button on: October 15, 2012, 03:03:59 pm
hello
I'm not sure what exactly the buttons do.
I use IDE Arduino 0018. It works well and everything is OK.
There are two buttons "verify" and "upload".
It seems that the "verify" button makes .hex executable.
It seems that the "upload" button makes .hex again and than "uploads" the board.
It would be faster for me if the "upload" process didn't make the .hex again and used the previous generated one. (because I have slow pc).
2  Using Arduino / Microcontrollers / Re: atmega324p bootloader can't write flash [SOLVED] on: October 11, 2012, 02:25:29 pm
Thank you. Today I have found the bug. I forgot change line 119 in ATmegaBOOT.c for chip m324p. Now it works both reading & writing.
Bootloader code is here: http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=1000323#1000323
Code:
$ avrdude -c avrisp -p m324p -P com5 -b 19200 -F -D -U flash:r:readout.hex:i
$ echo 'this one reads the chip'

$ avrdude -c avrisp -p m324p -P com5 -b 19200 -F -D -U flash:w:main.hex:i
$ echo 'this one writes the chip'

$ echo '-c arduino instead of -c avrisp works too'
3  Using Arduino / Microcontrollers / atmega324p bootloader can't write flash [SOLVED] on: October 10, 2012, 02:18:59 pm
Hello,
1/ I have device atmega324p, I downloaded the bootloader from site: https://github.com/magnuskarlsson/SDLogger/wiki/Arduino-howto
2/ I modified a little bit the "Makefile" and "ATmegaBOOT.c" for chip atmega324p, speed 19200, cpu_speed 16MHz
3/ I burned it by avrdragon
4/ I joined RS232-TTL (max232) cabel to PC and to the chip
5/ I made a successful test:
Code:
$ avrdude -c avrisp -p m324p -P com1 -b 19200 -F -U flash:r:readout:i
6/ but writing doesn't work
Code:
$ avrdude -c avrisp -p m324p -P com1 -b 19200 -F -U flash:w:main_blinking.hex:i

What is wrong?
Please any advice how to upload atmega324p chip?
Or does someone provide Arduino IDE files for chip atmega324p?
4  Using Arduino / General Electronics / 3.3V output from uP to 5V input on: April 14, 2011, 11:49:05 am
Hello,
can I connect directly output of Atmel (Atxmega16A4) that is 3.3V system to the input of LCD display (KS0066) that is 5V system? I need only one way data transfer. Or do I have to use pull-ups resistors or for example 74HC04 level shifter/translator.
thx
5  Using Arduino / Programming Questions / Re: Can I write my own .c and .h files and use them with .pde main project? on: February 13, 2011, 11:25:09 am
Hello,
the problem is solved. smiley It works after renaming *.c to *.cpp and after few mistakes correction. Now I know how to split large project.
@Vanyamba Thank you, that was what helped.
Edit1: @PaulS Thank you for the explanation, I try also your way, it works too. I will use it in the future, it seems to be clearer.
Here is the final working project

Code:
/*
file:      FC060.c
project:  
device:    
date:      
desc.:    software timer
*/

#include "FC060.h"
#include <avr/io.h>


T_TMR   tmr1;
T_TMR   tmr2;

void tonTimer(T_TMR *t)
{
  unsigned char sb   ;
  unsigned char value;
  unsigned char preset;
  
  sb     =  t->sb;
  value  =  t->value;
  preset =  t->preset;
  
  if (sb==_BV(EN)){
     sb = (_BV(EN) | _BV(RUN));
     value  = preset;
  }
  if ((TMR_BIT)&&
      (bit_is_set(sb,RUN))){
       value--;
       if (value==0){
         sb = _BV(CPL);
       }
  }

  t->sb = sb;
  t->value = value;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

Code:
/*
file:      FC060.h
project:  
device:    
date:      
desc.:     header file for software timer
*/


#ifndef _FC060_H
#define _FC060_H

#ifdef __cplusplus
extern "C" {
#endif

#include <avr/io.h>

#define EN                     (0)
#define RUN                    (1)
#define CPL                    (2)

#define TMR_BIT               (bit_is_set(ip,7))
// uint8_t ip is defined in main skatch


/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */


// software timer data
typedef struct {
  unsigned char sb   ;  // holds flags
  unsigned char value;  // is value
  unsigned char preset;  // init value
} T_TMR;


/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

extern T_TMR   tmr1;
extern T_TMR   tmr2;
extern uint8_t ip  ;

extern void tonTimer(T_TMR *t);
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

#ifdef __cplusplus
}
#endif

#endif _FC060_H

Code:
// file main.pde
//

#include <avr/io.h>
#include "FC060.h"

#define Q13 13          // here comes the output
#define Q13_1   (PORTB = 0b00100000)
#define Q13_0   (PORTB = 0b00000000)

#define INIT_TIMER_COUNT (6)
#define RESET_TIMER2 (TCNT2 = INIT_TIMER_COUNT)

volatile uint8_t int_counter = 0;
uint8_t ip, hf = 0;
uint8_t tmp;

//  void setup()
//
//
void setup()
{
  setupTMR2();
  Serial.begin(19200);      // open the serial port at 19200 bps:    
  Serial.flush();
  
  tmr1.sb    = _BV(EN);
  tmr1.value  = 0;
  tmr1.preset = 4;
  
  tmr2.sb    =  0;
  tmr2.value  = 0;
  tmr2.preset = 2;
}

void loop()
{
    // check interrupt activity
    tmp = int_counter;
    ip =  tmp & (~hf);
    hf =  tmp;
  
   tonTimer( &tmr1);
   tonTimer( &tmr2);
  
       if (bit_is_set(tmr1.sb, RUN)){
             Q13_1;
       }
       else {
             Q13_0;
       }

   if (bit_is_set(tmr1.sb, CPL)){
      tmr1.sb = 0;
      tmr2.sb = _BV(EN);
   }  

   if (bit_is_set(tmr2.sb, CPL)){
      tmr2.sb = 0;
      tmr1.sb = _BV(EN);
   }  

  

   if (TMR_BIT){
   Serial.print(0x00, BYTE);
   Serial.print(0x00, BYTE);
   Serial.print(tmr1.sb, BYTE);
   Serial.print(tmr1.value, BYTE);
   Serial.print(tmr1.preset, BYTE);  
   Serial.print(tmr2.sb, BYTE);
   Serial.print(tmr2.value, BYTE);
   Serial.print(tmr2.preset, BYTE);
   }
}

ISR(TIMER2_OVF_vect) {
  RESET_TIMER2;
  int_counter++;
};

void setupTMR2(){
  //   =   76543210
  DDRB = 0b00100000;
  
  // TIMER 2
  
  //Timer2 Settings: Timer Prescaler /64,
  TCCR2B |= ((1<<CS22) | (0<<CS21) | (0<<CS20));
  
  // Use normal mode
  TCCR2A |= (0<<WGM21) | (0<<WGM20);

  // Use internal clock - external clock not used in Arduino
  ASSR |= (0<<AS2);

  TIMSK2 |= (1<<TOIE2);  //Timer2 Overflow Interrupt Enable
  RESET_TIMER2;
  sei();
}
6  Using Arduino / Interfacing w/ Software on the Computer / Re: waveform viewer for PC (free, for windows) on: February 12, 2011, 03:41:51 pm
gnuplot looks fine. I will try it. Thank you.
7  Using Arduino / Programming Questions / Can I write my own .c and .h files and use them with .pde main project? on: February 12, 2011, 03:13:39 pm
Hello,

I'm new on Arduino.
can I write my own .c and .h files and use them with main.pde project?

Here is what I did:
1/ I wrote funcion void tonTimer(T_TMR *t) and store it to file FC060.c
2/ I wrote line extern void tonTimer(T_TMR *t); and store it to file FC060.h
3/ I included #include "FC060.h" in file main.pde  and
    I called this function tonTimer(&tmr1);  but I got compiling error
undefined reference to 'tonTimer(T_TMR*)'
What's wrong ? Files FC060.c, FC060.h, main.pde are compiled OK when I delete line tonTimer(&tmr1);  

Code:
/*
file:      FC060.c
project:  
device:    
date:      
desc.:    software timer
*/

#include "FC060.h"
#include <avr/io.h>

T_TMR   tmr1;
T_TMR   tmr2;

void tonTimer(T_TMR *t)
{
  unsigned char sb   ;
  unsigned char value;
  unsigned char preset;
  
  sb     =  t-> sb;
  value  =  t-> value;
  preset =  t-> preset;
  
  if (sb==_BV(EN)){
     sb = (_BV(EN) || BV(RUN));
     value  = preset;
  }
  
  if (bit_is_set(sb,RUN)){
    if (TMR_BIT){
      value--;
      if (value==0){
         sb = _BV(CPL);
      }
    }
  }
  
  t-> sb = sb;
  t-> value = value;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
Code:
/*                                                            
file:      FC060.h                                            
project:                                                      
device:                                                        
date:                                                          
desc.:     header file for software timer                      
*/                                                            
                                                              
                                                              
#ifndef _FC060_H                                              
#define _FC060_H                                              
                                                              
#include <avr/io.h>                                            
                                                              
#define EN                     (0)                            
#define RUN                    (1)                            
#define CPL                    (2)                            
                                                              
#define TMR_BIT               (bit_is_set(ip,0))              
// uint8_t ip is defined in main skatch                        
                                                              
                                                              
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
                                                              
                                                              
// software timer data                                        
typedef struct {                                              
  unsigned char sb   ;  // holds flags                        
  unsigned char value;  // is value                            
  unsigned char preset;  // init value                        
} T_TMR;                                                      
                                                              
                                                              
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
                                                              
extern T_TMR   tmr1;                                          
extern T_TMR   tmr2;                                          
extern uint8_t ip  ;                                          
                                                              
extern void tonTimer(T_TMR *t);                                
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#endif _FC060_H                                                
Code:
// file main.pde
//

#include <avr/io.h>
#include "FC060.h"

uint8_t ip= 0;

//  void setup()
//
//
void setup()
{
  tmr1.sb    = _BV(EN);
  tmr1.preset = 20;
}

void loop()
{
   tonTimer( &tmr1);
}
[/size]
8  Using Arduino / Interfacing w/ Software on the Computer / waveform viewer for PC (free, for windows) on: February 12, 2011, 10:23:50 am
Hallo,
I have a simple DIY dataloger that works this way:
1/ the arduino board: samples 2 analog channels, 10bit resolution, 100ms sample speed, and runs about 1 hour.
2/ the data are sent to PC over RS232 line
3/ the data are saved to one big file as ASCII .csv file by printf() function in Processing
Now I'm looking for any waveform viewer for PC (free, for windows) that can load and show data as graphical output.
9  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: find & burn correct bootloader AtMega168 on: March 26, 2010, 01:19:50 pm
The problem is solved.  smiley

I took ..arduino-0016\hardware\bootloaders\atmega\ATmegaBOOT_168.c and the Makefile and I copied them to another place. I changed a little the Makefile (target diecimila) in order to it works with AvrStudio GCC plugin.

I compiled it under AvrStudio v4.16 & WinAVR-20090313.
Burned the blank AtMega168 with AvrDragon by ISP.
Fuses:
EFUSE = 0xF8
HFUSE = 0xDD
LFUSE = 0xFF

First it didn't work.
When I read the Flash back from chip I got only 0xff in the whole file.
When I burned it again and I read the Flash back I got the good hex file.

And surprise it works !

Maybe the problem was long wiring between AVR Dragon and Severino.
Or maybe the problem was I took wrong hex file first time.
I hope just putting the ..arduino-0016\hardware\bootloaders\atmega\ATmegaBOOT_168_diecimila.hex will work.

Thank you for your help.
10  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: find & burn correct bootloader AtMega168 on: March 17, 2010, 01:20:26 pm
Thank you very much for help.
But my problem persist.  :'(
I can't find correct version of bootloader for my board.
I'm using:
PC: w2000 SP4,
IDE: arduino-0016
HW: arduino severino s3v3

The bootloaders I have tried:
C:\programs\arduino-0016\hardware\bootloaders\atmega
ATmegaBOOT_168_ng.hex
ATmegaBOOT_168_diecimila.hex

Fuses bits, I have read out from Makefile something like
HFUSE = DD
LFUSE = FF
EFUSE = 00

Always opened *.hex file in AtmelAvrStudio v4.16
and burned with AvrDragon in ISP mode and checked fuses too.
Programming is OK.
After restarting board the LED13 doesn't blink.
The Arduino IDE can't upload the sketch.

Can anyone point me, which bootloader should be used with the board severino s3v3 ???

Note: LED13 has good connection, it works, if I write a simple test loop in C in AvrStudio.
11  Forum 2005-2010 (read only) / Frequently-Asked Questions / find & burn correct bootloader AtMega168 on: March 14, 2010, 07:52:53 am
Hello,
I'm new at Arduino. I have got:
- HW: PCB Single sided Arduino s3v3 (Severino)

- Chip: blank AtMega168

Now I would like to burn the bootloader to chip.
- The programming tool I have: AVR dragon

My question:
which bootloader should I use ? Is this one OK?
(wolfpaulus.com/journal/embedded/arduino2.html ->
rob.faludi.com/itp/arduino/bootloader168.zip)
Pages: [1]