Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 03:42 23 May 2026 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 : Stepper Project

     Page 11 of 15    
Author Message
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 3222
Posted: 07:57am 14 May 2026
Copy link to clipboard 
Print this post

For your testing you may need to change the I2C address from &H50 to something else. Your RTC module probably has a 24C32 EEPROM on it that could also be using that address.

At the console type - List System I2C and it will list all the addresses currently in use.
The RTC chip will probably be &H68 and the EEPROM will be in the range &H50 to &H57.
 
Bryan1

Guru

Joined: 22/02/2006
Location: Australia
Posts: 2002
Posted: 08:07am 14 May 2026
Copy link to clipboard 
Print this post

Just tried that list system I2C

> list system I2C
HEX  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: 50 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
>  


Now the zero is connected along with the RTC

Ok silly me had the connections wrong and now they are the right way doing a Run

> run











>


Where it shows on the USB connect on figure on the LCD it does show 8 figures
Edited 2026-05-14 18:19 by Bryan1
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 3222
Posted: 08:19am 14 May 2026
Copy link to clipboard 
Print this post

&H50 is the address of the EEPROM so change your master / slave code to use say &H55.
Or anything except &H50 or &H68.

The example code in the manual should be sending all the uppercase letters of the alphabet to the slave one at a time so the slave console should show:-
A
B
C
D
E
etc

An the slave should be sending its local Time$ to the master.
So master console should show something like:-
00:05:04
00:05:05
00:05:06
00:05:07
etc
Edited 2026-05-14 18:34 by phil99
 
Bryan1

Guru

Joined: 22/02/2006
Location: Australia
Posts: 2002
Posted: 08:27am 14 May 2026
Copy link to clipboard 
Print this post

For some reason it does seem this computer as when I plug my good C cable the zero doesn't show up on the com port. Now doing a reboot did see it respond and come back with a com port so be right back and see if it does respond.
Edited 2026-05-14 18:28 by Bryan1
 
Bryan1

Guru

Joined: 22/02/2006
Location: Australia
Posts: 2002
Posted: 08:38am 14 May 2026
Copy link to clipboard 
Print this post

ok did a reboot and still no com port assigned, now the USB for the pico is unattached and the battery is off line so the zero should be seen.

Now I just connected that new zero and it got a com port so I tried again and removed the +5V line to the zero as it does power the pico off the usb but still no com port so all that is connected to the zero is the I2C lines and earth.

Now just removed the zero from the board and the com port came up and when picking up the zero it was hot on the back so the regulator was nice and hot so I may need to visit a new power supply as it was tied to the 5V rail and I did have a wire going to VSYS.
 
Bryan1

Guru

Joined: 22/02/2006
Location: Australia
Posts: 2002
Posted: 08:45am 14 May 2026
Copy link to clipboard 
Print this post

Ok got both codes loaded with &H55 and when run nothing on both the console and LCD

[CODE> list system I2C
HEX  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: 50 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ]
Edited 2026-05-14 18:48 by Bryan1
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 3222
Posted: 08:47am 14 May 2026
Copy link to clipboard 
Print this post

Have you put 5V on the 3.3V supply? It might be the Pico chip that is cooking.

Nothing there should draw enough current to make the regulator hot, except a short somewhere.
A bigger power supply may just cook things faster!
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 3222
Posted: 08:53am 14 May 2026
Copy link to clipboard 
Print this post

The example code doesn't send anything to the LCD, it needs console connections for both.
On the master you could use a TYPE statement following the Print to put it on the LCD also.
 
Bryan1

Guru

Joined: 22/02/2006
Location: Australia
Posts: 2002
Posted: 08:54am 14 May 2026
Copy link to clipboard 
Print this post

No got the pico on the YSYS pin and the zero on the 5V pin which is also connected to the 5V rail on the breadboard, also put a wire from the 5V on the zero to VSYS.

As the 2350A is now running the LCD off the usb I'm leaving the lithium battery off so I don't cook things as I tend to do  

Also I have the LCD setup as console so what is seen on the com port it shown on the LCD
Edited 2026-05-14 18:55 by Bryan1
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 8842
Posted: 09:58am 14 May 2026
Copy link to clipboard 
Print this post

Be careful with the Zero. You shouldn't connect its 5V pin if you have the USB connector linked to your PC. There's no isolation diode like there is between VBUS and VSYS on a Pico so you will back-feed 5V into your PCs USB. The 5V pin is VBUS, not VSYS - that isn't brought out. I doubt if its really safe to power it at all while the USB-C is connected as the onboard linear regulator can't be disabled either. I've not managed to kill one yet though.  :)
.
Edited 2026-05-14 20:00 by Mixtel90
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Bryan1

Guru

Joined: 22/02/2006
Location: Australia
Posts: 2002
Posted: 10:11am 14 May 2026
Copy link to clipboard 
Print this post

OK been using list system I2C and it has been coming up blank yet when I removed the zero

> list system i2c
HEX  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: 50 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --


So powering up the zero from the 5V input may be the wrong way so how should I connect it as I do have the sample code from the manual on both the pico and the zero as a slave
Edited 2026-05-14 20:13 by Bryan1
 
Bryan1

Guru

Joined: 22/02/2006
Location: Australia
Posts: 2002
Posted: 11:01am 14 May 2026
Copy link to clipboard 
Print this post

Yes my expensive pink C cable that was only available when I was in MT Isa for a shutdown was available to charge my phone I did notice it was hot when I took it off the zero.

So I do need suggestions on how to power this zero as my setup just isn't working on my breadboard. Now all I'm trying to do is use the code in the pico manual and like always I'm finding the hardest part to do it.

That is why this forum is so great and being a member since '05 trying to learn has been the hard part.

Look once I can get this I2C working it may be time to having more fun as I did make a zero board to fit on the back of a camera detailed in the manual so I can use a 2040W to show a webpage of my water trough where I'm sure a we will see a few snakes taking a drink.

I do have a huge black snake on the property and finding his skin is a good 5 paces, now that was out the back of my farm then oneday when I was driving out I saw him again, his head popped up and he took off across the road which is 5 metres wide as I did measure it. Now it took like ages before the tail arrived so this snake is only getting bigger as the years go by.

Now when I go to my spring fed dam I always walk about a metre away from the reeds and I do hear rustling as the snakes are getting view to see if I'm a threat and to date they have seen I'm not a threat.

Now for you pommy blokes this snake is No.3 on the list the Australian black snake now like said on my spring fed dam one day I went to pump a IBC of water and found a black snake under a cow pat so put my Honda pump on the ground primed it and filled the IBC.

Went over the hill decanted the water using gravity and when I went back over that snake under the cow pat was gone and when I went to get out of cab a black snake did come at me so I just got back in the cab and let them settle then I saw the big snake do some justice to that young snake so I got out of the cab and filled my next IBC was uneventful.
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 3222
Posted: 01:11pm 14 May 2026
Copy link to clipboard 
Print this post

I can't get the example master / slave code from the manual to work either.
With the code on the slave running List System I2C does show the slave address but no data goes in either direction.
> list system i2c
HEX  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- 38 -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- 55 -- 57 -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
The slave is &H55, EEPROM &H57, RTC &H68, DHT10 &H38.
Perhaps using serial instead may work.
 
mozzie
Guru

Joined: 15/06/2020
Location: Australia
Posts: 330
Posted: 01:31pm 14 May 2026
Copy link to clipboard 
Print this post

G'day,
Bryan, if you want to use serial instead of I2C then that should be ok, I was only going to use the serial console if I went with the USB firmware to plug in a USB numeric keyboard to enter values, this is just another idea (one of many)

The rest of the surface grinder software should still be the same either way.

The whole E-Stop system is going to require some thought, I like your ideas using the PICO-ZERO as an option, however you will not be able to use the inbuilt homing system for the axis' without the limit inputs connected.

More thinking required.....

Also just thinking, I know if I plug 2 pico's of any type into my PC it'll only see the first one, might be why you are having trouble communicating with both.

Regards, Lyle.
Edited 2026-05-14 23:33 by mozzie
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 8842
Posted: 01:50pm 14 May 2026
Copy link to clipboard 
Print this post

When I'm messing with USB on things that don't isolate nicely I uses a USB isolator. Very useful thing to have in the toolkit! USB-A male on one end and female on the other. Just plug and play.

The 3V3 regulator doesn't *appear* to suffer if the 3V3 pin is used as an input. The output mosfet in the RT9013-33 doesn't have a parallel diode and is switched off if there is no input. That's how I sometimes power a Zero. The USB connection is effectively isolated. Powering the Zero via the programming cable will also power the Pico over the same connection, whether the 5V supply is present or not!

You could power the Pico at 5V and power the Zero at 3V3 from the 3V3 output of the Pico. You should be ok up to 100mA or so and the Zero won't take anything like that.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
mozzie
Guru

Joined: 15/06/2020
Location: Australia
Posts: 330
Posted: 03:07pm 14 May 2026
Copy link to clipboard 
Print this post

G'day,
Some testing has shown the example in the manual won't work, I2C write is no longer happy with a 1 length string, not sure how long that has been the case.

The modified example below has been tested on RP2350 V6.03.00rc7 (TX+RX) and works:

'prog to test I2C comms as MASTER

Option default integer
SetPin gp26,gp27,i2c2
I2C2 open 100,1000

For i = 65 To 90
 I2C2 write &h52,0,1,i
 Pause 500
 I2C2 read &h52,0,8,A$
 Print A$
 Pause 500
Next

End


'prog to test I2C comms as SLAVE

Option default integer
SetPin gp10,gp11,i2c2
I2C2 slave open &h52, iic_tint, iic_rint

Do :Pause 50:Loop Until Inkey$<>""

End

Sub iic_rint
 I2C2 slave read 10, r$, count
 Print Left$(r$, count), count
End Sub

Sub iic_tint
 T$=Time$
 I2C2 slave write Len(T$), T$
End Sub


Also works using I2C instead of I2C2, using 4K7 pullups on the bus in both instances.

List System I2C and I2C Check can often lock up the devices on the bus, pays to reset the whole system before proceeding.

Hope this helps  

Regards, Lyle.
Edited 2026-05-15 01:22 by mozzie
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 3222
Posted: 08:56am 15 May 2026
Copy link to clipboard 
Print this post

I2C master & slave testing.
The slave becoming unresponsive after using LIST SYSTEM I2C noted by Lyle appears to be due to the scanner only reading 1 byte.
The last test below, "Master requesting data from slave." shows that the master must only request the exact number of bytes that the slave has ready to send.
Requesting one more or less bytes than the slave data string results in the slave becoming unresponsive after that transaction.
The slave program has to be stopped with Ctrl-C then started again.
' I2C slave program
SetPin GP0, GP1, I2C
I2C SLAVE OPEN &H52, TXint, RXint

Do : Pause 5 : Loop Until Inkey$<>""

Sub RXint
 Local count, a$
 I2C SLAVE READ 10, a$, count
 Print Left$(a$, count), count
End Sub

Sub TXint
 Local a$ = DateTime$(now)
 I2C SLAVE WRITE Len(a$), a$
 Print "Slave sent = ";a$
End Sub

Print "End"

End


' Master sending data to the slave.
> For n=65 To 75 :A$=chr$(n)+chr$(n+1)+chr$(n+2)+chr$(n+3)+chr$(n+4)+chr$(n+5) :I2C write &H52,0,6,A$ :Print A$, len(A$) :pause 999 :Next
ABCDEF   6
BCDEFG   6
CDEFGH   6
DEFGHI   6
EFGHIJ   6
FGHIJK   6
GHIJKL   6
HIJKLM   6
IJKLMN   6
JKLMNO   6
KLMNOP   6
>

Data received by slave from master
ABCDEF   6
BCDEFG   6
CDEFGH   6
DEFGHI   6
EFGHIJ   6
FGHIJK   6
GHIJKL   6
HIJKLM   6
IJKLMN   6
JKLMNO   6
KLMNOP   6




' Master requesting data from slave.
> A$="":For n=0 To 25 :I2C read &H52,0,19,A$ :Print A$ :pause 999 :Next 'read 19 bytes, data sent = 19 bytes
15-05-2026 15:29:27  '19 bytes supplied by slave
15-05-2026 15:29:28
15-05-2026 15:29:29
15-05-2026 15:29:30
15-05-2026 15:29:31
15-05-2026 15:29:32
15-05-2026 15:29:33
15-05-2026 15:29:34
15-05-2026 15:29:35
>
> A$="":For n=0 To 25 :I2C read &H52,0,18,A$ :Print A$ :pause 999 :Next 'read 18 bytes, data sent = 19 bytes
15-05-2026 15:29:5  'correct, 18 bytes supplied by slave but slave was expecting to supply 19

'Slave frozen


> A$="":For n=0 To 25 :I2C read &H52,0,20,A$ :Print A$ :pause 999 :Next 'read 20 bytes, data sent = 19 bytes
15-05-2026 15:30:291  'correct, 20 bytes supplied by slave but slave was expecting to supply 19

'Slave frozen

>


Edit.
One line I2C scanner that can read more than 1 byte. Set "B=" to the number of bytes that the slave is expecting to send and it won't get stuck.
> B=19:A$="":For N=7 TO 119:I2C Read N,0,B,A$ :If MM.I2C=0 then :Print "I2C addr."N" = &H"+Hex$(n,2),"A$="A$:EndIf:Next'I2C Scanner
I2C addr. 82 = &H52     A$=15-05-2026 21:35:47
> B=19:A$="":For N=7 TO 119:I2C Read N,0,B,A$ :If MM.I2C=0 then :Print "I2C addr."N" = &H"+Hex$(n,2),"A$="A$:EndIf:Next'I2C Scanner
I2C addr. 82 = &H52     A$=15-05-2026 21:35:48
>

'I2C2 on the same pico
> B=19:For N=7 TO 119:A$="":I2C2 Read N,0,B,A$ :If MM.I2C=0 then :Print "I2C addr."N" = &H"+Hex$(n,2),"A$="A$:EndIf:Next'I2C2 Scanner
I2C addr. 56 = &H38     A$=Ê8E  v×××Ê8E vÚÚÚÊ8   'AHT10 data
I2C addr. 87 = &H57     A$=./0123456789:;<=>?@   'EEPROM contents
I2C addr. 104 = &H68    A$=¦!                      
                            À8!&                'RTC data
>

Edited 2026-05-15 21:50 by phil99
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 8842
Posted: 02:39pm 15 May 2026
Copy link to clipboard 
Print this post

That's always been the case when using I2C under MMBasic AFAIK. You need to send a message "This is how many bytes I'm going to send" then send a second message containing the bytes.

Incidentally, MMBasic won't use SPI slave mode as it always produces the clock. At least, it wouldn't for me.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Bryan1

Guru

Joined: 22/02/2006
Location: Australia
Posts: 2002
Posted: 12:49am 16 May 2026
Copy link to clipboard 
Print this post

Ok new day so let the fun start   I have been thinking about what went wrong the other night so just now fired up my laptop and got the zero connected in MCCC and the pico 2 connected on this computer in MCCC.

Now I'm going to hookup that 10K/4K7 voltage divider to GPIO26 on the zero so it can measure the 2.5 volts @8 volts and get it to report to the pico2 via I2C.

Regards Bryan
 
Bryan1

Guru

Joined: 22/02/2006
Location: Australia
Posts: 2002
Posted: 02:25am 16 May 2026
Copy link to clipboard 
Print this post

Well that is strange got the code in the zero measuring the battery and the lithuim battery charger going yet the print of the voltage is staying on 7.6197 where the voltage is 8.636 on my DMM.

DIM battery AS FLOAT

SETPIN GP26, AIN

DO

battery = battery + 2.309 'scaling for battery voltage
PRINT "Battery Voltage", battery

PAUSE 1000

LOOP


Well increased the scaling and now it's working and the only pins connected are the I2C and the ADC GP26 pin.

I have noticed the zero is getting warm running of the USB too.

On the pico 2 doing a list system I2C is coming up blank so the fun continues
Edited 2026-05-16 12:53 by Bryan1
 
     Page 11 of 15    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2026