3 volt supply on Arduino Duemilanova

Re Arduino Duemilanova and Dallas EEPROM

I have used the "OneWire.h" library with a 5 volt supply, and the standard 16MHz crystal, and the circuit runs great. But I would like to run the MPU at 8MHz so I can use a 3 volt power supply. The "OneWire.h" does not seem to work on a 8MHz crystal. Can some one advice on what to modify on the OneWire.h library so it can? I have not found any data a ATMega328 that can run at 16MHz on 3 volts or even an AtMega162.... Any ideas?

Are you using this 1-Wire library? http://www.pjrc.com/teensy/td_libs_OneWire.html

Yes I am using the 1-wire.h library (OneWire.h), are they the same?

jamesvote: Yes I am using the 1-wire.h library (OneWire.h), are they the same?

I did not ask if you were using "1-wire.h".

Where did you get the OneWire.h file that is on your computer?

I think it was via Arduino Reference, (Copyright 2007 Jim Studt )!

Have checked, and it is the same library.....

I know the 1-Wire library available from pjrc.com works on an ATtiny84 processor running at 8 MHz. I have every reason to believe it runs correctly on an ATmega328 processor running at 8 MHz.

So, the ball is back in your court. Post your code. Indicate which EEPROM you are using.

EEPROM is DS2431
Code is as per example given with library, basic sample below

void loop(void) // Main loop
{    
  int i; // offset counter
  unsigned int t = 0; //Time out counter
  boolean present;
  
  // Reset and use SKIP command (Skip ID number)
  present = ds.reset();
  ds.skip();
  if (present == TRUE)
  {
    // Found TAG, read and set BLUE LED on
    digitalWrite(Bled, HIGH);   // turn the LED on

    // Rest line again and send read command and address 
    ds.reset();
    ds.skip(); // skip reading 24bit number of device
    ds.write(0xf0,1); // Read memory command
    ds.write(0x00,1); // LSB From Address 0000HEX
    ds.write(0x00,1); // MSB

    for ( i = 0; i < 72; i++) //Save into RAM bytes only whole mem is 144
    {
      rom[i] = ds.read(); // Get ROM data from EEPROM      
    }
etc

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

Your code does not compile...

sketch_nov09a.cpp: In function 'void loop()':
sketch_nov09a:7: error: 'ds' was not declared in this scope
sketch_nov09a:9: error: 'TRUE' was not declared in this scope
sketch_nov09a:12: error: 'Bled' was not declared in this scope
sketch_nov09a:23: error: 'rom' was not declared in this scope
sketch_nov09a:25: error: 'etc' was not declared in this scope
sketch_nov09a:25: error: expected `;' at end of input
sketch_nov09a:25: error: expected `}' at end of input
sketch_nov09a:25: error: expected `}' at end of input

As stated it was just a sample of the code, full “example” is with the OneWire library download.
Example is the DS245x
I have attached the DS250x_PROM.pda, for your testing.
Thanks

DS250x_PROM.pde (4 KB)

jamesvote: But I would like to run the MPU at 8MHz so I can use a 3 volt power supply. The "OneWire.h" does not seem to work on a 8MHz crystal.

How do you know it is not working?

used another Atmega328 with boot loader installed. Connected up a 8MHz crystal, would not read dallas prom. Re connected a 16MHz crystal and it did work I will re check bread board layout, and maybe get another 8MHz crystal, just in case.... As the 1 wire protocol is very dependent on clock timing, I would have thought there would be a "check" some were in the library to see what the clock speed is....?

jamesvote: Connected up a 8MHz crystal, would not read dallas prom. Re connected a 16MHz crystal and it did work

You have to rebuild and reupload after changing the clock.

I re upload via the Arduino PCB, remove Atmega with my program in it, and put it in the 8MHz test breadboard.
How can the program identify the crystal speed while uploading?

jamesvote: How can the program identify the crystal speed while uploading?

When your program is compiled and linked it is built for a specific clock speed. It is not possible to "identify the crystal speed while uploading".

This should work...

• Locate [u]boards.txt[/u] in the [u]{Arduino Installation Root Director}\hardware\arduino[/u] directory

• Open [u]boards.txt[/u] in a text editor that supports Linux line endings (Notepad won't work)

• Add the following to the end of the file...

unoat8.name=Arduino Uno Targeted for 8 MHz
unoat8.upload.protocol=arduino
unoat8.upload.maximum_size=32256
unoat8.upload.speed=115200
unoat8.bootloader.low_fuses=0xff
unoat8.bootloader.high_fuses=0xde
unoat8.bootloader.extended_fuses=0x05
unoat8.bootloader.path=optiboot
unoat8.bootloader.file=optiboot_atmega328.hex
unoat8.bootloader.unlock_bits=0x3F
unoat8.bootloader.lock_bits=0x0F
unoat8.build.mcu=atmega328p
unoat8.build.f_cpu=8000000L
unoat8.build.core=arduino
unoat8.build.variant=standard

##############################################################

• Save and close [u]boards.txt[/u]

• Restart the Arduino IDE

• Ensure the [u]Arduino Uno Targeted for 8 MHz[/u] board is selected

• Redo everything you did before to get your program on the target processor

Edit: added "board is selected" step.

Thanks....did not work first time, would not send to board. changed upload speed to : unoat8.upload.speed=57600

Many thanks now it works.....Will do some further testing, but all good so far... :)

Also now know were the boot loader fuse's are, thanks again

You are welcome. I'm glad you have it working.