Author Topic: EEVacademy #4 - I2C Bit Banging  (Read 10482 times)

0 Members and 1 Guest are viewing this topic.

Offline EEVblogTopic starter

  • Administrator
  • *****
  • Posts: 37734
  • Country: au
    • EEVblog
EEVacademy #4 - I2C Bit Banging
« on: July 22, 2017, 02:33:13 am »
Bit-Banging an I²C port with David.

 
The following users thanked this post: SeanB, Barryg41, rx8pilot, hwj-d, pknoe3lh, kire9999

Offline pknoe3lh

  • Regular Contributor
  • *
  • Posts: 115
  • Country: at
  • Trust me I'm an engineer
    • My Homepage
Re: EEVacademy #4 - I2C Bit Banging
« Reply #1 on: July 22, 2017, 08:30:58 am »
Very very nice done  :clap: :clap: :clap:
I really like it!

The speed is right for me. I didn't want to change to another video (it happens a lot if I get bored)

The only think I'm missing is the timing in your code.  :-/O
« Last Edit: July 22, 2017, 10:27:06 am by pknoe3lh »
 

Offline Brumby

  • Supporter
  • ****
  • Posts: 12297
  • Country: au
Re: EEVacademy #4 - I2C Bit Banging
« Reply #2 on: July 22, 2017, 03:47:42 pm »
That pace was much better than the SPI talk.  For some stuff I was following pretty well and for other I had to really pay attention.  The coding fast forward was a bit of a blur, but I would probably watch that again with some stop-frame viewing along the way.  Some people will still find it a bit on the pacey side.

All in all - a very useful video ... and a confirmation of a value contributor to the EEVblog video library!
 

Offline Kjelt

  • Super Contributor
  • ***
  • Posts: 6460
  • Country: nl
Re: EEVacademy #4 - I2C Bit Banging
« Reply #3 on: July 22, 2017, 03:51:46 pm »
Very nice till the coding part. Watching someone add spaghetti code on screen is less watchable than first explain the needed functions and parts, you don't need an editor for that only more of the interactive animations.
 

Offline Brumby

  • Supporter
  • ****
  • Posts: 12297
  • Country: au
Re: EEVacademy #4 - I2C Bit Banging
« Reply #4 on: July 22, 2017, 03:55:31 pm »
Good point about the code.

Watching somebody build it is a bit of a distraction.  There's a lot that goes on that doesn't add to the result - and can cause confusion.

All you really need is the finished source - and then be taken on a tour of it, followed by something demonstrating the testing.
 

Offline b_force

  • Super Contributor
  • ***
  • Posts: 1381
  • Country: 00
    • One World Concepts
Re: EEVacademy #4 - I2C Bit Banging
« Reply #5 on: July 22, 2017, 04:03:06 pm »
I still think the pace is to fast, I doubt if non-native speakers can follow it.
Feels like you're on a hurry. The viewer barely has time to think about what you just said.

Didn't enjoy it, sorry.
Watched only a couple of minutes of it.

Offline Brumby

  • Supporter
  • ****
  • Posts: 12297
  • Country: au
Re: EEVacademy #4 - I2C Bit Banging
« Reply #6 on: July 22, 2017, 05:03:29 pm »
I still think the pace is to fast, I doubt if non-native speakers can follow it.
Feels like you're on a hurry. The viewer barely has time to think about what you just said.

This is a very good point.

I'm a well-versed native speaker that has no issue with the pronunciation - and I was not given much time to absorb what was said.  I have little doubt that many non-native speakers would be overly challenged.

Also, I refer to a comment I made on the SPI video - that pauses are useful ... and necessary.  There was an improvement in this video, which was great - but there might be some room for a bit more.



All this needs to be taken with a grain of salt ... you are never going to please everyone.
 

Offline b_force

  • Super Contributor
  • ***
  • Posts: 1381
  • Country: 00
    • One World Concepts
Re: EEVacademy #4 - I2C Bit Banging
« Reply #7 on: July 22, 2017, 07:24:13 pm »
All this needs to be taken with a grain of salt ... you are never going to please everyone.
This is true, but than what is the audience?

For me personally it didn't sound like an explanation/class in something.
It sounded like someone with knowledge, sharing information to someone else with enough knowledge.
And still, I have been in the field long enough, but I still prefer to keep things as simple as possible.
(That was also one of Einsteins strengths, keep things simple)

Offline Craftplorer

  • Contributor
  • Posts: 12
  • Country: de
Re: EEVacademy #4 - I2C Bit Banging
« Reply #8 on: July 22, 2017, 10:15:00 pm »
Hi,
great video and very nice visualization.
I would like to see how you implemented the timings on an actual platform.
Can you post/upload the CCS code from the "Bit Banging SPI" video?
 

Online jpanhalt

  • Super Contributor
  • ***
  • Posts: 3472
  • Country: us
Re: EEVacademy #4 - I2C Bit Banging
« Reply #9 on: July 22, 2017, 10:22:23 pm »
To be absolutely truthful, the first time I saw the title of this thread, I read it as "EE Vasectomy" and wondered "what"?

The video is not bad, but perhaps a less confusing name for us dyslexic types might be better.  On the other hand, my mis-reading was the only reason I opened the thread, so leave it as is.

John
 

Offline kire9999

  • Newbie
  • Posts: 2
  • Country: us
Re: EEVacademy #4 - I2C Bit Banging
« Reply #10 on: July 22, 2017, 10:25:41 pm »
Thank you so much Dave2  :-+  :-+, I really enjoyed your video. BTW, any chance you can share your C++ project of this example?, I'm currently trying to learn C++ and would like to have an example like yours.

Thanks!
 

Offline sleemanj

  • Super Contributor
  • ***
  • Posts: 3024
  • Country: nz
  • Professional tightwad.
    • The electronics hobby components I sell.
Re: EEVacademy #4 - I2C Bit Banging
« Reply #11 on: July 22, 2017, 11:30:10 pm »
I still think the pace is to fast, I doubt if non-native speakers can follow it.
Feels like you're on a hurry. The viewer barely has time to think about what you just said.

Didn't enjoy it, sorry.
Watched only a couple of minutes of it.

I have not watched this, but generally speaking,  for a couple of other youtube channels I find the youtube speed  control very useful.  One i play at a faster speed because he has a v.e.r.y s.l.o.w natural speaking cadence with lots of long gaps, speeding up by half or even double speed makes it much more comfortable, one I play slower than normal because the concepts are often hard and she is sometimes just going way too fast for me to keep up, slowing down makes it easier to follow.
~~~
EEVBlog Members - get yourself 10% discount off all my electronic components for sale just use the Buy Direct links and use Coupon Code "eevblog" during checkout.  Shipping from New Zealand, international orders welcome :-)
 

Offline FrankBuss

  • Supporter
  • ****
  • Posts: 2365
  • Country: de
    • Frank Buss
Re: EEVacademy #4 - I2C Bit Banging
« Reply #12 on: July 24, 2017, 05:00:29 am »
Thank you so much Dave2  :-+  :-+, I really enjoyed your video. BTW, any chance you can share your C++ project of this example?, I'm currently trying to learn C++ and would like to have an example like yours.

The link is in the video description:

https://gitlab.com/Sepps/generic-bitbang-library-v1

But looks a bit over-engineered to me. Would be easier for many viewers, if it were a simple Arduino script without all the C++ overhead and without the extra pin class etc., just the bit-banging part, which could be implemented with a few functions in one script. Also in the I2C class the implementation should not be in the header file, but in the cpp file, the Pin class is better. And it should be really demonstrated with real hardware, again, very easy with an Arduino, because then the viewer can reproduce it faster, without needing to learn the intricacies of an IDE (and Visual Studio is a big and complicated IDE, too).
So Long, and Thanks for All the Fish
Electronics, hiking, retro-computing, electronic music etc.: https://www.youtube.com/c/FrankBussProgrammer
 

Offline b_force

  • Super Contributor
  • ***
  • Posts: 1381
  • Country: 00
    • One World Concepts
Re: EEVacademy #4 - I2C Bit Banging
« Reply #13 on: July 24, 2017, 08:39:24 am »
I still think the pace is to fast, I doubt if non-native speakers can follow it.
Feels like you're on a hurry. The viewer barely has time to think about what you just said.

Didn't enjoy it, sorry.
Watched only a couple of minutes of it.

I have not watched this, but generally speaking,  for a couple of other youtube channels I find the youtube speed  control very useful.  One i play at a faster speed because he has a v.e.r.y s.l.o.w natural speaking cadence with lots of long gaps, speeding up by half or even double speed makes it much more comfortable, one I play slower than normal because the concepts are often hard and she is sometimes just going way too fast for me to keep up, slowing down makes it easier to follow.
The speed control doesn't change the pace.
By that I mean pauses etc that the speaker implements to give the audience time to think about the things just said or to emphasize certain parts.
For that reason you can't expect the audience to do THAT by themselves, simply because they are the ones looking for information.

Second minor thing is that it feels very odd to slow down or speed up.

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26906
  • Country: nl
    • NCT Developments
Re: EEVacademy #4 - I2C Bit Banging
« Reply #14 on: July 24, 2017, 04:49:48 pm »
Does the proposed code support clock stretching? From what I've seen from the video it doesn't seem to do so. To support clock stretching you'll need to wait until SCL actually goes high on the I/O pin.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 
The following users thanked this post: pknoe3lh

Offline pknoe3lh

  • Regular Contributor
  • *
  • Posts: 115
  • Country: at
  • Trust me I'm an engineer
    • My Homepage
Re: EEVacademy #4 - I2C Bit Banging
« Reply #15 on: July 24, 2017, 04:54:37 pm »
Does the proposed code support clock stretching? From what I've seen from the video it doesn't seem to do so. To support clock stretching you'll need to wait until SCL actually goes high on the I/O pin.

Oh nice i didn't know this existed ^^

Offline FrankBuss

  • Supporter
  • ****
  • Posts: 2365
  • Country: de
    • Frank Buss
Re: EEVacademy #4 - I2C Bit Banging
« Reply #16 on: July 24, 2017, 04:57:30 pm »
Does the proposed code support clock stretching? From what I've seen from the video it doesn't seem to do so. To support clock stretching you'll need to wait until SCL actually goes high on the I/O pin.

A source code comment says it does support it. But it doesn't support multi-master mode.
So Long, and Thanks for All the Fish
Electronics, hiking, retro-computing, electronic music etc.: https://www.youtube.com/c/FrankBussProgrammer
 

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 16646
  • Country: 00
Re: EEVacademy #4 - I2C Bit Banging
« Reply #17 on: July 25, 2017, 09:56:56 am »
Does the proposed code support clock stretching? From what I've seen from the video it doesn't seem to do so. To support clock stretching you'll need to wait until SCL actually goes high on the I/O pin.

Oh nice i didn't know this existed ^^

It's an essential part of the protocol. Not all slaves will respond instantly in hardware, some are software driven. There has to be a mechanism in the protocol to force the master to wait until slaves are ready.

eg. Atmel chips like the Tiny85 don't have full I2C in hardware but they do have a little hardware unit that can detect an I2C START and hold SCL low. This allows the chip to wake up from sleep mode or whatever else it needs to do before responding.

nb. In theory any clock pulse can be stretched by slaves, not just START.
 
The following users thanked this post: pknoe3lh

Offline Mike Warren

  • Supporter
  • ****
  • Posts: 437
  • Country: au
    • Personal Website
Re: EEVacademy #4 - I2C Bit Banging
« Reply #18 on: July 26, 2017, 12:43:47 am »
Is it normal to call this buss "I two C"?

I've called it "I squared C" for the last 100 years. (okay, slight exaggeration).

I do work in a vacuum (no other engineers around me) so I can conceive I might have got it wrong for all these years.
 

Offline Bud

  • Super Contributor
  • ***
  • Posts: 6910
  • Country: ca
Re: EEVacademy #4 - I2C Bit Banging
« Reply #19 on: July 26, 2017, 02:14:28 am »
Did not like the format and overly fast pace, could only handle the first 3 min, then turned off....will not be watching in this format.
Facebook-free life and Rigol-free shack.
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26906
  • Country: nl
    • NCT Developments
Re: EEVacademy #4 - I2C Bit Banging
« Reply #20 on: July 26, 2017, 12:03:46 pm »
Does the proposed code support clock stretching? From what I've seen from the video it doesn't seem to do so. To support clock stretching you'll need to wait until SCL actually goes high on the I/O pin.
A source code comment says it does support it. But it doesn't support multi-master mode.
I found the code and it seems to support clock stretching indeed. What I hate about it is that the all the code is in the header file and the cpp file is empty  :palm: IMHO that is very bad coding style. The header file should describe the interface and not contain any code! Where did David learn to program? He should ask his money back  >:D
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Online enz

  • Regular Contributor
  • *
  • Posts: 134
  • Country: de
Re: EEVacademy #4 - I2C Bit Banging
« Reply #21 on: July 26, 2017, 12:11:23 pm »

I found the code and it seems to support clock stretching indeed. What I hate about it is that the all the code is in the header file and the cpp file is empty  :palm: IMHO that is very bad coding style. The header file should describe the interface and not contain any code! Where did David learn to program? He should ask his money back  >:D


You know the difference between C source code and a C++ class regarding this issue?
 

Offline Fungus

  • Super Contributor
  • ***
  • Posts: 16646
  • Country: 00
Re: EEVacademy #4 - I2C Bit Banging
« Reply #22 on: July 26, 2017, 02:30:36 pm »
What I hate about it is that the all the code is in the header file and the cpp file is empty  :palm: IMHO that is very bad coding style. The header file should describe the interface and not contain any code! Where did David learn to program? He should ask his money back  >:D

In 2017 we prefer all the code in the .h file and no .cpp file at all.

Some IDEs even insist on it.
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 7763
  • Country: de
  • A qualified hobbyist ;)
Re: EEVacademy #4 - I2C Bit Banging
« Reply #23 on: July 26, 2017, 03:12:18 pm »
Does the proposed code support clock stretching? From what I've seen from the video it doesn't seem to do so. To support clock stretching you'll need to wait until SCL actually goes high on the I/O pin.

A source code comment says it does support it. But it doesn't support multi-master mode.

AFAIK, there are two clock stretching variants, i.e. inter-bit and inter-byte.
 

Offline coppice

  • Super Contributor
  • ***
  • Posts: 8641
  • Country: gb
Re: EEVacademy #4 - I2C Bit Banging
« Reply #24 on: July 26, 2017, 03:17:42 pm »
Is it normal to call this buss "I two C"?

I've called it "I squared C" for the last 100 years. (okay, slight exaggeration).

I do work in a vacuum (no other engineers around me) so I can conceive I might have got it wrong for all these years.
In a vacuum nobody can hear what you call it. Outside a vacuum, "I squared C" was the original official Philips naming, and its still what the great majority of people say.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf