Menu

I2C Bus

Help
2020-09-08
2020-09-08
  • Bertrand BAROTH

    Bertrand BAROTH - 2020-09-08

    Hello ...
    I wanna use an ATMega162 as an I2C master, with I2C-software-routines since this processor has apparently no I2C hardware interface. The data line is bidirectional for the I2C bus, unfortunately the Mega ports are not. So my question : do GC-Basic I2C-software-routines switch the data direction automatically, as needed ? Thanks in advance ...

     
    • Anobium

      Anobium - 2020-09-08

      Yes.

       
  • Bertrand BAROTH

    Bertrand BAROTH - 2020-09-08

    Thanks ... And is the "weak" pull-up activated when the line acts as an input ?

     
    • Anobium

      Anobium - 2020-09-08

      No. You should always use external pull-ups.

       
    • Anobium

      Anobium - 2020-09-08

      No. You should always use external pull-ups.

       
  • Bertrand BAROTH

    Bertrand BAROTH - 2020-09-08

    I tried to adapt the prog written for the Chipino for my STK200 board (prog attached) to find the ID of a device that I bought online (LCD Display 40 chars x 2 with I2C), I wanted to display the ID in GCBasic's Terminal via a CP210x based USB to serial adapter ; first I had to copy I2C.h from "include\lowlevel" to "include" . And then at compilation I got :

    An error has been found:

    Error: GCASM: Symbol INITI2C has not been defined at CALL INITI2C

    What is going wrong ? Thanks in advance ...

    PS : about pull-ups : 10K on both lines ?

     

    Last edit: Bertrand BAROTH 2020-09-08
    • Anobium

      Anobium - 2020-09-08

      You do no tneed the include line. Anything in lowlevel is included automatically.

      Compiled with RC24 OK here with the include line removed.

      15:11:43    G+Stool started with parameter 'hex'   ->   processing   C:\GCB@SynRC23\G+Stools\makeHEX.bat
      Source-File  =  C:\Users\admin\Downloads\I2CTest.gcb
      Target-File  =  C:\Users\admin\Downloads\I2CTest.hex
      Compiler Version (YYYY-MM-DD): 0.98.07 RC24 2020-09-06 (Windows 64 bit)   Program Memory: 748  bytes    RAM: 56/1024 bytes (5.47%)   OSC: 4Mhz   Chip: MEGA162
      Duration:   0.9  Seconds.
      
       
  • Bertrand BAROTH

    Bertrand BAROTH - 2020-09-08

    Another gaseous plant which does not work ... Bye I2C ! And Terminal crashes sometimes : unable to disconnect !

     
    • Anobium

      Anobium - 2020-09-08

      Software I2C works. So, what is happening?

      What is happening on the SDA and SCL lines? Do you have an cheapo analyser?

      What is your operating system? I do not get crashes with Terminal - unless I totally overload the input buffer.

       
  • Bertrand BAROTH

    Bertrand BAROTH - 2020-09-08

    My OS is Windows 7 x64 pro. Now the terminal does no more crash (?) ... Finally I found that the DeviceID is 0x4E. Unfortunately the control codes for the display are ... nowhere, the only thing I found is that Bit3 switches the backlight on/off. So the display seems to be useless ! Now I tried to contact the seller, wait and see !

     

    Last edit: Bertrand BAROTH 2020-09-08
  • Bertrand BAROTH

    Bertrand BAROTH - 2020-09-08

    Meanwhile I saw that GCBasic has routines for alphanumeric displays ... I tested them, but the system worked "randomly", I saw only one correct sequence ; I suspect that there is a hardware problem with the I2C or the reset ; unfortunately I am not able to desolder the interface, when I bought the display I thought that it was only "plugged in" ... In a few days I will get displays with only parallel interface. I hope they will work better !

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.