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: Pico Multiprocessor
Page 1 of 2 | |||||
Author | Message | ||||
andreas Senior Member Joined: 07/12/2020 Location: GermanyPosts: 207 |
I have a dream. Two (or more?) picos cooperating, each one contributing its special features. For example use pico-1 (RP2040-LCD) as display and use pico-2 (pico w) as interface to the world. This way pico-2 could use its excellent internet capabilities to get information i.e. extract news from a website, which could be displayed by pico-1. Question: What would be the best method to interconnect the two picos using PicoMite/WebMite ? -andreas |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6798 |
I did a PCB some time ago that takes a PicoMite and a PicoMite VGA (The PicoMite Pear). I allowed the user to link them using COM, I2C or SPI or anything similar that can be fitted into 4 IO pins IIRC. :). Of course, you can leave off the VGA and mess with the IO pins to your heart's content... COM ports have a big advantage in that there is a receive buffer so the receiving device doesn't have to continually scan for new incoming data. SPI has the advantage of speed, especially if you want to swap data quickly but it can be fiddly unless you are using fixed length messages. I2C has the advantage of very simple multi-processor communication. Parallel bus can be extremely fast at the expense of IO pins. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3150 |
Here's an example of controlling a picomite over serial I used several methods, either controlling over serial from MMB4W (MMBasic for DOS would also work) or from another picomite. With one method, the picomite being controlled has no user code at all--just MMBasic set up for serial console. Then the controlling program sends MMBasic code to the other picomite just like a user typing commands at the ">" prompt. That means that your program has to parse what is returned to determine what has happened. This was before LIBRARY was implemented in a flash slot, but I think you could put routines in the controlled picomite and execute them. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9308 |
TOTALLY agree. I LOVE the buffered COM ports in MMBASIC. They are PERFECT for use as an automatic background message queueing concept, then all you have to do, is check in your main loop if there is anything in the buffer, and read it out and act on it. This allows messages to be stored in the background, if the main loop is busy with something else, but still NOT LOSE any message while the loop is busy in the background. When the main loop is finished, it starts going through the loop again, and....Oh look! Something to process! It does very much depend on what you are trying to do, and in your case, I think just about any of the protocols would work for you as each PM is dedicated to its own tasks. But my most loved protocol is the buffered COM ports. Smoke makes things work. When the smoke gets out, it stops! |
||||
andreas Senior Member Joined: 07/12/2020 Location: GermanyPosts: 207 |
Hallo all, thank you very much for your analysis - it seems to be that COM ports have advantages. So I will dig into that today and play with communication. One point may be, if there are more than two picos. May be something like token ring has to be reinvented? -andreas |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6798 |
By all means reinvent it. :) You can fiddle COM to have one master and multiple slaves relatively easily. You can switch I2C to be master or slave on the fly - you can even run it in multiple master modes if you send codes to enable one at once. That might be a good basis for a token ring sort of thing. SPI isn't really great as the PicoMite can't be a true slave without a lot of messing about. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
ice2642 Regular Member Joined: 27/05/2023 Location: BrazilPosts: 82 |
Get a look in the video of this guy https://www.youtube.com/watch?v=SVZaSRUhIjo&list=PLvCRDUYedILfHDoD57Yj8BAXNmNJLVM2r&index=1&ab_channel=Rumbledethumps Maybe it give you some ideas, He's project is pico with a MC6502, but the interaction of buss and some other details can give a light how to connect picos to produce a cool computer. MMBasic 5.0707 on PicoMite VGA |
||||
Andrew_G Guru Joined: 18/10/2016 Location: AustraliaPosts: 847 |
G'day all, Here Bigmik describes how he stacked two Picos on on top of each other with the WebMite on top (so the antenna is clear). Pins pass through and are soldered to the Gnd and 5v of both Picos. No other pins pass through. The lower PicoMite is soldered to the PCB. The GP00 and 01 of each are wired together (crossed) for serial Rx/Tx. His PCB takes out the connections from the lower PicoMite. The upper WebMite only has the serial and power connections. The Webmite handles all the WWW tasks (eg NTP, OpenWeather weather and forecasts). The PicoMite handles all GUI to/from a touch LCD, the HC-12 data from up the pole weather sensors etc. The two Picos communicate commands and responses via serial. Each Pico is programmed via its own USB but then run off the single 5V input with a common GND. It works well. Cheers, Andrew |
||||
andreas Senior Member Joined: 07/12/2020 Location: GermanyPosts: 207 |
Hello all, here it is: The WebMiteLCD :-) Step1: putting them together this way WebMite on top, RP2040LCD on the back Soldered are: GND(8x),VBUS,GP0 and GP1 (Null modem, crossover) All other header pins are dragged out after soldering GND lines Step2: The Software Left side: RP2040LCD showing everything received by COM1: > list ' ser2lcd running on RP2040LCD Option explicit Backlight 10 Dim t$ As String = "" Sub lcdshow(text$) ' show text on LCD display 8x20 chars Local message$ As String Local mlength As integer Static linepointer = 0 message$ = text$ mlength = Len(message$) Do While mlength > 0 If mlength >= 20 Then Text 0,linepointer,Left$(message$,20) message$ = Right$(message$,mlength-20) Else Text 0,linepointer,message$ message$ = "" EndIf mlength = Len(message$) linepointer = (linepointer + 10) Mod 80 Loop End Sub CLS SetPin gp1,gp0,com1 Open "com1:115200" As #1 Do ' display text received by serial interface If Loc(#1) > 0 Then t$ = Input$(Loc(#1),#1) Print t$; lcdshow(t$) EndIf Pause 100 Loop Close #1 Right side: WebMite sending a text$ to COM1: > list ' WebMiteF - The Big Communicator Sub dm(t$) ' display message SetPin gp1,gp0,com1 Open "com1:115200" As #1 Print #1,t$ Pause 10 Close #1 End Sub ' Testprogramm dm("Hello, World!") dm("This line is longer than 20 chars and should be printed on several lines.") -andreas |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3150 |
Looking good there. If you don't plan on other timing-critical needs, you could introduce a "PAUSE 20" after "If Loc(#1) > 0 Then" and then read the entire contents of the buffer ("t$ = Input$(Loc(#1),255)"). At 115200, 20ms should give you time for a complete refresh of the screen--160 characters. Maybe for commands to execute, precede the command string with "!" and check for that as a beginning character: "!SETPIN 4,DOUT" followed after 20ms with "!PIN(4)=1". Then if mid$(t$,1,1)="!" then EXECUTE mid$(t$,2) else lcdshow(t$) endif PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
andreas Senior Member Joined: 07/12/2020 Location: GermanyPosts: 207 |
Hello lizby, very good stuff - I will test it! Currently I'm using this(the code changes every minute;) to get a CLS command send over the line - but yours is more flexible. I was even thinking about some kind of "POSTSCRIPT" language to send by the serial line;) Do ' display text received by serial interface If Loc(#1) > 0 Then t$ = Input$(Loc(#1),#1) Select Case t$ Case "CLS"+Chr$(13)+Chr$(10) CLS linepointer = 0 Case Else lcdshow(t$) End Select EndIf Pause 100 Loop Today I have received tiny cables with a connector fitting into the tiny accu connector of the RP2040. The colours are wrong (black and red!). Then I saw that it would be better to connect VSYS to VSYS and not VBUS to VBUS as I did it. The diode seems to "protect" the WebMite pico w from power sourcing from the battery connector of the RP2040. So I will change that hardware design. -andreas Edited 2023-06-11 01:17 by andreas |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6798 |
The on-board diode from VBUS to VSYS is to prevent a back-feed from the Pico to the USB port of the PC. That can damage the USB chip of the PC, which is not considered to be a "good thing"! It doesn't matter if the USB socket is the only source of supply. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3150 |
Of course, with EXECUTE, you could also do such things as option escape SetPin gp1,gp0,com1 Open "com1:115200" As #1 t$="!SETPIN 4,DOUT" Print #1,t$ pause 25 Print #1,"!PIN(4)=1" pause 25 Print #1,"!CLS" pause 25 t$="!? \qPin(4)=\q;pin(4);" Print #1,t$ PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
andreas Senior Member Joined: 07/12/2020 Location: GermanyPosts: 207 |
My current working version WebMiteLCD with "EXECUTE" capability: Sender (WebMiteF = pico w) ' WebMiteF - The Big Communicator ' dm-lines starting with "!" will be executed as BASIC code from the LCD unit Sub dm(t$) ' display message SetPin gp1,gp0,com1 Open "com1:115200" As #1 Print #1,t$ Pause 10 Close #1 End Sub Sub clearLCD() ' clear LCD dm("!CLS") dm("!linepointer = 0") End Sub ' Testprogram(m) clearLCD dm("Hello, World!") dm("My ip address is:") dm(MM.Info(ip address)) Receiver (RP2014LCD) ' ser2lcd running on RP2040LCD Option explicit Dim command$ As String = "" ' command to execute if line starts with a "!" Dim linepointer As Integer = 0 ' line to write the next line of text on the LCD Backlight 10 Dim t$ As String = "" ' received message Sub lcdshow(text$) ' show text on LCD display 8x20 chars Local message$ As String Local mlength As integer message$ = text$ mlength = Len(message$) Do While mlength > 0 If mlength >= 20 Then Text 0,linepointer,Left$(message$,20) message$ = Right$(message$,mlength-20) Else Text 0,linepointer,message$ message$ = "" EndIf mlength = Len(message$) linepointer = (linepointer + 10) Mod 80 Loop End Sub ' main program CLS SetPin gp1,gp0,com1 Open "com1:115200" As #1 Do ' display text received by serial interface If Loc(#1) > 0 Then Pause 5 ' ms time to read the message t$ = Input$(Loc(#1),#1) If Left$(t$,1)="!" And Len(t$) > 1 Then ' it is a command command$ = Right$(t$,Len(t$)-1) ' take the rest of line Execute command$ command$ = "" t$ = "" Else lcdshow(t$) ' display normal text t$ = "" EndIf EndIf Loop Close #1 Example: Options Sender: WebMite MMBasic Version 5.07.08b2 OPTION AUTORUN ON OPTION LIBRARY_FLASH_SIZE 14000 OPTION COLOURCODE ON OPTION DISPLAY 50, 100 OPTION WIFI FlitzBox, ********************* OPTION TELNET CONSOLE ON Options Receiver: PicoMite MMBasic Version 5.07.07 OPTION SYSTEM SPI GP10,GP11,GP28 OPTION AUTORUN ON OPTION COLOURCODE ON OPTION HEARTBEAT OFF OPTION DISPLAY 50, 100 OPTION LCDPANEL ST7735S, LANDSCAPE,GP8,GP12,GP9,GP25 -andreas |
||||
andreas Senior Member Joined: 07/12/2020 Location: GermanyPosts: 207 |
I forgot the library of the sender: Sub DoConnect Do While MM.Info(TCPIP STATUS) <> 3 If Timer > 6000 Then CPU restart Loop End Sub DoConnect this ensures that the pico w is always connected to the wlan. -andreas |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3150 |
Nice. Congrats. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
andreas Senior Member Joined: 07/12/2020 Location: GermanyPosts: 207 |
..even graphics is working: ' WebMiteF - The Big Communicator ' dm-lines starting with "!" will be executed as BASIC code from the LCD unit Sub dm(t$) ' display message SetPin gp1,gp0,com1 Open "com1:115200" As #1 Print #1,t$ Pause 10 Close #1 End Sub Sub clearLCD() ' clear LCD dm("!CLS") dm("!linepointer = 0") End Sub ' Testprogram(m) clearLCD dm("Hello, World!") dm("My ip address is:") dm(MM.Info(ip address)) dm("!Box 0,40,30,30,,rgb(red)") dm("!Circle 50,55,15,1,1,rgb(yellow)") -andreas |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3150 |
Better and better. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
hhtg1968 Senior Member Joined: 25/05/2023 Location: GermanyPosts: 123 |
when i read about the dream of Andreas i remember the design #2 from geoffg´s site of the picomitevga. look at the foto... why peter creates place for 2 further picos? |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6798 |
He doesn't. Note that it says "Sockets for two Raspberry Pi Pico expansion boards." They are wired in parallel with the PicoMite so you can plug in expansion modules as if they were "hats" on a Pico. You can't have two "active" devices with all the IO pins connected together, such as two Picos. If you want to link two or more PicoMites then it's relatively easy to use I2C to send messages between them. I did a board (the PicoMite Pear) a while ago that links a standard PicoMite with a PicoMite VGA. I was just looking and I don't think I put it on my Dropbox... I'll try to sort that out later. Edited 2023-06-11 15:59 by Mixtel90 Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
Page 1 of 2 |
Print this page |