20047 SER2 - Practical I2C: Introduction, Implementation and Troubleshooting

Ғылым және технология

"Why am I not receiving an acknowledge from my slave device?" "Help! I cannot write to my I2C EEPROM." "I always read 0xFF. What is wrong?" These are some of the comments we hear and this class will provide useful insights about I2C. It will start with an I2C introduction and key concepts, continue with configuring the PIC® Microcontroller as an I2C Master or Slave, and end with demos showing common I2C communications failures and how to troubleshoot them. This class is recommended for anyone using I2C, planning to use I2C or who just wants to learn more about I2C.
www.microchip.com/microcontrol...
www.microchip.com/memory
www.microchip.com/masters

Пікірлер: 78

  • @ArjanvanVught
    @ArjanvanVught5 жыл бұрын

    This is the best I2C presentation I've ever seen. Thank you!

  • @roycun5013
    @roycun50132 жыл бұрын

    Love the way presentation is being presented.

  • @Gustavotoselli
    @Gustavotoselli4 жыл бұрын

    This is the best presentation about I2C available on internet. Thank you too!

  • @joshireddy9192
    @joshireddy91923 жыл бұрын

    This is the best explanation of i2c I ever saw :):) Wish you to do the similar session for spi too

  • @uniquesharma8913
    @uniquesharma89134 жыл бұрын

    great presentation, this class help me a lot for understanding i2c

  • @piclab8340
    @piclab83406 жыл бұрын

    Very informative video on i2c. Thanks Microchip !

  • @geraldcharbonier6313
    @geraldcharbonier63136 жыл бұрын

    The best course about I2C i ever found. Thank you !

  • @siriri1313
    @siriri13137 жыл бұрын

    thanks for this course. it would be great if you can include more code examples to write / read and configure registers

  • @DanielMorenoBio
    @DanielMorenoBio7 жыл бұрын

    Congratzz for this video. biomedical engineering student. Universidad autonoma de baja california

  • @hks9697
    @hks96976 жыл бұрын

    Wonderfully explained. Thanks a lot.

  • @jp_engineer
    @jp_engineer Жыл бұрын

    03:00 - I2C Overview 08:00 - Data transfer 19:54 - Control and Status register 44:00 - Common issues 58:15 - Demo 1:26:00 - Troubleshooting 1:29:30 - summary

  • @Zh87119
    @Zh871192 жыл бұрын

    Thanks for a well presented video.

  • @technics6215
    @technics62154 жыл бұрын

    Thank you! Great I2C training.

  • @bingnanliu8208
    @bingnanliu82082 жыл бұрын

    Great training. Thank you!

  • @piotrbatko172
    @piotrbatko1723 жыл бұрын

    Great lecture. Thank you.

  • @tocadisco4166
    @tocadisco41666 жыл бұрын

    Excellent! Where can we find the souce code?

  • @stevenrogersfineart4224
    @stevenrogersfineart42242 жыл бұрын

    This is great. I was tired of quick videos that really didn't get to the core. I want to UNDERSTAND THE PROTOCOL not just install random libraries and pray lol.

  • @charlesyeh493
    @charlesyeh4934 жыл бұрын

    very nice presentation~ but is there any way that i can download the power point? thank you

  • @hardware4200
    @hardware42003 жыл бұрын

    Really great presentation, thank you.

  • @MicrochipTechnology

    @MicrochipTechnology

    3 жыл бұрын

    Thank you!

  • @raghuverma6670

    @raghuverma6670

    3 жыл бұрын

    @@MicrochipTechnology That woman telephone operator at bangalore is totally unprofessional & doesn't know how to deal with people. I had called on 08030904444 regarding some queries but she totally behaved in an uncivilized manner. It will be better if there is some professional person instead of her

  • @MANUELORTIZ-sn2lh
    @MANUELORTIZ-sn2lh4 жыл бұрын

    Excuse me. Can you help me with an addres when I can find courses for study presentially in Microchip. Thanks

  • @MANUELORTIZ-sn2lh
    @MANUELORTIZ-sn2lh4 жыл бұрын

    Thanks for your help.

  • @sonalikudal9188
    @sonalikudal91885 жыл бұрын

    Nice video.. will u plz make one on spi protocol too.. it will be too helpful for students

  • @rawlc.5086
    @rawlc.50862 жыл бұрын

    This is a nice video but there's one more question to add to your video description... "why every explanation is given in C? Some of us would like to (as long as you are explaining i2c fundaments) know how to use i2c in assembly code", otherwise MCC will solve the code requisitions... and by the way, mnemonics are the closest way to "talk" with PIC's. It would be awesome if you could please explain how to configure it in ASM, with the new xc8 pic-as (wich is completely diferent and hard to addapt previous codes, i'm still trying to understand the new "psect udata udatashare code class=code... etc") it would be so usefull a nice explanation like this. Thanks :)

  • @boopeshrajaneelaraj3442
    @boopeshrajaneelaraj34426 жыл бұрын

    "I always read 0xFF. What is wrong?", Please verify the return statement on EEpromread function it returns 0XFF, that is why you always read 0xFF.

  • @ajitnayak1541
    @ajitnayak15416 жыл бұрын

    Please share demo.c file or zip file to understand function

  • @phtrindadeful
    @phtrindadeful4 жыл бұрын

    Activation of subtitles, contributions to learning, globally.

  • @pallavilambe1870
    @pallavilambe18706 жыл бұрын

    Thanks for video, Is the speed of I2C bus is depends on the VDD?

  • @pallavilambe1870

    @pallavilambe1870

    6 жыл бұрын

    Thank you sir

  • @State_Of_Mind_1947
    @State_Of_Mind_19476 жыл бұрын

    Please upload tutorials on USART.

  • @hamiltonhorta5441
    @hamiltonhorta54416 жыл бұрын

    Would it be possible to publish the i2C_demo.c program? I would be very grateful

  • @hemjal100

    @hemjal100

    4 жыл бұрын

    void eepromWrite (char slaveAddress, char Addhigh, char AddLow, char eeData); char eepromread (char slaveAddress, char Addhigh, char AddLow); // slave address is the address byte (slave address +r/w bit) // addHigh is the eeprom Address high bye // eedata is the data to be written in the slave volatile char ReadData; // global variable for monitoring. void main(void) { int x; //general purpose variable OSCCONbits.IRCF = 12 /// 2MHZ clock ANSELB = 0; // All portB pins are digital TRISBbits.TRISB0=0; // RB0 is output. LATBbits.LATB0 = 1; // LED indicator to know that code is running. SSPADD = 4; // 100khZ i2c CLOCK WITH fOSC = 2 mhZ // i2c CLOCK = fOSC/ (4*(sspadd+1)) sspcon1 = 0X28 // sspm = 1000 (i2c mASTER) // sspen = 1 (i2c module is enabled) eepromWrite (0xA0, 0x12, 0x34, 0x78); for (x=1; x

  • @jpdesroc

    @jpdesroc

    4 жыл бұрын

    This part of C code is needed and missing at the end of write_I2C(..) function ! or Is-it ?? I tested the read & write I2C functions using a PCF8563 I2C Real Time Clock and noticed some of the RTC registers was uncorrectly written by the write_I2C() function. The read_I2C(...) function though was correctly reading any of the RTC registers. So I had a look at the write_I2C() function and check the START, ACK, NACK and STOP flags and where they were installed in the function.. And I remembered the Microchip teacher talked about a NACK flag sent from the PIC master to the slave EEPROM at the end of the read_I2C() function telling it 'I don't need any data anymore' so the slave could correctly end up the I2C transmission.. Since the RTC and the EEPROM can be accessed one register at a time or with a sequential datas sent or read from a starting address it make sense the NACK should be sent at the end of both write_I2C() and read_I2C() functions right ? So the read_I2C() function had a NACK flag sent to the slave at the end of its code, but the write_I2C() did not ! See part of the write_I2C() end below and see the added NACK code. After this code added to the write_I2C's end I could now correctly write ANY values to the RTC registers and read them back with equal values. Maybe I forgot something in my added code here and I'm not doing things right but the RTC communication now works perfectly. (PIC16F877, Pullup res of 4K7 and I2C speed @ 100Khz) Jean-Pierre Desrochers. /////////////////////////////////////////////// void write_I2C(unsigned char slaveAddress, unsigned char Address, unsigned char Data) { SSPCON2bits.SEN = 1; // initiate start condition while(SEN); PIR1bits.SSPIF = 0; // clear SSP interrupt flag SSPBUF = slaveAddress; // send slave address and R/W bit while(!SSPIF); // wait for ack. SSPIF is set every 9th clock cycle. PIR1bits.SSPIF = 0; // clear SSP interrupt flag if(SSPCON2bits.ACKSTAT) { SSPCON2bits.PEN = 1; // initiate stop condition while(PEN); // wait for start to complete return; // exit write (No ack) cause no slave replied ! } SSPBUF = Address; // send slave address and R/W bit while(!SSPIF); // wait for ack. SSPIF is set every 9th clock cycle. PIR1bits.SSPIF = 0; // clear SSP interrupt flag if(SSPCON2bits.ACKSTAT) { SSPCON2bits.PEN = 1; // initiate stop condition while (PEN); // wait for start to complete return; // exit write (No ack) cause no slave replied ! } SSPBUF = Data; // send slave address and R/W bit while(!SSPIF); // wait for ack. SSPIF is set every 9th clock cycle. PIR1bits.SSPIF = 0; // clear SSP interrupt flag if(SSPCON2bits.ACKSTAT) { SSPCON2bits.PEN = 1; // initiate stop condition while(PEN); // wait for start to complete return; // exit write (No ack) cause no slave replied ! } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // This part of C code is needed and missing at the end of write_I2C(..) function. // else // { // SSPCON2bits.ACKDT = 1; // Prepare to send NACK

  • @aayushdev5936
    @aayushdev59364 жыл бұрын

    what's the reason behind the second ACK pin? And thanks for the video this was one of the best explanation ever found on KZread.

  • @MicrochipTechnology

    @MicrochipTechnology

    4 жыл бұрын

    @Aayush Dev - Can you please point us to a specific time stamp in the video to help us best answer your question? Thank you!

  • @aayushdev5936

    @aayushdev5936

    3 жыл бұрын

    @@MicrochipTechnology 16:26 immediately after the data is sent, it can be seen there is one more ACK .

  • @raghuverma6670

    @raghuverma6670

    3 жыл бұрын

    @@MicrochipTechnology That woman telephone operator at bangalore is totally unprofessional & doesn't know how to deal with people. I had called on 08030904444 regarding some queries but she totally behaved in an uncivilized manner. It will be better if there is some professional person instead of her

  • @NahuelGDure
    @NahuelGDure4 жыл бұрын

    I am trying to send a data from the PC using the uart save it in memory and then read from the memory and write again using the uart to display it on the pc. I have used several codes and the problem persists. I send an "a" or "01100001" and receive two bytes "00000000 00111111". Any idea what it could be? I used your code

  • @MicrochipTechnology

    @MicrochipTechnology

    4 жыл бұрын

    Kindly visit support.microchip.com for assistance. Thank you.

  • @istvanhorvath5690

    @istvanhorvath5690

    3 жыл бұрын

    I tried mcc (code configurator) simple master and eeprom example. Both worked but eeprom example is much better. It is a while (blocked) triggered but accomplised to made self state machine non blocking style.

  • @kmlk1923
    @kmlk19233 жыл бұрын

    37:58 "by default it is disabled..." but as it's seen from the slide by default bit value is ZERO and in the definition this enables the feature. Though it is interesting that a CLEAR bit enable a feature ? . So either slide or instructor may be wrong.

  • @MicrochipTechnology

    @MicrochipTechnology

    3 жыл бұрын

    Thank you for pointing that out. It is indeed clear (0) by default. This means it is enabled. We checked the datasheet, which is the recommended approach when faced with conflicting ideas. The most recent information is in the datasheet. Thank you for attending this class and paying careful attention to the presentation.

  • @aravindadas567
    @aravindadas5672 жыл бұрын

    Sir, PIC 16F877A is readable by pickit2, but writing is not working. in one ic, what is the problem? is ic repairable.

  • @MicrochipTechnology

    @MicrochipTechnology

    2 жыл бұрын

    In this case, please submit a support case here: microchipsupport.force.com/s/communityknowledge

  • @mattakalyan1427
    @mattakalyan14274 жыл бұрын

    when transmitting the address and next data how the slave is treating it is addressed and it is data after acknowledgment how data is recognized

  • @istvanhorvath5690

    @istvanhorvath5690

    3 жыл бұрын

    Address sent by master always a write command. Data could be an uint8_t or uint16_t so 1 or 2 bytes. To store someting after that is a restart and data1 data2 data3.... so on untill stop. You can send 1st a read command without address write. It is the read current address command. Pointer of the slave device is somewhere (maybe the last position of last accomplished i2c process).

  • @sebastianbaiju7757
    @sebastianbaiju77574 жыл бұрын

    Can I attend this class or can I join with your company

  • @MicrochipTechnology

    @MicrochipTechnology

    4 жыл бұрын

    Kindly visit this site for Microchip MASTERs events and to register: techtrain.microchip.com/masters/Home.aspx

  • @kalyanjanigala
    @kalyanjanigala4 жыл бұрын

    SPI protocol class plz

  • @rajnanditagautam7736
    @rajnanditagautam7736 Жыл бұрын

    How to write Verilog code for LVDS implementation into M2S025-FG484 FPGA board. Is LVDS incompatible with this board

  • @MicrochipTechnology

    @MicrochipTechnology

    Жыл бұрын

    Hello and thanks for your question! LVDS is supported in the SmartFusion2 M2S025-FG484. Please contact Microchip’s FPGA design partners to learn how to write Verilog code for LVDS implementation: www.microchip.com/en-us/products/fpgas-and-plds/fpga-design-resources/fpga-design-partners. We also offer SmartFusion and SmartFusion2 simulation library source files here: microchipsupport.force.com/s/article/SmartFusion-and-SmartFusion2-VHDL-simulation-library-source-files-support-1625098162917 Please let us know if this helps!

  • @aleksatirnanic5220
    @aleksatirnanic52209 ай бұрын

    Do you have something like that for CAN protocol in MCC?

  • @MicrochipTechnology

    @MicrochipTechnology

    9 ай бұрын

    Hi Aleksa, this application note might be helpful for you: ww1.microchip.com/downloads/en/Appnotes/MPLAB-Code-Configurator-CAN2.0B-Module-For-PIC18-00002714A.pdff

  • @GreatHacker1
    @GreatHacker116 күн бұрын

    my pic16f687 hasn't many of these registers and there's no example on the datasheet. How can I know what to do to start it on the right way?

  • @MicrochipTechnology

    @MicrochipTechnology

    2 күн бұрын

    Hi there, thanks for reaching out. To get started, you’ll need to configure your MCU with some basic steps. Setup Configuration Bits: Configure the oscillator, watchdog timer, power-up timer, and low-voltage programming in MPLAB X. Use MPLAB Code Configurator (MCC) for easier setup. Some basic example code is here: #include #define _XTAL_FREQ 20000000 void main() { TRISB = 0x00; // Set PORTB as output while(1) { LATBbits.LATB0 = 1; // Turn on LED connected to RB0 __delay_ms(500); LATBbits.LATB0 = 0; // Turn off LED __delay_ms(500); } } This is to toggle an LED. We hope this helps! If you need more technical guidance, reach out to Microchip.com/CSS.

  • @GreatHacker1

    @GreatHacker1

    2 күн бұрын

    @@MicrochipTechnology I know how to toogle a led. The pic16f687 doesn't have MCC, the least it has is bits configuration and it's XTAL_FREQ is 8000000. It's like I said, some microcontrollers have a bad documentation

  • @joshireddy9192
    @joshireddy91923 жыл бұрын

    Hi, Why is msb bit sent first in the data byte?

  • @MicrochipTechnology

    @MicrochipTechnology

    3 жыл бұрын

    Kindly address your question to support.microchip.com. Thank you.

  • @giaoconhuynh7330
    @giaoconhuynh73304 жыл бұрын

    Tks for the presentation

  • @ronaldodeitos3997
    @ronaldodeitos399711 ай бұрын

    MUITO BOM, MAS GOSTARIA DE VER UMA APLICAÇÃO COM ADS1110 (TEXAS) E O PIC 16F873A OU 870

  • @MicrochipTechnology

    @MicrochipTechnology

    10 ай бұрын

    Hi there, thank you for your feedback! We appreciate it and will pass it along to our product team. They will take it into consideration as they strive to enhance our code examples and software libraries.

  • @saeednama
    @saeednama3 жыл бұрын

    Could you please provide the demo code?

  • @MicrochipTechnology

    @MicrochipTechnology

    3 жыл бұрын

    Kindly visit support.microchip.com for assistance. We do not provide support on KZread. Thank you.

  • @kevin-kw8bv

    @kevin-kw8bv

    3 жыл бұрын

    @@MicrochipTechnology youtube wont find out, just give him the code bro

  • @vigneshvicky8903
    @vigneshvicky89034 жыл бұрын

    can a slave control clock line ??

  • @istvanhorvath5690

    @istvanhorvath5690

    3 жыл бұрын

    No i2c master is the source of clk signal. This is the syncron wave. Master need to shift out or in the 8bit data.

  • @vicentematricardi3596
    @vicentematricardi35962 жыл бұрын

    Pongan subtitulos !!!!!!

  • @marcos-lq2nh
    @marcos-lq2nh7 жыл бұрын

    NBA Jam T.E.Sega Genesis

Келесі