Using Wire.h

Discussion in 'Arduino IDE' started by Nico, Jul 26, 2016.

  1. Nico

    Nico New Member

    Joined:
    Jan 19, 2016
    Messages:
    27
    Likes Received:
    5
    Hi guys,

    I am trying to use Wire.h library to send data through I2C between 2 Udoo Neo.
    I don't know at all this library, so I have found this page on arduino website : https://www.arduino.cc/en/Tutorial/MasterWriter
    No problems with master writer code, but with slave receiver I can't use this :
    Code:
    Wire.begin(int)
    So I take a look at the Wire.h file, and found this :
    Code:
    void begin(void);
    //void begin(uint8_t);
    //void begin(int)
    I can't find the onReceive method too...

    So can anybody tell me if it is possible to do this with Udoo Neo ? And if it is, can you help me to do this ?:)
     
  2. Andrea Rovai

    Andrea Rovai Well-Known Member

    Joined:
    Oct 27, 2014
    Messages:
    1,703
    Likes Received:
    240
    Unfortunately, as commented in the file wire.cpp


    /* from MQX_IO_USER_GUIDE.pdf !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    MODE - Default operating mode (I2C_MODE_MASTER or I2C_MODE_SLAVE). For the i.MX
    family devices, only MASTER MODE is supported.
    */

    for i.MX devices only master mode is supported.
     
    Nico likes this.
  3. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    Nico likes this.
  4. Nico

    Nico New Member

    Joined:
    Jan 19, 2016
    Messages:
    27
    Likes Received:
    5
    @Andrea Rovai: Thanks, I did not notice this while searching for begin(int).

    @waltervl: I had a look at the link you posted, but the problem is that I can't use begin(int), only begin(void) is accessible, so I will be able to send data (write) but not to read data, since I think that you must specify a channel in order to read, isn't it ? (If it is possible to not specify a channel to read, the onReceive function is not accessible...)

    Edit: I will continue to search for a solution, and let you know if I find something
     
  5. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    In Freescale MQX™ RTOS I/O Drivers User’s Guide, Rev. 24, 04/2015 it is stated:
    2.14 Families Supported
    Also, not all drivers available in the Freescale MQX software are documented in this document. See the Freescale MQX RTOS Release Notes (document MQXRN) for the list of supported drivers.
    When this manual was written, Freescale MQX RTOS did not support PCB-based I2C and QSPI drivers. Only character-based master-mode-only I2C and QSPI drivers are supported.

    So you seem to be correct.
    Only in Freescale MQX™ RTOS 4.2.0 Release Notes, Rev. 4.2.0, 04/2015 it is stated:
    4.3 I/O drivers supported
    I2C I/O Driver
    This driver supports the I2C interface in both master and slave mode. If enabled in user configuration, the I2C driver is
    installed during the BSP startup code as the "i2cx" in polled mode and as the "ii2cx" in interrupt mode where "x" stands for a
    specified I2C channel number). Example applications are provided in the MQX RTOS source tree for both master and slave
    mode.


    So I would suggest that the driver supports the I2C interface in both master and slave mode now. Can you confirm?
     
  6. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    @Nico, can't you use the standard Neo Arduino Serial0 device as an alternative communication line between 2 Neo Arduino?
    And why use the Arduino side of the Neo and not the Linux side to have them communicate? Although I suppose it has to do with the hampering /dev/ttyMCC.
     
  7. Nico

    Nico New Member

    Joined:
    Jan 19, 2016
    Messages:
    27
    Likes Received:
    5
    @waltervl : I was using interrupts on my UDOO, but I have got some problems using it (see this thread), so I wanted to connect another arduino with working interrupts on my UDOO, use interrupt on my arduino and send datas to UDOO.
    I will try to use Serial0, but I will need to connect multiple arduinos on my udoo, it is possible to do this with I2C communications, but I though that Serial0 can be used only to communicate between 2 arduino devices, isn't it ?
     
  8. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    I think so, yes. Only 2 devices.
     

Share This Page