Show Posts
Pages: [1]
1  Using Arduino / Microcontrollers / Re: Tiny tuner trouble. on: July 09, 2011, 05:50:03 am
Was playing around with some blink sketches, programmed the 8M bootloader, the 100ms blink was around 100ms.

Try the tiny tuner again and it works  smiley-confuse

Strange. I would swear I have done nothing different this morning from last night. Maybe just needed to sleep on it.

2  Using Arduino / Microcontrollers / Re: Tiny tuner trouble. on: July 09, 2011, 05:17:56 am
Changed to an RS232 - ttl adaptor to try something different.

I have a cro on the RX pin of the adaptor.

When the device powers up I can see a big string of data.

When I press X I can see a few bytes being sent to the PC, these change slightly with each press.

After 15 or so presses a big chunk of data comes back.

Cycle repeats.

On the Arduino terminal it prints about 6 bytes of garbage back for every press of "x".

I think the internal timescale on my ATTINY85 is out of whack by a large margin.
3  Using Arduino / Microcontrollers / Re: Tiny tuner trouble. on: July 09, 2011, 04:53:11 am
4  Using Arduino / Microcontrollers / Re: Tiny tuner trouble. on: July 08, 2011, 10:54:19 pm
Changed back to "interactive" using hyperterminal, holding down the "x" key for a while (minute or so)

5  Using Arduino / Microcontrollers / Tiny tuner trouble. on: July 08, 2011, 08:26:51 pm
ATTINY85, using an Ardunio ISP.

I have had a project working on this device, but I would like to calibrate the internal oscillator so I can use a faster baud rate for serial coms.

Cannot get this to work.

I first tried the "interactive serial" Tiny Tuner example, but when i power on the ATTINY the serial terminal receives garbage. I assume this is because the tolerance on my ATTINY is too far out to support 9600bps communication?

So I tried the "Save_To_EEPROM" example.

I have an osciliscope on the "LED" pin, when i send an "x" from the terminal, 9600Baud i see a pulse.

The pulse varies from ~16ms down to 2 or so, in a repeated pattern. The LED never turns fully on indicating the optimum calibration value has been found.

But if i look at the code:

while ( KeepGoing )
    KeepGoing = tt.update();

    for ( uint8_t i=0; i < 2; ++i )
      digitalWrite( PinLED, ! digitalRead( PinLED ) );
      delay( 100 );

It looks like it should be illuminating the LED for ~ 100ms?

I think my code / device is out by a factor of ~ 10?

I have tried the 1Mhz and 8Mhz Tiny core, the result is always the same.
6  Using Arduino / Microcontrollers / Re: Changing device external crystal from 16Mhz to 8Mhz. Bootloader problems. on: June 19, 2011, 04:43:15 am
Works at a lower speed, thanks!
7  Using Arduino / Microcontrollers / Changing device external crystal from 16Mhz to 8Mhz. Bootloader problems. on: June 19, 2011, 03:10:41 am
Hello all,

Perhaps I have missed something you guys can point out to me.

I have a working AT90CAN128 running the arduino bootloader and an external crystal of 16Mhz.

I would like to run this slower at 8Mhz.

So I updated the make file for the bootloader to set AVR_FREQ = 8000000L recompiled and programmed with a JTAG programmer.

The problem is the Ardunio IDE cannot connect to the bootloader, it times out every time.

I measured the pulse widths of the LED flash on pin A7 it is spot on 100ms just as with everything at 16Mhz. So I think the clock is configured correctly.

If I change back to 16000000L and recompile, program, swap crystal back everything works. Ardunio IDE connected to the bootloader fine.

The only thing I can think of is a problem with the UART configuration? Either it is not compensating for the change in AVR_FREQ, or the 8Mhz is not dividing down well???


# Makefile for ATmegaBOOT

at90can: TARGET = at90can128
at90can: MCU_TARGET = at90can128
at90can: AVR_FREQ = 8000000L
at90can: LDSECTION  = --section-start=.text=0x1F000
at90can: $(PROGRAM)_at90can.hex


/* Serial Bootloader for Atmel megaAVR Controllers        */
/*                                                        */
/* tested with ATmega8, ATmega128 and ATmega168           */
/* should work with other mega's, see code for details    */
/*                                                        */
/* ATmegaBOOT.c                                           */
/*                                                        */
/*                                                        */
/* 20090308: integrated Mega changes into main bootloader */
/*           source by D. Mellis                          */
/* 20080930: hacked for Arduino Mega (with the 1280       */
/*           processor, backwards compatible)             */
/*           by D. Cuartielles                            */
/* 20070626: hacked for Arduino Diecimila (which auto-    */
/*           resets when a USB connection is made to it)  */
/*           by D. Mellis                                 */
/* 20060802: hacked for Arduino by D. Cuartielles         */
/*           based on a previous hack by D. Mellis        */
/*           and D. Cuartielles                           */
/*                                                        */
/* Monitor and debug functions were added to the original */
/* code by Dr. Erik Lins, (See below)         */
/*                                                        */
/* Thanks to Karl Pitrich for fixing a bootloader pin     */
/* problem and more informative LED blinking!             */
/*                                                        */
/* For the latest version see:                            */
/*                                 */
/*                                                        */
/* ------------------------------------------------------ */
/*                                                        */
/* based on stk500boot.c                                  */
/* Copyright (c) 2003, Jason P. Kyle                      */
/* All rights reserved.                                   */
/* see for original file and information         */
/*                                                        */
/* This program is free software; you can redistribute it */
/* and/or modify it under the terms of the GNU General    */
/* Public License as published by the Free Software       */
/* Foundation; either version 2 of the License, or        */
/* (at your option) any later version.                    */
/*                                                        */
/* This program is distributed in the hope that it will   */
/* be useful, but WITHOUT ANY WARRANTY; without even the  */
/* implied warranty of MERCHANTABILITY or FITNESS FOR A   */
/* PARTICULAR PURPOSE.  See the GNU General Public        */
/* License for more details.                              */
/*                                                        */
/* You should have received a copy of the GNU General     */
/* Public License along with this program; if not, write  */
/* to the Free Software Foundation, Inc.,                 */
/* 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA */
/*                                                        */
/* Licence can be viewed at                               */
/*                    */
/*                                                        */
/* Target = Atmel AVR m128,m64,m32,m16,m8,m162,m163,m169, */
/* m8515,m8535. ATmega161 has a very small boot block so  */
/* isn't supported.                                       */
/*                                                        */
/* Tested with m168                                       */

8  Using Arduino / Programming Questions / Re: Import constant array from a .h file on: May 13, 2011, 08:33:20 pm
Ah, Thanks!  smiley-red
9  Using Arduino / Programming Questions / Import constant array from a .h file on: May 13, 2011, 08:17:44 pm

I have this .h file, it's purpose is to define a constant array of struct.

#ifndef MSDataObject_H
#define MSDataObject_H

#include "WProgram.h"

struct MSDataObject
char _Name[4]; //Name to display on a display
char _Width; //1 byte or 2 bytes or?
char _Offset; //Offset from start of megasquirt telemetry data address
char _Mult; //Multiplying factor
char _Div; //Dividing factor
word _Max; //Max limit for gauge

const MSDataObject MSDataObjectList[] =

#endif // MSDataObject_H

In my Arduino sketch, I include the .h file:

#include "./MSDataObject.h"

And use this defined consant:

GaugeValue._Len = MSDataObjectList[Menu]._Width;

But I get this error:

MSCANDispController.cpp: In function 'void loop()':
MSCANDispController:128: error: 'MSDataObjectList' was not declared in this scope

Why does my sketch not have the array declared?
10  Using Arduino / Microcontrollers / AT90CAN128 OLIMEX board on: February 23, 2011, 02:49:46 pm
Noticed there was a few threads on this in the old forum, just thought I would revive the topic:

Using this dev board from OMILEX:

To be able to develop on this in the Arduino environment you need to:

1. Download the .zip file from the old thread here:,8446.0.html

2. Flash the bootloader to the OLIMEX board. He has already compiled a hex file for this. Method of your choice, I used AVR Studio and an RS232 JTAG.

3. Copy the Arduino AT90CAN128 into your Ardunio dev area, he has a good text file in the zip which explains what you need to do.

4. Make a program in the Ardunio IDE and send it to the board!

Here is a blinky LED (STAT LED) hello world for the OLIMEX board:

  Turns on an LED on for one second, then off for one second, repeatedly.
  This example code is in the public domain.

//PIN 36 = PTE Pin 4 = STAT LED on OLIMEX AT90CAN128 board.
void setup() {               
  // initialize the digital pin as an output.
  // Pin 13 has an LED connected on most Arduino boards:
  pinMode(36, OUTPUT);     

void loop() {
  digitalWrite(36, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(36, LOW);    // set the LED off
  delay(1000);              // wait for a second

Unbelievably easy, and you have an Ardunio development environment which nativly supports CAN (Controller Area Network). No more dorky SPI chips.

Note: I did find the serial bootloader here was abit touch and go. But turning off the board, waiting for the "Binary Sketch....." text to come up and powering the board back up gives a good success rate.

Thanks very much to SuperCow who did all the work for this!
Pages: [1]