Wire onReceive(handler) issue

Posts: 6
Joined: Tue May 05, 2015 2:26 pm

Re: Wire onReceive(handler) issue

Post by screamingtiger » Thu May 07, 2015 5:09 am

Is there a fix yet or an alternative library to use? You need at least 2 bytes because I need the register and the value.

Posts: 23
Joined: Sat Nov 12, 2011 4:34 am

Re: Wire onReceive(handler) issue

Post by photomankc » Fri Jul 08, 2016 7:49 pm

This is interesting. After 3 years I'm back again at designing an I2C stepper drive and this is still an issue. I guess based on the information on how the Pic32 handles things it's simply unlikely to ever be any different. I had dumped my previous code but remembered there was a complication with I2C on this platform and glad I bumped back into this thread. I'll make my messages fixed-length, a little less efficient on the bus but easier to deal with. I suppose one could also work up a protocol where byte 2 contains the number of bytes in the message to make variable length messages possible.

It's a reasonable trade-off for the speed of the Pic32 but man I2C is easier on the Arduino. Sounds like it would be best to code around this issue in our code rather than to implement something that needs to be tweaked for each scenario. I think this time around i'll work up an i2c-packet object that will handle keeping track of the bytes and if they all got transmitted or not.

Site Admin
Posts: 299
Joined: Sat Jul 16, 2011 10:19 am

Re: Wire onReceive(handler) issue

Post by avenue33 » Fri Jul 08, 2016 8:33 pm

For my projects based on I²C slave, I'm using now silicon form Texas Instruments, mainly the MSP430G2553 and the Cortex-M4 TM4C123.

The MCU adjusts to standard mode (100 kHz), fast mode (400 kHz) and even fast mode+ (1 MHz for the TM4C) with no need for extra code.

Post Reply