Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 10:48 28 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : why "Error : Pin not set for I2C"?

Author Message
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3150
Posted: 06:04pm 23 Jun 2023
Copy link to clipboard 
Print this post

PicoMite MMBasic Version 5.07.08b6
Copyright 2011-2023 Geoff Graham
Copyright 2016-2023 Peter Mather

> option list
PicoMite MMBasic Version 5.07.08b6
OPTION SYSTEM I2C GP14,GP15
OPTION COLOURCODE ON
OPTION DISPLAY 43, 120
OPTION LCDPANEL SSD1306I2C, LANDSCAPE, 2
OPTION RTC AUTO ENABLE
> text 0,0,"This is line 1"
> ?date$,time$
01-01-2000      00:00:37
> rtc settime "23/06/23 14:57"
> ?date$,time$
23-06-2023      14:57:03
> run
    0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
00:
[12] I2C write addr, 0, 1, &H00  ' write zero to that adress
Error : Pin not set for I2C
> list
' i2cdetect like program

' Prep table
Print "     0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F"

' loop col/row
For y=0 To 7
Print Hex$(y,2);": ";
For x=0 To 15
 addr = y*16+x               ' calc address
 I2C write addr, 0, 1, &H00  ' write zero to that adress
 If MM.I2C=0 Then            ' check for errors
   Print Hex$(addr,2);" ";   ' found one!
Else
  Print "-- ";               ' nothing here..
EndIf
Next x
Print
Next y


From the command line, the LCD is written to successfully, and the RTC is set with "RTC SETTIME", but the program to detect I2C devices fails with "Error : Pin not set for I2C" even though the system I2C is set.
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2129
Posted: 06:32pm 23 Jun 2023
Copy link to clipboard 
Print this post

' Set Pins!
SetPin gp14, gp15, I2C

' Open first I2C
I2C open 100, 200
Edited 2023-06-24 04:41 by stanleyella
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3150
Posted: 08:00pm 23 Jun 2023
Copy link to clipboard 
Print this post

Per the manual: "The I2C based display controllers use the SYSTEM I2C pins as per the pinout for the specific device. Other I2C devices can share the bus subject to their addresses being unique.
If an I2C display is configured it will not be necessary to "open" the I2C port for an additional device (I2C OPEN)".

Am I misunderstanding what the manual is saying?
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4247
Posted: 08:15pm 23 Jun 2023
Copy link to clipboard 
Print this post

Pin gp14 and gp15 are I2C2, not I2C

Volhout
PicomiteVGA PETSCII ROBOTS
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3150
Posted: 09:50pm 23 Jun 2023
Copy link to clipboard 
Print this post

  Volhout said  Pin gp14 and gp15 are I2C2, not I2C


That was it. Working now on I2C2. Thanks.
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024