This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

I cannot get I2C working on contiki with the 2650 Launchpad

Part Number: LAUNCHXL-CC2650

Does anyone have any suggestions on how to setup I2C on the 2650 Launchpad for contiki, the SDA and SCL pins are constant high. 

  • Hi Matt,

    I will have a look and see if I can find any examples for contiki on how to setup the I2C. I'm also looping in a colleague that is more focused on the contiki platform.
  • Hi Matt,

    Are you using Contiki or Contiki-NG?

    Either way, I can see to possible solutions:

    1. Write your own I2C driver.
    2. Use the I2C driver implementation for the sensortag platform (on Contiki)

    Regarding solution #2, after quickly skimming over the existing I2C driver implementation, I don't see why it shouldn't work to simply copy/paste and modify the existing board file for the launchpad platform.

    Do note however this is something you'd have to try and test for yourself. I think you'd get much more direct help by asking the Contiki community on this.

    What I can identify (without trying myself) from what needs to be done to get I2C up and running on the launchpad is the following:

    1. Copy/paste the board-i2c.h/c files from srf06-cc26xx/sensortag to srf06-cc26xx/launchpad
    2. In Makefile.launchpad under srf06-cc26xx/launchpad: Add the new i2c files to the BOARD_SOURCEFILES variable
    3. In board.c under srf06-cc26xx/launchpad:
      1. Add a new include for board-i2c.h
      2. Add a call to board_i2c_wakeup() in board_init()
      3. Add a shutdown handler (just as board.c in srf06-cc26x/sensortag) which calls board_i2c_shutdown()
    4. Recompile

    Again, you are sort of on your own on this. If you do get it working by using solution #2, consider making a pull-request to the Contiki repository.

  • Thanks for the responses, I have tried to get I2C working using the sensortag i2c.h/c files as suggested. I have not gotten it to work and seems to get stuck when calling the write function or even the i2c_status function.

    I have resorted to using UART. I cannot get UART communication via the pins 2 and 3 that are listed in the board.h file but can get write commands out of the 2650 and readable from a PIC chip. My primary concern is that I cannot receive any information from the pic chip. This should be no different from getting info from a keyboard. So what functions are available for scanning the Rx of UART in contiki I cannot find any!?!?
  • When using UART, have you made sure to register an input function to the UART driver?

    e.g.

    // Enable UART input by registering an input callback function
    // serial_line_input_byte() is a pre-defined callback function from "dev/serial-line.h"
    cc26xx_uart_set_input(serial_line_input_byte);
    
    // Disable UART input by unregistering the input callback function
    cc26xx_uart_set_input(NULL);

  • Yes, but now I'm back to the I2C communication. I am resorting to creating my own code to communicate to a I2C sensor (CCS811 Air Sensor) since I cannot get the I2C code working from the sensortag.
  • You didn't try to debug the I2C port to see why it got stuck?
  • I did and it was constantly holding high, no signal or clock.
  • Did you follow the step-by-step guide I posted earlier in the thread? Are you sure the board_i2c_wakeup() function is ever called?
  • I'm closing this thread due to inactivity. You can re-open this thread if you feel you haven't gotten the support you needed.