Adventures with I2C & Minerva Mk2

Anything QL Software or Programming Related.
User avatar
t0nyt
QL Wafer Drive
Posts: 1172
Joined: Wed Nov 22, 2023 6:46 pm
Location: UK

Re: Adventures with I2C & Minerva Mk2

Post by t0nyt »

NormanDunbar wrote: Mon Sep 08, 2025 7:30 am Exactly. I laid out the pseudo code for a scanner near the start of this thread
I thought you had, but damned if I can find it


User avatar
t0nyt
QL Wafer Drive
Posts: 1172
Joined: Wed Nov 22, 2023 6:46 pm
Location: UK

Re: Adventures with I2C & Minerva Mk2

Post by t0nyt »

Ok, that's worked a treat thanks

Sorry for being so thick, Many thanks all

New code

Code: Select all

100 WHEN ERRor
110    f=0
120    CONTINUE
130 END WHEN
140 PRINT "SCAN STARTING"
150 c$=CHR$(164) & CHR$(255)
160 FOR x = 0 TO 127
170    f=1
180    r$=I2C_IO(c$,0,x,0)
190    IF f=1 THEN PRINT "Device Found at " & HEX$(x,8) & " (" & HEX$(x*2,8) & ")"
200 NEXT x
210 PRINT "SCAN COMPLETE"
Sample output
IMG_5041.jpeg


User avatar
t0nyt
QL Wafer Drive
Posts: 1172
Joined: Wed Nov 22, 2023 6:46 pm
Location: UK

Re: Adventures with I2C & Minerva Mk2

Post by t0nyt »

The scanner has thrown up an issue with the AT24C256

It shows as both &54(&A8) AND &5C(&B8), confirmed as when unplugged both devices vanish

&54(&A8) works fine with both test programs

&5C(&B8) corrupts the end of the "page test" text
I thought maybe it was writing to Minerva, but on checking settings they hadn't been corrupted

Reading the data sheet I can't work out why this is happening

Any thoughts on how I could troubleshoot this please?

Many thanks
Tony


User avatar
XorA
Site Admin
Posts: 1736
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: Adventures with I2C & Minerva Mk2

Post by XorA »

No idea on your problem!

But not all i2c addresses are valid so you can speed up your loop by skipping the invalid ones!

https://www.i2c-bus.org/addressing/


User avatar
t0nyt
QL Wafer Drive
Posts: 1172
Joined: Wed Nov 22, 2023 6:46 pm
Location: UK

Re: Adventures with I2C & Minerva Mk2

Post by t0nyt »

XorA wrote: Mon Sep 08, 2025 10:46 am No idea on your problem!

But not all i2c addresses are valid so you can speed up your loop by skipping the invalid ones!

https://www.i2c-bus.org/addressing/
Thanks for the link XorA, will have a read thru thanks

The current scan only takes about 1 second (on SGC)


User avatar
t0nyt
QL Wafer Drive
Posts: 1172
Joined: Wed Nov 22, 2023 6:46 pm
Location: UK

Re: Adventures with I2C & Minerva Mk2

Post by t0nyt »

t0nyt wrote: Mon Sep 08, 2025 10:25 am The scanner has thrown up an issue with the AT24C256

It shows as both &54(&A8) AND &5C(&B8), confirmed as when unplugged both devices vanish

&54(&A8) works fine with both test programs

&5C(&B8) corrupts the end of the "page test" text
I thought maybe it was writing to Minerva, but on checking settings they hadn't been corrupted

Reading the data sheet I can't work out why this is happening

Any thoughts on how I could troubleshoot this please?

Many thanks
Tony
I bought a 5 pack of these and I just tried the other 4 and even using the correct address they don't work properly

The fact that 1 seems to work, on proper address, makes me think these are a cheap knock off

Will order another from somewhere more reputable to test


User avatar
XorA
Site Admin
Posts: 1736
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: Adventures with I2C & Minerva Mk2

Post by XorA »

I think we should get you a "Member of the I2C Club" badge now :-D


User avatar
Pr0f
QL Wafer Drive
Posts: 1618
Joined: Thu Oct 12, 2017 9:54 am

Re: Adventures with I2C & Minerva Mk2

Post by Pr0f »

t0nyt wrote: Mon Sep 08, 2025 10:25 am The scanner has thrown up an issue with the AT24C256

It shows as both &54(&A8) AND &5C(&B8), confirmed as when unplugged both devices vanish

&54(&A8) works fine with both test programs

&5C(&B8) corrupts the end of the "page test" text
I thought maybe it was writing to Minerva, but on checking settings they hadn't been corrupted

Reading the data sheet I can't work out why this is happening

Any thoughts on how I could troubleshoot this please?

Many thanks
Tony
What have you got the 3 address lines tied to on these NVRAM's ? Don't leave them 'flapping' or unconnected. You need to set at least one of these pins to 5v logic 1, so that you avoid contention with the RTC chip, you may also need to avoid other chips that have clashing addresses.


User avatar
t0nyt
QL Wafer Drive
Posts: 1172
Joined: Wed Nov 22, 2023 6:46 pm
Location: UK

Re: Adventures with I2C & Minerva Mk2

Post by t0nyt »

Pr0f wrote: Mon Sep 08, 2025 12:37 pm What have you got the 3 address lines tied to on these NVRAM's ? Don't leave them 'flapping' or unconnected. You need to set at least one of these pins to 5v logic 1, so that you avoid contention with the RTC chip, you may also need to avoid other chips that have clashing addresses.
A2 is tied to 5v and A0/A1 tied to ground (to avoid clash with Minerva NVRAM)

No other clashes (and it's the same with just this 1 device attached)

Thanks
Tony


User avatar
Pr0f
QL Wafer Drive
Posts: 1618
Joined: Thu Oct 12, 2017 9:54 am

Re: Adventures with I2C & Minerva Mk2

Post by Pr0f »

Have you got a picture of the chip to see what the label looks like?

You did mention the possibility of them being suspect...


Post Reply