laesaster / arduino

Automatically exported from code.google.com/p/arduino
0 stars 0 forks source link

Correct delayMicroseconds() timing for 20 MHz boards. #306

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Make/Take 20Mhz arduino.
2. Get OneWire lib from your site.
3. Open Example and see what happens.

What is the expected output? What do you see instead?
Working OneWire bus. I see not working one instead.

What version of the Arduino software are you using? On what operating
system?  Which Arduino board are you using?
Deumilanove and One that I made run on BreadBoard with Atmega8

Please provide any additional information below.
When using OneWire library on 20Mhz chip, protocol doesn't work due 
delayMicroseconds function since it assumes one uS as 16 clock but it's 20.

OneWire bus is really sensitive to timing mechanism. But code is definitelly 
fixes some other problems for 20Mhz too.

I sending a diff file, try to keep things better. Take a look.

Best Regards,
Erdem U. Altinyurt

Original issue reported on code.google.com by erdem...@gmail.com on 28 Jul 2010 at 2:18

Attachments:

GoogleCodeExporter commented 9 years ago
Are you using OneWire version 2.0?

Original comment by paul.sto...@gmail.com on 5 Aug 2010 at 9:45

GoogleCodeExporter commented 9 years ago
Yes using OneWire v2.0 library. But it's not fault of that library but 
inconsistent delayMicroseconds function when 20Mhz Xtal used with arduino. 
Patch might show what is broken at 20Mhz...

Original comment by erdem...@gmail.com on 7 Aug 2010 at 11:04

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hi I added a 2x "nop" assembly line to patch to fix remaining 1/8.th of 
Millisecond error for 20Mhz. Better to import this patch instead of older one. 
I also put resulting file.(Just deleted some commands because some mistakes on 
code.)

Original comment by erdem...@gmail.com on 22 Aug 2010 at 11:22

Attachments:

GoogleCodeExporter commented 9 years ago
https://github.com/arduino/Arduino/commit/0d70c7272e79d46d0043aae7158e00363d322b
ec

Sorry this took so long to apply... I think I was confused by the original 
summary and didn't realize it was just a fix to delayMicroseconds().

Original comment by dmel...@gmail.com on 2 Dec 2011 at 10:06