Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 19:42 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 : Q: Possibility of WaveShare Pico-Eval-Board running MMBasic

Author Message
andrewq
Newbie

Joined: 18/10/2022
Location: Australia
Posts: 7
Posted: 03:33am 19 Oct 2022
Copy link to clipboard 
Print this post

Hello, very new guy here.  

I have very recently followed the development of the Micromite through to the most recent Picomite VGA reading up 2 years worth of backissue of Silicon Chip magazine. I have scrounged everything I can possibly find on the Web on this device and am quite excited. And hence, here I am :-)  

In the March 2022 issue, it describes a Raspberry Pico 3.5 LCD touchscreen Backpack that includes running an MMBasic demo. Ref Link

It seems WaveShare has a Pico-Eval-Board (SKU: 20159) with a (somewhat) similar 3.5 LCD (LI9488/XPT2046).Product Link

My question: Can MMBasic as demonstrated on the RPico Backpack (Silicon Chip, March 2022) also work on the Waveshare Pico-Eval-Board with no or little modification?

Many thanks.
Edited 2022-10-19 13:36 by andrewq
 
panky

Guru

Joined: 02/10/2012
Location: Australia
Posts: 1101
Posted: 04:35am 19 Oct 2022
Copy link to clipboard 
Print this post

  andrewq said  Hello, very new guy here.  

It seems WaveShare has a Pico-Eval-Board (SKU: 20159) with a (somewhat) similar 3.5 LCD (LI9488/XPT2046).Product Link

My question: Can MMBasic as demonstrated on the RPico Backpack (Silicon Chip, March 2022) also work on the Waveshare Pico-Eval-Board with no or little modification?

Many thanks.

Andrew, MMBasic (the core interpreter) should run with a standard Paspberry Pi Pico RP2040 module plugged in, however the LCD, RTC, SD card etc. are on different pins than that of the Silicon Chip Backpack.
You should sit down with the PicoMite User Manual (see https://www.geoffg.net/picomite.html ) and compare with the schematic and pinout of the Waveshare board. The PicoMite can have pins defined to different functions so you would need to carefully look at the PicoMite User Manual to see how to define the different configurations to match the Waveshare hardware.

It may not be possible to fully utilise all the features of the Waveshare board but at least LCD and Touch should be 'do-able' - no guarantees as I do not have a Waveshare board to test.
Doug.

PS. Welcome to the forum.
... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it!
 
circuit
Senior Member

Joined: 10/01/2016
Location: United Kingdom
Posts: 245
Posted: 05:42am 19 Oct 2022
Copy link to clipboard 
Print this post

This board; https://www.waveshare.com/pico-restouch-lcd-3.5.htm, works very well with Micromite.  I have three working, touch, SD-card and screen all functioning.  I imagine the board that you propose will also work; it seems simply to have a few more added devices.  

The board that I have linked to has appeared in a few posts on this forum.
 
darthvader
Regular Member

Joined: 31/01/2020
Location: France
Posts: 76
Posted: 06:05am 19 Oct 2022
Copy link to clipboard 
Print this post

  Quote  It seems WaveShare has a Pico-Eval-Board (SKU: 20159) with a (somewhat) similar 3.5 LCD (LI9488/XPT2046).Product Link


I use this one , just use this options after you burn the firmware :


OPTION RESET
OPTION SYSTEM SPI GP10,GP11,GP12
OPTION SDCARD GP22, GP5, GP18, GP19
OPTION LCDPANEL ILI9488W, LANDSCAPE,GP8,GP15,GP9,GP13
OPTION TOUCH GP16,GP17
GUI CALIBRATE 0, 3946, 211, -1287, 853


Cheers.
Theory is when we know everything but nothing work ...
Practice is when everything work but no one know why ;)
 
andrewq
Newbie

Joined: 18/10/2022
Location: Australia
Posts: 7
Posted: 05:32am 21 Oct 2022
Copy link to clipboard 
Print this post

Thank you all for the suggestions. I will definitely try out the pins and reading up a bit more.  There is so much to catch up on. I am more a software guy, than hardware. The last project I did (i.e. realtime clock, assembly language reading via RS232, Intel386), was in the 1990s. Hard to believe how far we have come.

I have only took notice of the CMM2 after reading a stack of Silicon Chip borrowed from the lib a week ago. I guess I have been missing out.

Anyway, I went ahead and placed the order for a Picomite VGA kit, an LCDbackpack picomite kit, a CMM2 kit and a Waveshare LCD backpack. I got the kits from Silicon Chip site. Also, placed an order for the COREH7421 direct from Waveshare.  This is about 3x the cost before the chip shortage, but still do-able without the wife protesting. I will be headed to Jaycar next to get a good SMD soldering kit and accessories.  My greatest concern, unbelievably, is not being able to put the kit together due to bad eyesight and shaky hands.

I will report back once I get going with the kits.  I will definitely have more questions, and hopefully something useful to share in return.
Edited 2022-10-21 15:33 by andrewq
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 07:16am 21 Oct 2022
Copy link to clipboard 
Print this post

It sounds like you'll be having fun...  

The CMM2 has been like rocking horse poo for some time now. The silicon got swapped for unobtainium. :(

The PicoMite VGA is highly recommended though, if not as powerful.

I'd recommend that you get one of the little cheap SMD soldering practice kits from ebay or AliExpress. They are very good for testing your skills and giving you some practice before putting "real" components at risk.

Welcome to the forum!  :)
Mick

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

Guru

Joined: 31/03/2022
Location: United States
Posts: 463
Posted: 01:00am 22 Oct 2022
Copy link to clipboard 
Print this post

I really Love mine, for the $-Easy Ratio you just can't beat it but one thing I did when I put pins on the Pico that goes in the waveshare if you look I only put the used pins pins pointing down in to the LCD and the unused pins Pins pointing up, it's easiest to do this if you use a breadboard as a jig when soldering the pins in place



 

I may be Vulgar, but , while I'm poor, I'm Industrious, Honest,  and trustworthy! I Know my Place
 
NPHighview

Senior Member

Joined: 02/09/2020
Location: United States
Posts: 200
Posted: 10:58pm 13 May 2023
Copy link to clipboard 
Print this post

Andrew - I've been playing with the WaveShare Pico-Eval-Board quite a bit recently, using a PicoW and the spectacular new firmware. Here is an analog clock program that uses NTP to get the time (correct it for your timezone), uses the on-board speaker to "tick" every second, automatically dims or brightens the display with ambient light, and shows a random color on the built-in NeoPixel every second. Enjoy!

Rem Analog LCD Clock using  WaveShare 3.5" Pico-Eval-Board ("P-E-B")
Rem May 12, 2023  S.F. Johnson
Rem Uses features of the Waveshare P-E-B including
Rem    Display Brightness based on LDR Light Dependent Resistor on GP26
Rem    Tick sound using On-board Speaker. . . . . . . . . . . . on GP14
Rem    Color-changing LED using On-board NeoPixel . . . . . . . on GP4
Rem Depends on LCD in "Rotated" Portrait mode:
Rem    OPTION LCDPANEL ILI9488W, RPORTRAIT,GP8,GP15,GP9,GP13
Rem Depends on being initialized with the local WiFi, or Date$ and Time$
Rem being set manually (which will not survive a reset cycle)

Const Bright% = &H0F        ' Control the brightness of the NeoPixel

Const Back   = RGB(BLACK)   ' Color of Background
Const Fore   = RGB(WHITE)   ' Color of Foreground / Tic Marks
Const Textc  = RGB(LightGray) ' Color of text on LCD display
Const HCtr   = MM.HRes/2    ' Horizontal center of LCD display & clock
Const VCtr   = MM.VRes/2    ' Vertical center of LCD display and clock
Const x      = HCtr         ' Shorthand for horizontal center
Const y      = VCtr         ' Shorthand for vertical center

Const Smajor = 3            ' Width of Seconds divisible by 5
Const Sminor = 3            ' Width of Seconds not divisible by 5
Const Smajc  = Fore         ' Color of Major tic marks
Const Sminc  = Back         ' Color of Minor tic marks
Const Souter = Int(Min(x-1, y-1)) ' Outer Dia. of Clock Face
Const Sc     = RGB(RED)     ' Color of Second Hand
Const Sinner = Souter-28     ' Inner Dia. of Tics divisible by 5
Const Smid   = Souter-14     ' Inner Dia. of Tics not divisible by 5

Const Mw     = 3            ' Width of Minute Hand
Const Mc     = RGB(CYAN)    ' Color of Minute Hand
Const Minner = 0            ' Inner Dia. of Minute Hand
Const Mouter = Sinner-5     ' Outer Dia. of Minute Hand

Const Hw     = 5            ' Width of Hour Hand
Const Hc     = RGB(CYAN)    ' Color of Hour Hand
Const Hinner = 0            ' Inner DIa. of Hour Hand
Const Houter = Mouter-40    ' Outer Dia. of Hour Hand

Option BASE 0

Colour Back, Fore           ' Set default colors
Font 1, 3                   ' Set default font

Dim C% As INTEGER           ' Create value for NeoPixel

SetPin GP4,  DOUT           ' NeoPixel connected to GPIO 4 - bitbang it
SetPin GP14, DOUT           ' Beeper / Buzzer connected to GP14. PWM it
SetPin GP26, AIN            ' Light-Dependent Resistor (LDR) on GP26

On Error Skip
WEB ntp -7                  ' Pick up time for Pacific time - change for locale

CLS Back                    ' Clear the LCD screen

Hrs$ = Mid$(Time$,1,2) : Min$ = Mid$(Time$,4,2) : Sec$ = Mid$(Time$,7,2)
OldHrs$  = Hrs$ : OldMin$  = Min$ : OldSec$  = Sec$

DrawClockFace : UpdateHands : UpdateText

Backlight 50

SYNC 1000000

Do
 SYNC
 Hrs$ = Mid$(Time$,1,2) : Min$ = Mid$(Time$,4,2) : Sec$ = Mid$(Time$,7,2)
 UpdateClick : UpdateSecond : UpdateLDR
 If OldMin$ <> Min$ Then UpdateText : UpdateHands
 If OldHour$ <> Hrs$ Then
   On Error Skip
   WEB ntp -7        ' Re-synch every hour
 End If
 OldHour$ = Hrs$ : OldMin$ = Min$ : OldSec$ = Sec$
Loop

CLS
Option HEARTBEAT ON

Sub UpdateText
 Local String DateString$
 H12 = Val(Hrs$) Mod 12 : H24 = Val(Hrs$)  ' Prep for AM/PM test
 If H12=H24 Then
   Text x, 20, "  "+ Str$(H12) +":"+Mid$(Time$,4,2)+" AM  ", "CM", 3, 1, Textc, Back
 Else
   Text x, 20, "  "+ Str$(H12) +":"+Mid$(Time$,4,2)+" PM  ", "CM", 3, 1, Textc, Back
 EndIf
 DateString$ = " "+Day$(NOW)+" "+Right$(Date$,4)+"-"+Mid$(Date$,4,2)+"-"+Left$(Date$,2) + " "
 Text x, MM.VRes-20, DateString$, "CM", 3, 1, Textc, Back
End Sub

Sub UpdateLDR ' ambient light detector
 Local Float LDRVal
 Local Integer BLight
 Local String LDRStr$, BRTStr$
 LDRVal = Pin(GP26)
 BLight = Int(Min(50+15*LDRVal, 100))
 Backlight BLight
End Sub

Sub UpdateHands ' Adjust position for hours, minutes
 Circle x, y, Mouter+1, 1, 1, Back, Back ' Clear the inner face

 H = 30*(Val(Hrs$) Mod 12) + Val(Min$)/2 ' Hour hand interpolates
 a1 = H - Hw : a2 = H + Hw
 Arc x, y, Hinner, Houter, a1, a2, Hc

 M = Int(MinsToDeg(Val(Min$)))           ' Minute hand doesn't interpolate
 a1 = M - Mw : a2 = M + Mw
 Arc x, y, Minner, Mouter, a1, a2, Mc

 Circle x, y, 4, ,,HC, HC                ' Dot at the center
End Sub

Sub UpdateClick
 C%=RGB(Int(Bright%*Rnd),Int(Bright%*Rnd),Int(Bright%*Rnd))
 Bitbang ws2812 o, GP4, 1, C% ' Set the NeoPixel to a random color
 Pin(GP14) = 1 - Pin(GP14)    ' Toggle the buzzer to make a "Tick" sound
End Sub

Sub UpdateSecond
 ' Erase old second position
 S = Int(SecsToDeg(Val(OldSec$)))
 If S Mod 30 = 0 Then
   a1 = S-Smajor : a2 = S+Smajor
   If S = 0 Then
     Arc x, y, Sinner, Souter, a1, a2, RGB(Yellow)
   Else
     Arc x, y, Sinner, Souter, a1, a2, Smajc
   EndIf
 Else
   a1 = S-Sminor : a2 = S+Sminor
   Arc x, y, Smid, Souter, a1, a2, Sminc
 EndIf

 ' Draw new second position
 S = Int(SecsToDeg(Val(Sec$)))
 If S Mod 30 = 0 Then
   a1 = S - Smajor : a2 = S + Smajor
   If S = 0 Then
     Arc x, y, Sinner, Souter, a1, a2, RGB(Yellow)
   Else
     Arc x, y, Sinner, Souter, a1, a2, Smajc
   EndIf
   Arc x, y, Sinner, Souter, a1, a2, Sc
 Else
   a1 = S - Sminor : a2 = S + Sminor
   Arc x, y, Smid, Souter, a1, a2, Sc
 EndIf
End Sub

Function HrsToDeg(hrs%) As Float
 HrsToDeg = 30*(hrs% Mod 12)
End Function

Function MinsToDeg(mins%) As Float
 MinsToDeg = 6*mins%
End Function

Function SecsToDeg(secs%) As Float
 SecsToDeg = 6*secs%
End Function

Sub DrawClockFace
 For m = 0 To 354 Step 6   ' 360 degrees / 60 minutes >= 6
   If m Mod 30 = 0 Then    ' Major tic mark
     a1 = m - Smajor : a2 = m + Smajor
     If m = 0 Then
       Arc x, y, Sinner, Souter, a1, a2, RGB(Yellow)
     Else
       Arc x, y, Sinner, Souter, a1, a2, Smajc
     EndIf
   Else                    ' Minor tic mark
     a1 = m - Sminor : a2 = m + Sminor
     Arc x, y, Smid, Souter, a1, a2, Sminc
   EndIf
 Next m
End Sub

Edited 2023-05-14 09:35 by NPHighview
Live in the Future. It's Just Starting Now!
 
NPHighview

Senior Member

Joined: 02/09/2020
Location: United States
Posts: 200
Posted: 11:46pm 15 May 2023
Copy link to clipboard 
Print this post

Hmmm - an interesting difference between the Pico and PicoW firmware, or my initialization for the WaveShare Pico-Eval-Board (P-E-B). Any thoughts?

I have a Pico and a PicoW, and have two of the P-E-Bs.
* The Pico will initialize, calibrate, and use the WaveShare touch capabilities just fine on both P-E-B assemblies.
* The PicoW, though it uses most of the other peripherals just fine, fails to initialize the touch circuitry correctly on both. When I run GUI TEST TOUCH, the LCD display goes white, targets are *not* displayed, and it doesn't respond to me touching the screen. I have to exit the test with a Ctrl-C, which returns control to the terminal session, but does not clear the screen. Subsequent program execution (of the clock code, above) runs normally, not requiring a restart.

Here is my OPTION LIST for the Pico (which works with the P-E-B touch, in either Portrait or Landscape mode):
OPTION SYSTEM SPI GP10,GP11,GP12
OPTION COLOURCODE ON
OPTION POWER PWM ON
OPTION CPUSPEED (KHz) 200000
OPTION LCDPANEL ILI9488W, RLANDSCAPE,GP8,GP15,GP9,GP13
OPTION GUI CONTROLS 26
OPTION TOUCH GP16,GP17
GUI CALIBRATE 0, 237, 3908, 1259, -865
OPTION SDCARD GP22, GP5, GP18, GP19


Here is my OPTION LIST for the PicoW (which doesn't work in either Portrait or Landscape):
[OPTION SYSTEM SPI GP10,GP11,GP12
OPTION COLOURCODE ON
OPTION POWER PWM ON
OPTION AUTORUN 4
OPTION HEARTBEAT OFF
OPTION CPUSPEED (KHz) 200000
OPTION LCDPANEL ILI9488W, RPORTRAIT,GP8,GP15,GP9,GP13
OPTION DISPLAY 50, 132
OPTION WIFI MelodyGarden, ********
OPTION TOUCH GP16,GP17
GUI CALIBRATE 0, 3946, 211, -1287, 853
OPTION SDCARD GP22, GP5, GP18, GP19

and other info about the PicoW:
Program:
  6K ( 6%) Program (187 lines)
 74K (94%) Free

Saved Variables:
 16K (100%) Free

RAM:
  6K ( 5%) 51 Variables
  0K ( 0%) General
100K (95%) Free


I found this when trying to enhance my analog clock program, above.
Edited 2023-05-16 09:46 by NPHighview
Live in the Future. It's Just Starting Now!
 
NPHighview

Senior Member

Joined: 02/09/2020
Location: United States
Posts: 200
Posted: 09:46pm 16 May 2023
Copy link to clipboard 
Print this post

Some new information:

Just for the heck of it, on the PicoW, I tried swapping the Chip Select and IRQ line declarations in the OPTION TOUCH command (i.e. OPTION TOUCH GP17, GP16) instead of the way that it looks like it should be from the schematic on the WaveShare site (i.e. OPTION TOUCH GP16, GP17, which works on the Pico).

Running GUI TEST TOUCH command results in a Error: Touch not calibrated error message. This time, when I do a GUI CALIBRATE command, the LCD goes black, the first target is displayed in the upper left corner, and the text "Touch Target and Hold" is displayed. However, touching does nothing.
I can terminate the calibration process with a Ctrl-C keypress.

As I mentioned above, all works well with the non-W Pico.
Live in the Future. It's Just Starting Now!
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9129
Posted: 08:16am 17 May 2023
Copy link to clipboard 
Print this post

Out of interest please try this


WebMite.zip
 
NPHighview

Senior Member

Joined: 02/09/2020
Location: United States
Posts: 200
Posted: 04:53pm 17 May 2023
Copy link to clipboard 
Print this post

Thank you, Peter -

Progress.

The new firmware installed painlessly (i.e. didn't erase settings or flash - nice!). I swapped TP-IRQ and TP-CS back ("OPTION TOUCH GP16,GP17"), then ran GUI CALIBRATE. This time, all four targets appeared in succession, and I got the response:

 Done. No errors
 Deviation X = 2, Y = -5 (pixels)

Running GUI TEST TOUCH, however, shows a white screen, no response to touch, but terminated without complaint when I pressed the spacebar on the keyboard.

Despite this, touch works just fine in simple code:
CLS
Do
 If Touch(x)<>-1 Then Pixel Touch(x),Touch(y),RGB(255*Rnd,255*Rnd,255*Rnd)
Loop


If you don't already have one, I'd be honored if I could purchase a WaveShare P-E-B for you.
Live in the Future. It's Just Starting Now!
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9129
Posted: 05:11pm 17 May 2023
Copy link to clipboard 
Print this post

One more try - don't understand why the Pico-W is so sensitive on that particular board - power supply or something?


WebMiteV5.07.07.zip
Edited 2023-05-18 03:12 by matherp
 
NPHighview

Senior Member

Joined: 02/09/2020
Location: United States
Posts: 200
Posted: 05:24pm 17 May 2023
Copy link to clipboard 
Print this post

No joy - same behavior as above.  

That would be my guess, too. I'll get my DVM and report VBUS and VSYS voltages after doing a round of errands.

Thank you!

- Steve
Live in the Future. It's Just Starting Now!
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6798
Posted: 05:28pm 17 May 2023
Copy link to clipboard 
Print this post

Ah, it's one of those systems that uses shift registers to simulate SPI with a parallel display, isn't it? Nasty. Looks like a standard Touch chip though.
Mick

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

Senior Member

Joined: 02/09/2020
Location: United States
Posts: 200
Posted: 09:03pm 17 May 2023
Copy link to clipboard 
Print this post

OK - I've had a chance to measure voltages under various conditions with Peter's 2023-05-18 03:12 interim software on the PicoW; I don't see anything obvious, except that my Analog Clock program is a heavy load.



I've ordered another PicoW to see if it behaves the same.

- Steve
Live in the Future. It's Just Starting Now!
 
NPHighview

Senior Member

Joined: 02/09/2020
Location: United States
Posts: 200
Posted: 06:04pm 19 May 2023
Copy link to clipboard 
Print this post

Peter -

Thanks for the test software iteration. I dug up my USB tester accessory, and re-compared the PicoW (with 2023-05-17 test firmware) and Pico (with 5.07.07 release firmware). Current draw is consistently higher on the PicoW (the WiFi chip, I'm sure), but still well within the 2A limit for pin 36.  I've ordered another PicoW to see how it performs. The huge current draw from earlier was caused by me toggling GP14 once every second, which left the NPN transistor drawing current through the buzzer with no current limiting resistor. I've changed that to only pulse it for a fraction of a second, enough to hear, but not enough to strain it as much as before.





Live in the Future. It's Just Starting Now!
 
Print this page


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

© JAQ Software 2024