I have been working on a project involving a spectrofluorometer. As a first step I would like to reproduce the clock of the I2C system (to then control the system and send data to the spectro). The problem is that the I2C bus involved is a proprietary one, which means there are additional wires between the computer and the spectrofluorometer. I tried to code a new clock frequency (8kHz) with the Arduino but when i checked the results with a Saleae Logic16, the frequency slightly changed. I have been trying to change the TWBR parameter in the Wire library but I didn't achieve to get this exact frequency.
Would you have any idea to do it or any piece of advice please ?
Thanks for your time!
If that bus is an I2C bus the frequency doesn't have to be exact because there is a separate line (SCK) to send the clock signal too. 8kHz is a very low frequency for such a type of bus, what device are you talking to?
With such low frequencies it might be easier to program a timer to generate an interrupt in the right interval and shift out the data in that interrupt handler.
FunkyDidi:
I have been working on a project involving a spectrofluorometer. As a first step I would like to reproduce the clock of the I2C system (to then control the system and send data to the spectro). The problem is that the I2C bus involved is a proprietary one, which means there are additional wires between the computer and the spectrofluorometer.
Do you know what the extra wires do?
I tried to code a new clock frequency (8kHz) with the Arduino but when i checked the results with a Saleae Logic16, the frequency slightly changed. I have been trying to change the TWBR parameter in the Wire library but I didn't achieve to get this exact frequency.
When you say slightly changes, by how much? Maybe the I2C is software driven and that could give slight changes. A small variation should not matter as data should be loaded on CLK low and read on CLK high.
Would you have any idea to do it or any piece of advice please ?
Can you attach the Saleae capture.
Thank you for your replies.
i am currently talking to a 20 years old Spectrofluorometer... I must adapt it in order to use the device with a new computer. So we are using an Arduino to achieve this goal.
But, as Pylon told, 8 Khz is a very low frequency and I doubt I can reach it since I only could get a minimum of 30 KHz frequency.
I also have been able to send data with a homemade clock (including delays..). The Saleae device understands the data and so does the spectrofluorometer : small variations semm not to matter so Pylon and Riva are right.
However, sending data may turn out to be complex.
If we could change the SCL frequency using TWBR then we would be able to use the Wire library. This would simplify our problem.
I will post codes and screenshots as soon as possible.
There is also a prescaler for the Two-Wire Interface. See the datasheet, section 22.5.2. I did a quick calculation and I think something under 500Hz ought to be achievable.