Transferring data to/from a microchip

I may be slightly ambitious taking on quite a large project such as the one I'm currently working on, but I think with a few explanations and some experiments, I'll be able to get it working eventually. I'm working on reading a microchip that requires a constant 1Mhz-5Mhz clock. It transfers data on a 1 bit bus (a single pin). The biggest problem I'm having problem with is making a clock pin using Arduino. 1Mhz is a 1 micro second interval, but Arduino has a 3 microsecond minimum to have an accurate delay, and mircos() is in 4 ?s intervals. I can't use the SPI library because it uses multiple lines and the microchip I'm trying to communicate is a single bi-directional pin used for sending/receiving bits.

Does anyone have any advice on how to get a constant 1Mhz clock so I can properly transfer bits across the connection? Is this even possible with Arduino? :roll_eyes:

Am I going to need an external 1Mhz Oscillator?

Well, for one thing 1Mhz is one Mega hz. 1 mhz, is one, one thousandth of a second.

99_linc: Well, for one thing 1Mhz is one Mega hz. 1 mhz, is one, one thousandth of a second.

I thought 1khz would be 1/1000th and 1mhz is 1/1,000,000?

ATMega328 can be made to output 1MHz signal, probably4 MHz too. I think you need to use Timer output pins to do it. Hang in here, one of the s/w guys can tell you how to use these type commands to get there (setting bits in registers directly basically).

TCCR0B = 0; TCCR0A = 0;

Or browse the timer section of the datasheet, maybe you can pick up what's needed with some reading.

Could you use a symmetric PWM mode or would the waveform not be square enough?

Just curious though, would an external Oscillator work? I could supply it with a voltage, than use Arduino to sample the clock pin and the microchip could also be attached to the same clock?

1 mhz, is one, one thousandth of a second.

I thought 1khz would be 1/1000th and 1mhz is 1/1,000,000?

No, 1mHz (Exercise that shift key, people) is one cycle every 1000 seconds, or one cycle every sixteen minutes and forty seconds.

How many bytes do you need to transfer?
If it’s only 1 or 2 I reckon you can do it in software, if it’s a lot I don’t think so as you won’t have time to do anything else.

Do you need to read AND write?

If so both at the same time?

What is the chip?

1mhz is a cycle every 1000 seconds, 1MHz is 1000000 cycles every second. Pedantic I know but we are working with engineering stuff here (and engineers).


Rob

TrieBr, Sounds like you are trying to read a serial eprom? if so, you probablly only need "up to 1 MHz". You can read/write at lower rates. What chip are you trying to crack?

That should be 'EPROM' , not 'eprorn".......

So you can't use PWM as a clock to external device?

Some reading material... http://arduino.cc/forum/index.php/topic,62964.msg457337.html#msg457337 http://arduino.cc/forum/index.php/topic,57873.0.html http://arduino.cc/forum/index.php?topic,62949.0.html http://arduino.cc/forum/index.php/topic,65434.0.html

So you can't use PWM as a clock to external device?

Yes, you can. But there are other better timer modes for generating a clock signal.