Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 9 of 9

Thread: Need Wire.endTransmissionNonblocking();

  1. #1
    Member
    Join Date
    Aug 2019
    Location
    Melbourne Australia
    Posts
    48

    Need Wire.endTransmissionNonblocking();

    Hi Folks.
    Am working on a Mega based device found on Git. Have built one and got it working. It could use more horsepower and less hardware real estate so I've managed to get it *partially* working on a Teensy 3.2 or at least enough to test it's engine.

    There's some 800k of code and at the moment I don't want to drop a rabbit warren here so here's the guts of it.

    From the device's manual:-

    Add Nonblocking I2C WritesThis will dramatically speed up I2C for our purposes.
    (a) Locate yourWire.cpp and Wire.h files. On the Mac they’re located inArduino.app/Contents/Java/hardware/arduino/avr/libraries/Wire/src/
    (b) Add the following line inside the “public” method region inWire.h:
    uint8_t endTransmissionNonblocking();
    (c) Add the following method toWire.cpp:
    uint8_t TwoWire::endTransmissionNonblocking()
    {
    uint8_t ret = twi_writeTo(txAddress, txBuffer, txBufferLength, 0, 1);
    return ret;
    }
    Using IDE1.8.10 TD 1.48.The following edits were applied to the Wire library in:-
    C:\Program Files(x86)\Arduino\hardware\teensy\avr\libraries\

    Code:
    uint8_t endTransmissionNonblocking();
    Was inserted at line 68 in Wire.h

    and
    Code:
    uint8_t TwoWire::endTransmissionNonblocking()
    {
    uint8_t ret = twi_writeTo(txAddress, txBuffer, txBufferLength, 0, 1);
    return ret;
    }
    was inserted at line 198 in Wire.cpp

    The compiler fell over with:-
    Code:
    'class TwoWire has no member named 'endTransmissionNonblocking'
    Which leads me to humbly ask :-
    (a) Is the added Wire.endTransmissionNonblocking Member correct for Teensy's Wire library
    and
    (b) If so how does one get the compiler to see and use it?

    All the best and thanks in advance.

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,333
    at a glance it looks like that should prevent the compiler from saying that - assuming it is called with no (params)? - confirm in verbose console output it is building with the sources from that edited folder (where files are 'saved') and not a local 'libraries' copy in sketchbook folder or another IDE install folder.

  3. #3
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,938
    Assuming you are using the Teensy version of the Wire library.
    Wire.h and Wire.cpp I believe are only used for AVR boards like Teensy 2.

    WireKinetis.h/.cpp - Are used for Teeny 3.x and LC
    WireIMXRT.h/.cpp - are used for Teensy 4.

  4. #4
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,333
    opps - that explains my thinking it wasn't compiling the right code - I saw the IMXRT file which was obvious - but ignored the WireKinetis file

  5. #5
    Member
    Join Date
    Aug 2019
    Location
    Melbourne Australia
    Posts
    48
    Thanks defragster and KurtE. Recent re-format drill. No other IDE install folder.

    Compiler verbage indicates that it's looking in the right place for Teensy's version of the Wire library and I guess it makes sense that the above mods won't be used by the compiler if we're targeting a T3.x assuming that they are gonna work anyway.

    Next followed some playing with WireKinetis.h/.cpp and I got the compiler to complain about what I was doing. I then thought that I was treading dangerously in the right place, persisted and finally broke it.

    I think I need to rephrase my question thus:-

    "how does one modify WireKinetis to do Wire.endTransmissionNonblocking(); // ? "

    Thanks for your efforts. :-)

  6. #6
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,333
    That isn't part of std WIRE lib it seems - so adding may have complications.

    Looking at : \hardware\teensy\avr\libraries\i2c_t3 included in TD it does note non-blocking version details.

    For T_3.2 it should support similar function as a replacement for WIRE.h

    That came from scan of the header file - not the sources or examples ...

  7. #7
    Member
    Join Date
    Aug 2019
    Location
    Melbourne Australia
    Posts
    48
    Thank you defragster. Didn't think of inserting the hyphen when searching for nonBlocking. PEBKAC error!

    While I was in there, scrolled down the page and found the solution to the basis of another series of dirty kludges I employed to get the thing partially working. Time to go back to square one with fresh code rather than undo all those kludges, tidying up compile Board-Type sensitivity in the process. Not today, on garden detail.

  8. #8
    Member
    Join Date
    Aug 2019
    Location
    Melbourne Australia
    Posts
    48
    Thank you again defragster, I've got it *mostly* working now in that EEprom writes are no longer blocked and the list of dirty kludges has diminished to ONE. Yay!

  9. #9
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,333
    Good to hear!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •