Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 02:24 14 May 2025 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 : PicoMiteWeb firmware for the Pico W - now making real progress

     Page 5 of 8    
Author Message
pwillard
Guru

Joined: 07/06/2022
Location: United States
Posts: 307
Posted: 11:12am 11 Feb 2023
Copy link to clipboard 
Print this post

This is pretty consistent at boot time.
If I run my code, it is getting time... at boot time, not so much.  (Yes, I changed Firmware versions... after the first attempt)

Connected 192.168.1.224
Assigned Address: 192.168.1.224
ntp address 168.235.89.132
NTP FAILURE
PicoMiteWeb MMBasic Version 5.07.07a6
Copyright 2011-2023 Geoff Graham
Copyright 2016-2023 Peter Mather

Connecting to WiFi...
Connected 192.168.1.224
Assigned Address: 192.168.1.224
ntp address 168.235.89.132
NTP FAILURE
PicoMiteWeb MMBasic Version 5.07.07a8
Copyright 2011-2023 Geoff Graham
Copyright 2016-2023 Peter Mather

Connecting to WiFi...
Connected 192.168.1.224
Assigned Address: 192.168.1.224
ntp address 74.6.168.72
NTP FAILURE
> run
Assigned Address: 192.168.1.224
ntp address 74.6.168.72
got ntp response: 11/02/2023 06:10:14
Time is set to 06:10:14
PicoMiteWeb MMBasic Version 5.07.07a8
Copyright 2011-2023 Geoff Graham
Copyright 2016-2023 Peter Mather

Connecting to WiFi...
Connected 192.168.1.224
Assigned Address: 192.168.1.224
ntp address 74.6.168.72
NTP FAILURE
> run
Assigned Address: 192.168.1.224
ntp address 74.6.168.72
got ntp response: 11/02/2023 06:10:52
Time is set to 06:10:52
PicoMiteWeb MMBasic Version 5.07.07a8
Copyright 2011-2023 Geoff Graham
Copyright 2016-2023 Peter Mather

Connecting to WiFi...
Connected 192.168.1.224
Assigned Address: 192.168.1.224
ntp address 198.169.208.142
NTP FAILURE
>

Edited 2023-02-11 21:14 by pwillard
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10075
Posted: 11:34am 11 Feb 2023
Copy link to clipboard 
Print this post

Works perfectly for me with either mm.startup or option autorun
 
pwillard
Guru

Joined: 07/06/2022
Location: United States
Posts: 307
Posted: 12:41pm 11 Feb 2023
Copy link to clipboard 
Print this post

Yeah, I have no explanation for the NTP FAILURE at boot time.  I have a 120Mb/s Internet feed.  When the CODE runs though, I seem to get time consistently with 1-hour interval updates on NTP.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10075
Posted: 12:49pm 11 Feb 2023
Copy link to clipboard 
Print this post

What happens if you put a pause in before requesting the time?
 
pwillard
Guru

Joined: 07/06/2022
Location: United States
Posts: 307
Posted: 01:38pm 11 Feb 2023
Copy link to clipboard 
Print this post

Well...   You see... it is NOT failing anymore (with new firmware) when the program actually RUNS... it's failing to get a good NTP response when it boots on a power cycle *before* the code runs... so there is no option to insert a delay since NTP fails when the firmware is initially negotiating with the local LAN. So it shows up as a *problem* on the screen but ultimately works correctly on program execution.

So it's more a glitch that self-corrects versus being an actual showstopper problem.

The issue though is it seems to keep 'option autorun 1' from actually working... since if I enable it... it just hangs.  

Well, I don't mean *hangs* as much as just fails...

  Quote  Connecting to WiFi...
Connected 192.168.1.224
ntp address 162.159.200.123
[208] WEB NTP -5
Error : NTP timeout
>


using:

> option list
PicoMite MMBasic Version 5.07.07a8
OPTION SYSTEM SPI GP18,GP19,GP16
OPTION AUTORUN 1
OPTION COLOURCODE ON
OPTION WIFI fbi, guessit
OPTION SDCARD GP22


Note: Of course, that's not *my* SSID or PASSWORD

As for the code I'm running, I modified the old TM1637 LED display code to use NTP instead of RTC so it's just a *clock* using e 99% existing code.
Edited 2023-02-11 23:50 by pwillard
 
goc30

Guru

Joined: 12/04/2017
Location: France
Posts: 435
Posted: 05:58pm 11 Feb 2023
Copy link to clipboard 
Print this post

Someone tried to use picomiteweb with a Lcd panel (st7789 or ili9341)?.

At home, each time I declare the "LCDPANEL" option via terraterm, I receive a "time-out" message and nothing, keyboard blocked.
With "picomite" I have no pb with same options

OPTION CPUSPEED 48000
OPTION COLOURCODE ON
OPTION DISPLAY 49, 100
OPTION SYSTEM SPI GP18,GP19,GP4
OPTION SDCARD GP5
OPTION LCDPANEL ST7789_320, L,GP16,GP22,GP17,GP20
OPTION SYSTEM I2C GP0, GP1


I have to reload "clear flash" then picomiteweb. The problem exists whatever the version, whatever the SPI configuration, and either with the 2.0" display or with the waweshare restouch card
Edited 2023-02-12 04:04 by goc30
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10075
Posted: 06:45pm 11 Feb 2023
Copy link to clipboard 
Print this post

V5.07.07a10


PicoMiteWebV5.07.07a10.zip

Hopefully this improves stability some more. I found that the error callback does not exit nicely. This is called if the browser drops the connection mid transmission. I've worked round this by creating a longjmp from the error handler and this seems to solve the lockup problem based on limited testing. Jim: please see if this helps.

This version also keeps up-to-date with the main firmware

Wildcards for copy and kill
As in the files command * matches multiple characters and ? matches a single character.

COPY fname$ to dirname$ ' the bulk copy is triggered if fname$ contains one or more  '*' or a '?' characters
dirname$ must be a valid directory name and should NOT end in a slash character

KILL fname$ [,all] ' the bulk erase is triggered if fname$ contains one or more '*' or a '?' character
If the optional 'all' parameter is used then you will be prompted for a single confirmation
If 'all' is not specified you will be prompted on a file-by-file basis


  Quote  At home, each time I declare the "LCDPANEL" option via terraterm, I receive a "time-out" message and nothing, keyboard blocked.
With "picomite" I have no pb with same options


  Quote  OPTION CPUSPEED 48000


You are running the CPU too slowly. I'll block below 133MHz for the web version
Edited 2023-02-12 04:55 by matherp
 
goc30

Guru

Joined: 12/04/2017
Location: France
Posts: 435
Posted: 08:11pm 11 Feb 2023
Copy link to clipboard 
Print this post

OPTION CPUSPEED 48000



no, the first thing i avoided was to change the speed of the cpu, because i know it can influence the operation of the card. the example quoted is just for info as a basic model
My configuration is minimal, SPI bus, LcdPanel, I2c, and nothing else concerning the hardware, and the problem comes just after the "System", SPI, I2C and LCDPANEL options (which causes the crash)

I can't even take a screenshot since everything is planted
Edited 2023-02-12 06:13 by goc30
 
homa

Guru

Joined: 05/11/2021
Location: Germany
Posts: 459
Posted: 08:16pm 11 Feb 2023
Copy link to clipboard 
Print this post

News flash: https://github.com/raspberrypi/pico-examples#pico-w-bluetooth

@peter: how bad does the weather in england have to get?  
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6223
Posted: 08:31pm 11 Feb 2023
Copy link to clipboard 
Print this post

Two problems before I try to do anything nasty to it.
String is      GET / HTTP
sending page
page sent
*Error: Invalid address - resetting
Port: COM12 removed

Disconnected
Port: COM12 inserted

Connected to COM12 at 115200
[CYW43] do_ioctl(2, 263, 1008): timeout
PicoMiteWeb MMBasic Version 5.07.07a10
Copyright 2011-2023 Geoff Graham
Copyright 2016-2023 Peter Mather


also, when doing the substitution in the html, floats and integers are OK but strings end up as ""

html
<html>
<head>
<title>Stowport Test</title>
<meta http-equiv="Refresh" content="15">
</head>
<body>
<h1 align="center">{mystring$}</h1>
<p align="center">Temperature is {mytemp}</p>
<p align="center">Humidity is {myhumid}</p>
<p align="center">Reading taken at {mytime$}</p>
</body>
</html>


bas
 DIM buff%(512)
 DIM mystring$="PicoMite Web Test"
 DIM FLOAT mytemp, myhumid, oldtemp, oldhumid
 DIM mytime$
 DIM k
 TIMER = 3000
 DATE$ = "01-04-2000"
 ON ERROR SKIP
 WEB ntp 11
 IF DATE$ = "01-04-2000" THEN PRINT "OOPS!"
 PRINT DATE$
 WEB tcp INTERRUPT poll
 DO
   poll
   IF TIMER > 3000 THEN doread
 LOOP
'
SUB poll
 LOCAL p%, t%
 FOR a%=1 TO MM.INFO(MAX connections)-1
   LONGSTRING CLEAR buff%()
   WEB tcp READ a%,buff%()
   p%=LINSTR(buff%(),"GET")
   t%=LINSTR(buff%(),"HTTP")
   IF LLEN(buff%()) THEN PRINT "_data_"
   s$=""
   IF (p%<>0) AND  (t%<>0) AND (t%>p%) THEN
   IF k = 0 THEN LONGSTRING PRINT buff%() : k = 1
     s$=LGETSTR$(buff%(),p%,t%-p%+4)
     PRINT "String is ",s$
   ENDIF
   IF INSTR(s$,"small") THEN
     PRINT "sending picture"
     WEB Transmit FILE a%,"small.jpg","image/jpeg"
   ELSEIF INSTR(s$,"favicon") THEN
     PRINT "sending icon"
     WEB Transmit FILE a%,"favicon.ico","image/vnd.microsoft.icon"
   ELSEIF INSTR(s$,"HTTP") THEN
     PRINT "sending page"
     WEB transmit PAGE a%,"st_test.html"
     PRINT "page sent"
   ENDIF
 NEXT a%
END SUB
 
SUB doread
 BITBANG HUMID GP17, mytemp, myhumid
 IF mytemp > 999 THEN
   mytemp = oldtemp
   myhumid = oldhumid
   PRINT "!";
   badrdg = badrdg + 1
 ELSE
   oldtemp = mytemp
   oldhumid = myhumid
   PRINT "*";
 ENDIF
 allrdg = allrdg + 1
 mytime$ = TIME$+"  "+DATE$+"   "+STR$(badrdg)+"/"+STR$(allrdg)
 TIMER = 0
END SUB


Jim
VK7JH
MMedit
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10075
Posted: 10:39pm 11 Feb 2023
Copy link to clipboard 
Print this post

Jim

This version gives me no problems anything like that. Try clearing flash and re-install.

Please try using my pro-forma on page 3 of this thread. You cannot poll with this version but must test for the interrupt flag as in the example


PicoMiteWebV5.07.07a10.zip
Edited 2023-02-12 09:01 by matherp
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1965
Posted: 11:42pm 11 Feb 2023
Copy link to clipboard 
Print this post

I have the same problem TheMonkeys was having I tried to load alpha7 and all I get is a very brief flash of the LED then nothing, the same happens with alpha10.
Alpha6 loads and runs perfectly everytime.
Edited 2023-02-12 09:42 by palcal
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6223
Posted: 01:49am 12 Feb 2023
Copy link to clipboard 
Print this post

@palcal,
You may have to clear the flash before loading alpha10.

Warning. Clear_flash.uf2 will delete all your files in the flash drive as well as any programs in flash slots so make sure you have a backup.

Even with that, it might take a few resets to get it going.

Jim
VK7JH
MMedit
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 971
Posted: 02:24am 12 Feb 2023
Copy link to clipboard 
Print this post

Not sure if this will provide any clues. I don't have a reset button wired, so just  power on/off to reset. Since a8 version I can only get it to communicate if directly connected via TerraTerm. If connected via MMCC or GFXTerm it wont respond on the console. Once working with TerraTerm directly conected to the port, you can disconnect and use the other terminals OK.

I did manage to capture this while connected via a different terminal(MicroMite Console by SAGT3K), it may give a clue. It gave response below when connected but would not respond to console.


[CYW43] do_ioctl(2, 263, 1008): timeout                                        
PicoMiteWeb MMBasic Version 5.07.07a10                                          
Copyright 2011-2023 Geoff Graham                                                
Copyright 2016-2023 Peter Mather                                                
                                                                               
>
Latest F4 Latest H7 FotS
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6223
Posted: 02:51am 12 Feb 2023
Copy link to clipboard 
Print this post

  disco4now said  
[CYW43] do_ioctl(2, 263, 1008): timeout                                        
PicoMiteWeb MMBasic Version 5.07.07a10                                          
Copyright 2011-2023 Geoff Graham                                                
Copyright 2016-2023 Peter Mather                                                
                                                                               
>

If that happens, you just have to keep trying. It sometimes takes 3 attempts for a reset and I often loose the program.
I am cheating and using a version of MMEdit that does auto-reconnect, like teraterm.
It is not ready for release yet...

Another clue for more stabilaty.
put Dim buff%(512) after you dim everything else. I was getting my strings stomped on and that move fixed it.
Next trick.
After Dim buff%(512), add a dummy Dim buff2%(512) to act as an overflow catcher. That lets things run longer.

I will put this and more in a post later when I make a bit more sense of it.

MMedit5.zip
The W64 exe files with auto-reconnect.

Jim
VK7JH
MMedit
 
palcal

Guru

Joined: 12/10/2011
Location: Australia
Posts: 1965
Posted: 03:28am 12 Feb 2023
Copy link to clipboard 
Print this post

Thanks Jim, got it loaded and running again.
"It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all"
 
goc30

Guru

Joined: 12/04/2017
Location: France
Posts: 435
Posted: 04:11am 12 Feb 2023
Copy link to clipboard 
Print this post

  matherp said  V5.07.07a10



  Quote  At home, each time I declare the "LCDPANEL" option via terraterm, I receive a "time-out" message and nothing, keyboard blocked.
With "picomite" I have no pb with same options


  Quote  OPTION CPUSPEED 48000


You are running the CPU too slowly. I'll block below 133MHz for the web version


this is a screen capture of option setting



after "option lcdpanel", I receive an error msg, and it all folk!! nothing, nada, plus rien!
Edited 2023-02-12 14:14 by goc30
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3319
Posted: 04:28am 12 Feb 2023
Copy link to clipboard 
Print this post

I added 2 DS18B20 sensors, a 6-led module for the outputs, and a 4-button module for the inputs (SETPIN with DIN,PULLUP)--all with flying leads. Here is my hookup diagram:

V2.1 40-pin Picomite Pico_W controller

                             1 |             | 40 5V
                             2 |             | 39 5V
                         0V  3 |             | 38 0V
                             4 |             | 37
                             5 |             | 36 3V3
                             6 |  Picomite   | 35
                             7 |    I/O      | 34 Heater
                         0V  8 |             | 33 0V
                             9 |             | 32 Inside Temp/Humidity
                            10 |             | 31 Fan IN
                            11 |             | 30 [RUN]
                            12 |             | 29 Outside Temp/Humidity
                         0V 13 |             | 28 0V
                            14 |             | 27 Fan Out
                    pLights 15 |             | 26 Mister  
                      pDoor 16 |             | 25 Louver Vent
                    pMotion 17 |             | 24 Circulator
                         0V 18 |             | 23 0V
             Battery ON/OFF 19 |             | 22 Circulator InTemp
                     pMains 20 |             | 21 Circulator OutTemp

If I depress the button for pin 20 (mains detected), check 3 of the boxes for outputs, before I click [Simulate] I get:



If I click "Manual", then release the button, put a value of "78" in for "Outside Humidity", and click [Simulate], I get this, with the MAINS box going from RED to GREEN:



All looking good for me so far. I have to add the input for the door and the output for lights to the HTML template file.

(Note the sensor for the battery will be for a 12V solar-charged battery--the PicoMiteWeb will have its own separate battery.)
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6223
Posted: 04:51am 12 Feb 2023
Copy link to clipboard 
Print this post

  goc30 said  
after "option lcdpanel", I receive an error msg, and it all folk!! nothing, nada, plus rien!

When you see " [CYW43] do_ioctl(2, 263, 1008): timeout  ", it is the error message from when the web server stopped.
You need to reset or power cycle the picomite, possibly a few times to get it back working.

Jim
VK7JH
MMedit
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6223
Posted: 06:05am 12 Feb 2023
Copy link to clipboard 
Print this post

Hi Peter,
I hope this makes some sense to you.

First.
You were right, I was polling the SUB. I knew I shouldn't but forgot to remove the call from the main loop.

I solved the problem of the disappearing strings.
I had buff%() declared before the strings.
By moving that line to after the strings, all was well again.

A dummy array immediately after the buff%() array did the same and I have found that the first 1536 bytes of that dummy array get zeroed when the webint sub gets called.
That is what was stomping on my strings.

Before the dummy array trick, I was needing 3 or 4 attempts to get the server to accept my request and once going, it would crash after 7 or 8 requests.
With the dummy array, I can reliably start on the first request and last a long time. Not sure how long yet.

This works
 DIM mystring$="PicoMite Web Test"
 DIM FLOAT mytemp, myhumid, oldtemp, oldhumid
 DIM mytime$
 DIM INTEGER allrdg, badrdg, k, nn, buffadr
 DIM buff%(512)
 DIM buff2%(512)


This fails
 DIM buff%(512)
 DIM mystring$="PicoMite Web Test"
 DIM FLOAT mytemp, myhumid, oldtemp, oldhumid
 DIM mytime$
 DIM INTEGER allrdg, badrdg, k, nn, buffadr


Jim
VK7JH
MMedit
 
     Page 5 of 8    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025