Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch.embedded > #31144

Re: I2C Communication between two Microcontrollers

From pozz <pozzugno@gmail.com>
Newsgroups comp.arch.embedded
Subject Re: I2C Communication between two Microcontrollers
Date 2022-07-06 09:52 +0200
Organization A noiseless patient Spider
Message-ID <ta3evo$3vtt1$1@dont-email.me> (permalink)
References <9f2f7fd6-24ee-4eb5-8c3d-4b3db5b296bcn@googlegroups.com> <ta3b8u$3vja9$1@dont-email.me>

Show all headers | View raw


Il 06/07/2022 08:49, David Brown ha scritto:
> On 05/07/2022 15:28, Neelakantappa M wrote:
>> I want to test the I2C protocol between two STM32 (STM32L152RC)
>> microcontrollers. Can somebody guide me on how to do it or suggest
>> tutorials?
>>
>> I have seen some online portals where they are communicating between
>> a microcontroller and any sensor. That I have done already. Now I
>> want to test it between two MCU boards.
> 
> I am always a little sceptical about using I²C between microcontrollers, 
> and a lot more sceptical about using it between boards.  It can  be good 
> enough in simple cases, but all too often I have seen systems that 
> started out simple, and ended up trying to do far too much with I²C.
> 
> It is a protocol that works well with a microcontroller as the master 
> communicating with slow slave devices (simple ADC/DACs, small EEPROMs, 
> etc.) on the same board.  It works poorly when you need more data 
> transfer or higher speeds, and can be quite inefficient on many 
> microcontrollers when they are acting as slaves.
> 
> It is also less than ideal for off-board traffic.  For short range, with 
> closely coupled ground and little electrical noise, it can work fine - 
> but it does not work well over longer distances, and multi-master (or 
> even multi-slave, with microcontroller slaves) can be very awkward.  I 
> have seen systems where I²C has been used for bigger inter-card buses, 
> and the effort required to make it stable, noise-free and reliable meant 
> it was more costly and complex than alternatives such as CAN or RS-485 
> would have been.
> 
> So my advice here is to think about where you are going in the future. 
> I²C might be the most convenient protocol between two cards on your 
> desk.  But will it be the best choice for the final product - or its 
> future versions?  Obviously only you can answer that, but if it is not, 
> then it is better to think about it now than later.

I agree with David for all points, considering that I2C and UART need 
both only two pins (at least for single master and single slave) and 
that modern MCUs most probably can configure pins for I2C or UART.

Moreover I add I hate I2C even for simple slave devices, such as EEPROM 
or ADCs/DACs. I prefer much more a simple SPI, even if I have to waste a 
pin for every slave.

I found that I2C peripherals embedded in most of MCUs are very complex 
and most of the time they aren't reliable.
After some testing, I usually decide to write a bit-banging I2C code.

Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

I2C Communication between two Microcontrollers Neelakantappa M <neelakantamaagi253@gmail.com> - 2022-07-05 06:28 -0700
  Re: I2C Communication between two Microcontrollers pozz <pozzugno@gmail.com> - 2022-07-05 16:22 +0200
  Re: I2C Communication between two Microcontrollers Richard Damon <Richard@Damon-Family.org> - 2022-07-05 22:33 -0400
  Re: I2C Communication between two Microcontrollers David Brown <david.brown@hesbynett.no> - 2022-07-06 08:49 +0200
    Re: I2C Communication between two Microcontrollers pozz <pozzugno@gmail.com> - 2022-07-06 09:52 +0200
      Re: I2C Communication between two Microcontrollers Stephen Pelc <stephen@vfxforth.com> - 2022-07-06 08:27 +0000
        Re: I2C Communication between two Microcontrollers pozz <pozzugno@gmail.com> - 2022-07-06 11:20 +0200
          Re: I2C Communication between two Microcontrollers Stef <me@this.is.invalid> - 2022-07-06 13:43 +0200
          Re: I2C Communication between two Microcontrollers Stephen Pelc <stephen@vfxforth.com> - 2022-07-06 15:49 +0000
        Re: I2C Communication between two Microcontrollers David Brown <david.brown@hesbynett.no> - 2022-07-06 11:52 +0200
          Re: I2C Communication between two Microcontrollers chris <chris-nospam@tridac.net> - 2022-07-07 17:19 +0100
            Re: I2C Communication between two Microcontrollers Dimiter_Popoff <dp@tgi-sci.com> - 2022-07-07 19:49 +0300
              Re: I2C Communication between two Microcontrollers Richard Damon <Richard@Damon-Family.org> - 2022-07-07 23:22 -0400
                Re: I2C Communication between two Microcontrollers Mike Perkins <spam@spam.com> - 2022-08-05 22:07 +0100
                Re: I2C Communication between two Microcontrollers Richard Damon <Richard@Damon-Family.org> - 2022-08-05 21:10 -0400

csiph-web