Jump to content


  • Content Count

  • Joined

  • Last visited

  1. Thank you for the information there Bob, its very helpful. Would you have any ideas in how to overcome the NAK problem or should I just opt to use a different type of board in this case.
  2. I changed the code to to transfer only the one byte and brought the resistors down to 5k, however i'm still not getting a response. I put serial prints of statements into the loop, receiveEvent function and setup of the slave_receiver. The serial print in loop comes up in the monitor, but the serial print in the recieveEvent does not come up. So i don't think its entering that function at all. I setup and put a serial print into the loop of the master_writer and that wasn't being displayed continuously on the monitor either. Also i ran an I2C scanner to check for addresses of any other device connected to the master board to which it displayed zero. // I2C Scanner // Written by Nick Gammon // Date: 20th April 2011 #include <Wire.h> void setup() { Serial.begin (115200); // Leonardo: wait for serial port to connect while (!Serial) { } Serial.println (); Serial.println ("I2C scanner. Scanning ..."); byte count = 0; Wire.begin(); for (byte i = 8; i < 120; i++) { Wire.beginTransmission (i); if (Wire.endTransmission () == 0) { Serial.print ("Found address: "); Serial.print (i, DEC); Serial.print (" (0x"); Serial.print (i, HEX); Serial.println (")"); count++; delay (1); // maybe unneeded? } // end of good response } // end of for loop Serial.println ("Done."); Serial.print ("Found "); Serial.print (count, DEC); Serial.println (" device(s)."); } // end of setup void loop() {}
  3. Hi, I've looked into pull up resistors more and believe the setup to be correct, however it had no effect on the situation and the problem still occurs. So i'm wondering also: Do any jumpers have to be removed from the MSP 432 boards for I2C to work. Thanks. Danial.
  4. Hi, thanks for the response. The baud rate is set up for 9600 and and is also set 9600 on the serial monitor. The code i am using, is of the examples given by Energia. Master_Writer // Wire Master Writer // by Nicholas Zambetti <http://www.zambetti.com> // Demonstrates use of the Wire library // Writes data to an I2C/TWI slave device // Refer to the "Wire Slave Receiver" example for use with this // Created 29 March 2006 // This example code is in the public domain. #include <Wire.h> void setup() { Wire.begin(); // join i2c bus (address optional for master) } byte x = 0; void loop() { Wire.beginTransmission(4); // transmit to device #4 Wire.write("x is "); // sends five bytes Wire.write(x); // sends one byte Wire.endTransmission(); // stop transmitting x++; delay(500); } Slave_receiver // Wire Slave Receiver // by Nicholas Zambetti <http://www.zambetti.com> // Demonstrates use of the Wire library // Receives data as an I2C/TWI slave device // Refer to the "Wire Master Writer" example for use with this // Created 29 March 2006 // This example code is in the public domain. #include <Wire.h> void setup() { Wire.begin(4); // join i2c bus with address #4 Wire.onReceive(receiveEvent); // register event Serial.begin(9600); // start serial for output } void loop() { delay(100); } // function that executes whenever data is received from master // this function is registered as an event, see setup() void receiveEvent(int howMany) { while(1 < Wire.available()) // loop through all but the last { char c = Wire.read(); // receive byte as a character Serial.print(c); // print the character } int x = Wire.read(); // receive byte as an integer Serial.println(x); // print the integer } As for the pull up resistors, i tried using 10 k Ohm and switched the supply to 3.3V instead of 5V however the same screen characters are occurring. I'll take further look also for the time being into the pull up resistors, but at this stage i'm fairly stumped with it. Thanks, Danial.
  5. Hello, I am having a problem using the the Wire examples in energia, master_writer and slave_receiver. I have not modified the code in the examples and just want it to transfer the information across, so that I can work on from there. The two boards are connected together with sda to sda and scl to scl, it shares a common ground and both boards have a 5V supply to the 5V pins However, every time i connect the boards and check the serial monitor on the slave board, all i see is weird unique characters. When i press reset button on the slave board, it will repeat and print the same weird character. I'm fairly new to i2c communication and would appreciate any help provided here, Thank you, Danial.
  • Create New...