![]() Formula used from the datasheet: SCL = (F_CPU)/(16 + 2*TWBR*4^TWPS) The disclaimer below still stands :pĭisclaimer: I just took a quick glance at the docs to come up with the above, it's totally possible that I missed something. If you define "High Speed" to be 3.4 MHz I2C, then the answer appears to be no, you can't achieve that with your current hardware, but you should be able to get something faster than the default 100 kHz if you really want to.ĮDIT: It may be possible to achieve 1 MHz if I'm reading the datasheet correctly. Take a look at the section 24.5.2 Bit Rate Generator Unit to confirm this. However, after reading the datasheet of the Atmega, it appears to me that the fastest you can get. Following the formula given, change the value of TWI_FREQ to achieve a desired I2C clock frequency. Going by that comment, and without having to go into the datasheet (although I suggest that you do if you want to understand what those lines mean), it appears that the Arduino Mega (16 MHz) defaults to 100 kHz I2C clock. It is 72 for a 16mhz Wiring board with 100kHz TWI */ Note: TWBR should be 10 or higher for master mode SCL Frequency = CPU Clock Frequency / (16 + (2 * TWBR)) * twi bit rate formula from atmega128 manual pg 204 There is a constant of interest in twi.h:Īnd the register is set in the file twi.c like so: // initialize twi prescaler and bit rate I would consider going one level below the C++ object "Wire" and use their C files found here: ![]() ![]() Does Arduino (Mega1280) support High Speed I2C mode and if 'yes' how? #include 1.5kHz sample rate), but the datasheet to the DAC mentions High Speed I2C mode. The output frequency is a bit disappointing (approx. The sketch draws a Lissajous curve on my oscilloscope. I wired up two MCP4725 DAC's to my Arduino and wrote a little demo sketch to test functionality. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |