Welcome! Log In Create A New Profile

Advanced

i2c for other purposes

Posted by mlapaglia 
i2c for other purposes
October 16, 2014 05:34PM
Hello! I am using repetier on a rambo and want to use the i2c capabilities for communicating with another Arduino.

I uploaded an example sketch to the rambo and another arduino and have them talking to each other fine. When I try to add this into the Repetier firmware I get trouble.

I have a simple example:
HAL::i2cStartWait(4);
HAL::i2cWrite('a');
HAL::i2cStop();

This code fails when it gets to the write step. I am in a bit over my head here and would appreciate any advice someone might have. I can't find any examples of i2c being used aside from write commands everywhere. Where is i2c being initialized? How is it used?

Thanks!
Re: i2c for other purposes
October 17, 2014 12:19PM
Initialize is done with
    HAL::i2cInit(UI_I2C_CLOCKSPEED);

Please also remember to double address. Repetier does not shift address to left 1 bit, so it expects the already shifted address.


Repetier-Software - the home of Repetier-Host (Windows, Linux and Mac OS X) and Repetier-Firmware.
Repetier-Server - the solution to control your printer from everywhere.
Visit us on Facebook and Twitter!
Re: i2c for other purposes
October 17, 2014 08:36PM
Thank you so much!

What finally got it working for me:

	HAL::i2cInit(100000L);
	HAL::i2cStartWait(4 << 1);
	HAL::i2cWrite('a');
	HAL::i2cStop();

I appreciate your pointers, thank you!
Sorry, only registered users may post in this forum.

Click here to login